---
title: "Updates, inserts, moves or deletes blocks of a body by id, without sending it whole. `getBodySchema` answers the props each block 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

`POST /v1/stores/{store}/{kind}/{id}/body/edit`

## Authentication

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

## Path parameters

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

## Request body

_Required._

- `from` (`editBody.from`; any of, required) — The `asset.id` the body (or the staged body) held when the caller read it, never its `attachment.id`; null for a first staged body, which the edits start from the live one.
  - any of: `object`, `null`
- `edits` (`editBody.edits`; array<any of>, required) — The edits, applied in order, landing together or not at all.
  - any of: `object`, `object`, `object`, `object`
- `text_format` (`editBody.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` (`editBody.full`; boolean, optional) — Answers the texts, attachments and file lists the short answer leaves out.
- `staged` (`editBody.staged`; boolean, optional) — Edits the unpublished next body instead of the live one.
- `live` (`editBody.live`; any of, optional) — On a first staged edit, the live body's `asset.id` the edits start from, never its `attachment.id`.
  - any of: `object`, `null`
- `unpublished` (`editBody.unpublished`; boolean, optional) — On a live edit, the caller made it believing its page or product isn't live.

## Example request

```json
{
  "text_format": "html",
  "full": true,
  "from": {
    "id": "string"
  },
  "staged": true,
  "live": {
    "id": "string"
  },
  "unpublished": true,
  "edits": [
    {
      "kind": "update",
      "id": "string",
      "block": "string",
      "replace": true
    }
  ]
}
```

## Code samples

### cURL

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

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/<kind>/<id>/body/edit';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    text_format: 'html',
    full: true,
    from: {id: 'string'},
    staged: true,
    live: {id: 'string'},
    unpublished: true,
    edits: [{kind: 'update', id: 'string', block: 'string', replace: 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/edit"

payload = {
    "text_format": "html",
    "full": True,
    "from": { "id": "string" },
    "staged": True,
    "live": { "id": "string" },
    "unpublished": True,
    "edits": [
        {
            "kind": "update",
            "id": "string",
            "block": "string",
            "replace": True
        }
    ]
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Updates, inserts, moves or deletes blocks of a body by id, without sending it whole. `getBodySchema` answers the props each block takes.

#### Example

```json
{
  "blocks": [
    "string"
  ],
  "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"
  }
}
```

- `blocks` (`editBody.response.200.blocks`; array<string>, required)
- `attachment` (`editBody.response.200.attachment`; object, required)
  - `id` (`editBody.response.200.attachment.id`; string, required)
- `asset` (`editBody.response.200.asset`; object, required) — The asset the body holds now: the next write's `from` (or a staged write's `live`).
  - `id` (`editBody.response.200.asset.id`; string, required)
- `created` (`editBody.response.200.created`; array<object>, required) — The attachments the write bound: the embeds a live write or a publish derived.
  - `id` (`editBody.response.200.created.id`; string, required)
  - `role` (`editBody.response.200.created.role`; string, required)
  - `asset` (`editBody.response.200.created.asset`; object, required)
    - `id` (`editBody.response.200.created.asset.id`; string, required)
- `preview` (`editBody.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` (`editBody.response.200.attachments`; array<object>, optional) — Every attachment on the target with its asset whole; answered only with `full`.
  - `id` (`editBody.response.200.attachments.id`; string, required)
  - `target` (`editBody.response.200.attachments.target`; object, required)
    - `kind` (`editBody.response.200.attachments.target.kind`; string, required)
    - `id` (`editBody.response.200.attachments.target.id`; string, required)
  - `role` (`editBody.response.200.attachments.role`; string, required)
  - `delivery` (`editBody.response.200.attachments.delivery`; string, required)
  - `preview_only` (`editBody.response.200.attachments.preview_only`; boolean, required)
  - `from_body` (`editBody.response.200.attachments.from_body`; boolean, required)
  - `release_file` (`editBody.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` (`editBody.response.200.attachments.position`; number, required)
  - `asset` (`editBody.response.200.attachments.asset`; object, required)
    - `id` (`editBody.response.200.attachments.asset.id`; string, required)
    - `locator` (`editBody.response.200.attachments.asset.locator`; any of, required)
      - any of: `string`, `null`
    - `origin` (`editBody.response.200.attachments.asset.origin`; string, required)
    - `custodian` (`editBody.response.200.attachments.asset.custodian`; string, required)
    - `enforcement` (`editBody.response.200.attachments.asset.enforcement`; string, required)
    - `mime` (`editBody.response.200.attachments.asset.mime`; any of, required)
      - any of: `string`, `null`
    - `bytes` (`editBody.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` (`editBody.response.200.attachments.asset.quota_bytes`; number, required) — The file's size in bytes; zero when it is charged nothing.
    - `name` (`editBody.response.200.attachments.asset.name`; string, required)
    - `title` (`editBody.response.200.attachments.asset.title`; any of, required)
      - any of: `string`, `null`
    - `ext` (`editBody.response.200.attachments.asset.ext`; any of, required)
      - any of: `string`, `null`
    - `status` (`editBody.response.200.attachments.asset.status`; string, required)
    - `optimized` (`editBody.response.200.attachments.asset.optimized`; boolean, required)
    - `parent_id` (`editBody.response.200.attachments.asset.parent_id`; any of, required)
      - any of: `string`, `null`
    - `redacted` (`editBody.response.200.attachments.asset.redacted`; boolean, required)
    - `security` (`editBody.response.200.attachments.asset.security`; any of, required)
      - any of: `string`, `null`
    - `description` (`editBody.response.200.attachments.asset.description`; any of, required)
      - any of: `string`, `null`
    - `processed_at` (`editBody.response.200.attachments.asset.processed_at`; any of, required)
      - any of: `string`, `null`
    - `metadata` (`editBody.response.200.attachments.asset.metadata`; object, required)
      - `width` (`editBody.response.200.attachments.asset.metadata.width`; integer, optional)
        - min 0
      - `height` (`editBody.response.200.attachments.asset.metadata.height`; integer, optional)
        - min 0
      - `duration` (`editBody.response.200.attachments.asset.metadata.duration`; number, optional) — Seconds, measured, so rarely whole.
      - `pages` (`editBody.response.200.attachments.asset.metadata.pages`; integer, optional)
        - min 0
      - `waveform` (`editBody.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` (`editBody.response.200.attachments.asset.metadata.transcript`; object, optional)
        - `language` (`editBody.response.200.attachments.asset.metadata.transcript.language`; string, optional)
        - `confidence` (`editBody.response.200.attachments.asset.metadata.transcript.confidence`; number, optional)
      - `arguments` (`editBody.response.200.attachments.asset.metadata.arguments`; array<object>, optional) — What an MCP prompt asks for; only an authored prompt carries it.
        - `name` (`editBody.response.200.attachments.asset.metadata.arguments.name`; string, required)
        - `description` (`editBody.response.200.attachments.asset.metadata.arguments.description`; any of, required)
          - any of: `string`, `null`
        - `required` (`editBody.response.200.attachments.asset.metadata.arguments.required`; boolean, required)
        - `default` (`editBody.response.200.attachments.asset.metadata.arguments.default`; any of, required)
          - any of: `string`, `null`
        - `match` (`editBody.response.200.attachments.asset.metadata.arguments.match`; any of, required) — Pattern the whole value must match, diacritic-insensitive.
          - any of: `string`, `null`
        - `flags` (`editBody.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` (`editBody.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` (`editBody.response.200.attachments.asset.metadata.arguments.lenient`; boolean, required)
    - `created_at` (`editBody.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` (`editBody.response.default.type`; string, required)
  - format `uri`
- `title` (`editBody.response.default.title`; string, required)
- `status` (`editBody.response.default.status`; integer, required)
- `detail` (`editBody.response.default.detail`; string, required)
- `code` (`editBody.response.default.code`; string, optional)
- `context` (`editBody.response.default.context`; object, optional)
- `reached_core` (`editBody.response.default.reached_core`; boolean, optional)
- `core_answer` (`editBody.response.default.core_answer`; string, optional)


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