---
title: "Writes the live body of the store's home, a page, a product or an entry, or with `staged: true` its unpublished next body, which `publishBody` publishes; `from` names the body read, so a write over one changed since is refused. Ask `getBodySchema` for the blocks, props and values its kind takes before writing: anything else is refused, naming the block, the prop and what it takes."
---

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

Path: Sherpo merchant API › file

`PUT /v1/stores/{store}/{kind}/{id}/body`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `file:write`

## Path parameters

- `store` (`setBody.path.store`; string, required) — The store's id.
- `kind` (`setBody.path.kind`; string, required) — The target's kind, in the plural.
  - minLength 1
- `id` (`setBody.path.id`; string, required)
  - minLength 1

## Request body

_Required._

- `content` (`setBody.content`; string, required) — The body's text, a blocks layout whose texts (a markdown block's `content`, and those its blocks nest) are rich texts, stored in its canonical form in 1 MiB of UTF-8; an image it starts showing is at most 15 MB.
  - minLength 1; maxLength 262144
- `from` (`setBody.from`; any of, required) — The `asset.id` the body (or the staged body) held when the caller read it, never its `attachment.id`; null when it had none.
  - any of: `object`, `null`
- `text_format` (`setBody.text_format`; string, optional) — The format the rich text fields are written in: the rich text format’s HTML, or Markdown converted into it before it is validated. A text already stored in the format (starting with `<rich-text`) is kept as it is either way.
  - one of `"html"`, `"markdown"`; default `"html"`
- `full` (`setBody.full`; boolean, optional) — Answers the texts, attachments and file lists the short answer leaves out.
- `staged` (`setBody.staged`; boolean, optional) — Writes the unpublished next body instead of the live one.
- `live` (`setBody.live`; any of, optional) — On a staged write, the live body's `asset.id` the caller started from, never its `attachment.id`; null when there was none.
  - any of: `object`, `null`
- `unpublished` (`setBody.unpublished`; boolean, optional) — On a live write, the caller saved it believing its page or product isn't live.

## Example request

```json
{
  "text_format": "html",
  "full": true,
  "content": "string",
  "from": {
    "id": "string"
  },
  "staged": true,
  "live": {
    "id": "string"
  },
  "unpublished": true
}
```

## Code samples

### cURL

```bash
curl --request PUT \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/<kind>/<id>/body' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text_format": "html",
  "full": true,
  "content": "string",
  "from": {
    "id": "string"
  },
  "staged": true,
  "live": {
    "id": "string"
  },
  "unpublished": true
}
'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/<kind>/<id>/body';
const options = {
  method: 'PUT',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    text_format: 'html',
    full: true,
    content: 'string',
    from: {id: 'string'},
    staged: true,
    live: {id: 'string'},
    unpublished: true
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/<kind>/<id>/body"

payload = {
    "text_format": "html",
    "full": True,
    "content": "string",
    "from": { "id": "string" },
    "staged": True,
    "live": { "id": "string" },
    "unpublished": True
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Writes the live body of the store's home, a page, a product or an entry, or with `staged: true` its unpublished next body, which `publishBody` publishes; `from` names the body read, so a write over one changed since is refused. Ask `getBodySchema` for the blocks, props and values its kind takes before writing: anything else is refused, naming the block, the prop and what it takes.

#### Example

```json
{
  "attachment": {
    "id": "string"
  },
  "asset": {
    "id": "string"
  },
  "created": [
    {
      "id": "string",
      "role": "string",
      "asset": {
        "id": "string"
      }
    }
  ],
  "attachments": [
    {
      "id": "string",
      "target": {
        "kind": "string",
        "id": "string"
      },
      "role": "string",
      "delivery": "string",
      "preview_only": true,
      "from_body": true,
      "release_file": true,
      "position": 0,
      "asset": {
        "id": "string",
        "locator": "string",
        "origin": "string",
        "custodian": "string",
        "enforcement": "string",
        "mime": "string",
        "bytes": 0,
        "quota_bytes": 0,
        "name": "string",
        "title": "string",
        "ext": "string",
        "status": "string",
        "optimized": true,
        "parent_id": "string",
        "redacted": true,
        "security": "string",
        "description": "string",
        "processed_at": "string",
        "metadata": {
          "width": 0,
          "height": 0,
          "duration": 0,
          "pages": 0,
          "waveform": "string",
          "transcript": {
            "language": "string",
            "confidence": 0
          },
          "arguments": [
            {
              "name": "string",
              "description": "string",
              "required": true,
              "default": "string",
              "match": "string",
              "flags": "string",
              "message": "string",
              "lenient": true
            }
          ],
          "property1": true,
          "property2": true
        },
        "created_at": "string"
      }
    }
  ],
  "preview": {
    "url": "string",
    "expires_at": "string"
  }
}
```

- `attachment` (`setBody.response.200.attachment`; object, required)
  - `id` (`setBody.response.200.attachment.id`; string, required)
- `asset` (`setBody.response.200.asset`; object, required) — The asset the body holds now: the next write's `from` (or a staged write's `live`).
  - `id` (`setBody.response.200.asset.id`; string, required)
- `created` (`setBody.response.200.created`; array<object>, required) — The attachments the write bound: the embeds a live write or a publish derived.
  - `id` (`setBody.response.200.created.id`; string, required)
  - `role` (`setBody.response.200.created.role`; string, required)
  - `asset` (`setBody.response.200.created.asset`; object, required)
    - `id` (`setBody.response.200.created.asset.id`; string, required)
- `preview` (`setBody.response.200.preview`; any of, required) — The body's page on the store with a token opening it, for an hour; null where none is answered.
  - any of: `object`, `null`
- `attachments` (`setBody.response.200.attachments`; array<object>, optional) — Every attachment on the target with its asset whole; answered only with `full`.
  - `id` (`setBody.response.200.attachments.id`; string, required)
  - `target` (`setBody.response.200.attachments.target`; object, required)
    - `kind` (`setBody.response.200.attachments.target.kind`; string, required)
    - `id` (`setBody.response.200.attachments.target.id`; string, required)
  - `role` (`setBody.response.200.attachments.role`; string, required)
  - `delivery` (`setBody.response.200.attachments.delivery`; string, required)
  - `preview_only` (`setBody.response.200.attachments.preview_only`; boolean, required)
  - `from_body` (`setBody.response.200.attachments.from_body`; boolean, required)
  - `release_file` (`setBody.response.200.attachments.release_file`; boolean, required) — A file a software release ships, which its release edits and the product's own list leaves out.
  - `position` (`setBody.response.200.attachments.position`; number, required)
  - `asset` (`setBody.response.200.attachments.asset`; object, required)
    - `id` (`setBody.response.200.attachments.asset.id`; string, required)
    - `locator` (`setBody.response.200.attachments.asset.locator`; any of, required)
      - any of: `string`, `null`
    - `origin` (`setBody.response.200.attachments.asset.origin`; string, required)
    - `custodian` (`setBody.response.200.attachments.asset.custodian`; string, required)
    - `enforcement` (`setBody.response.200.attachments.asset.enforcement`; string, required)
    - `mime` (`setBody.response.200.attachments.asset.mime`; any of, required)
      - any of: `string`, `null`
    - `bytes` (`setBody.response.200.attachments.asset.bytes`; any of, required) — The file's size in bytes; null when it is charged nothing.
      - any of: `number`, `null`
    - `quota_bytes` (`setBody.response.200.attachments.asset.quota_bytes`; number, required) — The file's size in bytes; zero when it is charged nothing.
    - `name` (`setBody.response.200.attachments.asset.name`; string, required)
    - `title` (`setBody.response.200.attachments.asset.title`; any of, required)
      - any of: `string`, `null`
    - `ext` (`setBody.response.200.attachments.asset.ext`; any of, required)
      - any of: `string`, `null`
    - `status` (`setBody.response.200.attachments.asset.status`; string, required)
    - `optimized` (`setBody.response.200.attachments.asset.optimized`; boolean, required)
    - `parent_id` (`setBody.response.200.attachments.asset.parent_id`; any of, required)
      - any of: `string`, `null`
    - `redacted` (`setBody.response.200.attachments.asset.redacted`; boolean, required)
    - `security` (`setBody.response.200.attachments.asset.security`; any of, required)
      - any of: `string`, `null`
    - `description` (`setBody.response.200.attachments.asset.description`; any of, required)
      - any of: `string`, `null`
    - `processed_at` (`setBody.response.200.attachments.asset.processed_at`; any of, required)
      - any of: `string`, `null`
    - `metadata` (`setBody.response.200.attachments.asset.metadata`; object, required)
      - `width` (`setBody.response.200.attachments.asset.metadata.width`; integer, optional)
        - min 0
      - `height` (`setBody.response.200.attachments.asset.metadata.height`; integer, optional)
        - min 0
      - `duration` (`setBody.response.200.attachments.asset.metadata.duration`; number, optional) — Seconds, measured, so rarely whole.
      - `pages` (`setBody.response.200.attachments.asset.metadata.pages`; integer, optional)
        - min 0
      - `waveform` (`setBody.response.200.attachments.asset.metadata.waveform`; any of, optional) — An audio file's waveform: 256 levels from 0 to 255, base64; null when it can't be drawn.
        - any of: `string`, `null`
      - `transcript` (`setBody.response.200.attachments.asset.metadata.transcript`; object, optional)
        - `language` (`setBody.response.200.attachments.asset.metadata.transcript.language`; string, optional)
        - `confidence` (`setBody.response.200.attachments.asset.metadata.transcript.confidence`; number, optional)
      - `arguments` (`setBody.response.200.attachments.asset.metadata.arguments`; array<object>, optional) — What an MCP prompt asks for; only an authored prompt carries it.
        - `name` (`setBody.response.200.attachments.asset.metadata.arguments.name`; string, required)
        - `description` (`setBody.response.200.attachments.asset.metadata.arguments.description`; any of, required)
          - any of: `string`, `null`
        - `required` (`setBody.response.200.attachments.asset.metadata.arguments.required`; boolean, required)
        - `default` (`setBody.response.200.attachments.asset.metadata.arguments.default`; any of, required)
          - any of: `string`, `null`
        - `match` (`setBody.response.200.attachments.asset.metadata.arguments.match`; any of, required) — Pattern the whole value must match, diacritic-insensitive.
          - any of: `string`, `null`
        - `flags` (`setBody.response.200.attachments.asset.metadata.arguments.flags`; any of, required) — Flags among `i`, `s` and `u` the pattern runs with; null for `i` alone.
          - any of: `string`, `null`
        - `message` (`setBody.response.200.attachments.asset.metadata.arguments.message`; any of, required) — What a refused value is told instead of the default reason.
          - any of: `string`, `null`
        - `lenient` (`setBody.response.200.attachments.asset.metadata.arguments.lenient`; boolean, required)
    - `created_at` (`setBody.response.200.attachments.asset.created_at`; any of, required)
      - any of: `string`, `null`

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`setBody.response.default.type`; string, required)
  - format `uri`
- `title` (`setBody.response.default.title`; string, required)
- `status` (`setBody.response.default.status`; integer, required)
- `detail` (`setBody.response.default.detail`; string, required)
- `code` (`setBody.response.default.code`; string, optional)
- `context` (`setBody.response.default.context`; object, optional)
- `reached_core` (`setBody.response.default.reached_core`; boolean, optional)
- `core_answer` (`setBody.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/set-body/index.md
