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

# Fill page

> Update the content of an existing page by filling sections with new text, images, and links.

Merges your content into existing page sections. Only the fields you send are updated -- everything else stays the same. You can update one section or all of them in a single request.

<Info>
  This endpoint requires an API key with **Full access** permission.
</Info>

<ParamField path="page_id" type="string" required>
  The unique ID of the page to fill. Get it from the [list pages](/api/list-pages) endpoint.
</ParamField>

<ParamField header="Authorization" type="string" required>
  Bearer token. Example: `Bearer ew_live_your_key_here`
</ParamField>

<ParamField body="sections" type="object" required>
  Object keyed by section number (`section_1`, `section_2`, etc.) with content fields to update. Only include the fields you want to change.
</ParamField>

## Accepted formats

The fill endpoint is flexible and accepts multiple formats:

<AccordionGroup>
  <Accordion title="Flat content (recommended)">
    Send content fields directly under each section key:

    ```json theme={null}
    {
      "sections": {
        "section_1": {
          "hero01_heading": "New title",
          "hero01_btn": "Shop Now"
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="GET response format">
    You can pass the output from the get page endpoint directly. The API auto-unwraps the `type` and `content` wrapper:

    ```json theme={null}
    {
      "sections": {
        "section_1": {
          "type": "hero01",
          "content": {
            "hero01_heading": "New title"
          }
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="Unwrapped format">
    You can also send section keys at the root level without a `sections` wrapper:

    ```json theme={null}
    {
      "section_1": {
        "hero01_heading": "New title"
      }
    }
    ```
  </Accordion>
</AccordionGroup>

## Filling nested content

### Testimonial cards

Cards are matched by position (index):

```json theme={null}
{
  "sections": {
    "section_3": {
      "cards": [
        { "testimonial11_card_1_quote": "Amazing!", "testimonial11_card_1_author": "Jane D." },
        { "testimonial11_card_2_quote": "Life changing!", "testimonial11_card_2_author": "Mark S." }
      ]
    }
  }
}
```

### Product snippets

Snippets are matched by `type`:

```json theme={null}
{
  "sections": {
    "section_4": {
      "snippets": [
        { "type": "bulletList", "product01_bulletList_1": "New bullet 1" },
        { "type": "noticeBox", "product01_noticeBox_title": "SELLING FAST" }
      ]
    }
  }
}
```

### Advertorial sidebar

```json theme={null}
{
  "sections": {
    "section_1": {
      "sidebar": {
        "title": "My Product",
        "tag": "Best Seller",
        "buttonText": "Check Availability",
        "bullets": ["Benefit one", "Benefit two"]
      }
    }
  }
}
```

## HTML formatting

You can include HTML tags in text content:

| Tag                             | Result           |
| ------------------------------- | ---------------- |
| `<strong>`                      | **Bold text**    |
| `<em>`                          | *Italic text*    |
| `<u>`                           | Underlined text  |
| `<br>`                          | Line break       |
| `<span class='text-highlight'>` | Highlighted text |

<Warning>
  When using `<span>` tags with class attributes, use single quotes for the class value to avoid breaking JSON: `<span class='text-highlight'>` instead of `<span class="text-highlight">`.
</Warning>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://app.ecomwize.io/api/v1/pages/e22f3857-cf0c-49c0-9e44-d76ea0bb7221/fill \
    --header 'Authorization: Bearer ew_live_your_key_here' \
    --header 'Content-Type: application/json' \
    --data '{
      "sections": {
        "section_1": {
          "hero01_heading": "Summer sale is here",
          "hero01_btn": "Shop Now",
          "imageUrl": "https://cdn.shopify.com/my-image.jpg"
        },
        "section_3": {
          "testimonial11_heading": "What our customers say"
        }
      }
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://app.ecomwize.io/api/v1/pages/e22f3857-cf0c-49c0-9e44-d76ea0bb7221/fill",
      headers={
          "Authorization": "Bearer ew_live_your_key_here",
          "Content-Type": "application/json"
      },
      json={
          "sections": {
              "section_1": {
                  "hero01_heading": "Summer sale is here",
                  "hero01_btn": "Shop Now"
              }
          }
      }
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://app.ecomwize.io/api/v1/pages/e22f3857-cf0c-49c0-9e44-d76ea0bb7221/fill",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer ew_live_your_key_here",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        sections: {
          section_1: {
            hero01_heading: "Summer sale is here",
            hero01_btn: "Shop Now"
          }
        }
      })
    }
  );
  const data = await response.json();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "message": "Successfully updated 2 section(s)"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Validation failed",
    "message": "Some sections could not be filled. This page has 12 sections (section_1 to section_12).",
    "details": [
      "section_15 is out of range (section_1 to section_12)"
    ],
    "status": 400
  }
  ```

  ```json 403 theme={null}
  {
    "error": "Read-only API key",
    "message": "This API key has read-only access. Create a new key with Full Access.",
    "status": 403
  }
  ```
</ResponseExample>
