Apply content edits
Changes a draft’s body now with block edits, all of them or none. When teammates have the draft open in the editor, the change appears there too. The live page changes only when the draft is published.
- Refused with
409 conflictwhile the draft has suggestions waiting for review. - Every apply returns an
edit_id; Undo content edit reverses it while the edited blocks are unchanged. - A
500means the outcome could not be confirmed: read the outline before sending the edits again. The hashes refuse a set that already landed.
Requires the write:content scope, and the workspace must be enabled for API writes.
POST /v1/brands/{brand_id}/content/{draft_id}/editsAuthorization
| Header | Type | Required |
|---|---|---|
Authorization | Bearer asky_sk_… | required |
Idempotency-Key | string | required |
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
brand_id | uuid | required | From List brands |
draft_id | uuid | required | From List content drafts |
Query parameters
None.
Body
application/json, up to 1 MB.
| Field | Type | Required | Description |
|---|---|---|---|
edits | array, 1 to 40 | required | Block edits, below |
Block edits
Body edits address the numbered blocks Get content outline returns. Each edit is one object:
| Field | Type | Required | Description |
|---|---|---|---|
op | "replace" | "insert" | "delete" | required | replace swaps block N, insert places new html before block N (N equal to the block count appends), delete removes block N |
index | integer | required | Block index from the outline |
html | string, up to 20,000 chars | for replace and insert | The new html |
base_hash | string | required while the body has blocks | The outline’s hash for block N; for an append, the last block’s |
- Indexes are fixed: every index addresses the outline as you read it, never as changed by your other edits. To add several blocks in one place, send one insert per block, all with the same index, in reading order.
- An edit whose
base_hashno longer matches its block is refused with409 conflict, and so is the whole set: read the outline again and rebuild the edits. Nothing is written. - Allowed tags: p, h1 to h5, ul, ol, li, blockquote, pre, code, strong, em, s, u, a, img, hr, br, table, tr, th, td. Anything else is removed before the edit is checked, as the editor would store it.
- An
imgmay only use an image already in the draft. - At most 40 edits per call, one per block.
Request
curl --request POST \
--url 'https://api.askylabs.com/v1/brands/242546de-4cee-4a7d-952e-f6aa60c63ef8/content/7c1e2b90-3f4d-4a8e-9b21-5d6f7a8b9c0d/edits' \
--header 'Authorization: Bearer <api-key>' \
--header 'Idempotency-Key: <unique-per-attempt>' \
--header 'Content-Type: application/json' \
--data '{"edits":[{"op":"insert","index":2,"html":"<h2>What a CRM costs</h2>","base_hash":"c41d9e07"},{"op":"insert","index":2,"html":"<p>Most small-team plans cost less than one hour of sales time a month.</p>","base_hash":"c41d9e07"}]}'Response
200
{
"data": {
"edit_id": "5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9",
"draft_id": "7c1e2b90-3f4d-4a8e-9b21-5d6f7a8b9c0d",
"applied": 2,
"undo_available": true,
"review_url": "https://app.askylabs.com/content/7c1e2b90-3f4d-4a8e-9b21-5d6f7a8b9c0d",
"live_page_updated": false,
"translations_unchanged": []
},
"request_id": "req_7d21b0af59c34e18b6ac"
}Response fields
| Field | Type | Description |
|---|---|---|
data.edit_id | uuid | null | required. For undo; null when the edit could not be logged, and then it cannot be undone here |
data.draft_id | uuid | required |
data.applied | integer | required. Edits applied |
data.undo_available | boolean | required |
data.review_url | string | required |
data.live_page_updated | boolean | required. Always false |
data.translations_unchanged | array | required. The draft’s translations, which this edit does not touch |
request_id | string | required |
Last updated on