> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cabrapi.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or Update Web Page

> Learn how to create or update a store page using the endpoint PUT /pages/{domain}.

## 📌 Endpoint

`PUT /pages/{domain}`

Creates or updates the store page (upsert).

***

## 🔐 Authentication

* **Private route**.
* Requires header `Authorization` with your API key and active plan.

```json theme={null}
{
	"Authorization": "YOUR_API_KEY_HERE"
}
```

***

## 🧾 Route parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `domain` | string | Yes | Store domain |

***

## 🧍 Body (JSON)

| Field | Type | Required | Rules |
| - | - | - | - |
| `html` | string | Yes | 60 to 1,000,000 characters (stored in Blob) |

***

## ✅ Example request

```bash theme={null}
curl -X PUT "https://api.cabrapi.com.br/v1/pages/minhaloja.com.br" \
	-H "Authorization: YOUR_API_KEY_HERE" \
	-H "Content-Type: application/json" \
	-d '{
		"html": "<html><body><h1>Minha loja personalizada na caBRAPI</h1></body></html>"
	}'
```

***

## Standard snippet (cURL)

Use the cURL example from the Request example section above as the official snippet.

***

## 📦 Success response (200)

```json theme={null}
{
	"code": "PAGE_UPSERTED"
}
```

***

## ⚠️ Possible errors

* `400 INVALID_DATA` → invalid body/parameter (`html` outside the 60 to 1,000,000 character range or invalid `domain`)
* `401 API_KEY_NOT_PROVIDED` → `Authorization` header not sent
* `401 INVALID_API_KEY` → invalid or not found API Key
* `401 UNAUTHENTICATED` → session/user not authenticated
* `403 USER_DISABLED` → user account disabled or deleted
* `403 NO_ACTIVE_SUBSCRIPTION` → account has no active plan
* `404 STORE_NOT_FOUND` → store not found or does not belong to the user
* `429 RATE_LIMIT_EXCEEDED` → plan per-minute request limit exceeded
* `500 INTERNAL_SERVER_ERROR` → internal error
* `502 PAGE_SAVE_FAILED` → failed to save the HTML file to blob storage
* `503 SERVICE_UNAVAILABLE` → service temporarily unavailable


## OpenAPI

````yaml PUT /pages/{domain}
openapi: 3.1.0
info:
  title: caBRAPI
  version: 1.0.0
servers:
  - url: https://api.cabrapi.com.br/v1
security: []
paths:
  /pages/{domain}:
    put:
      tags:
        - Store Page
      summary: Upsert web page
      operationId: upsertPage
      parameters:
        - $ref: '#/components/parameters/Domain'
      requestBody:
        required: true
        description: Page HTML (upsert by domain).
        content:
          application/json:
            schema:
              type: object
              required:
                - html
              properties:
                html:
                  type: string
                  minLength: 60
                  maxLength: 1000000
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    example: PAGE_UPSERTED
                    type: string
                required:
                  - code
                type: object
          description: Upsert web page.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Invalid request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Missing or invalid API key.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden (inactive plan or insufficient permissions).
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Resource not found.
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Rate limit exceeded.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error.
        '502':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Upstream gateway or storage error.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Service unavailable.
      security:
        - ApiKey: []
components:
  parameters:
    Domain:
      in: path
      name: domain
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 255
  schemas:
    Error:
      properties:
        code:
          example: STORE_NOT_FOUND
          type: string
      required:
        - code
      type: object
  securitySchemes:
    ApiKey:
      in: header
      name: Authorization
      type: apiKey
      x-default: YOUR_API_KEY_HERE

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.