PATCH /api/articles/[id]/sections/[sid]
Replace one section's body from Markdown. If the new Markdown splits into several sections, the one becomes several in place. Backs scripto section set.
The CLI equivalent is scripto section set <id> <anchor> --file sec.md.
Replaces the section’s body from Markdown. If the new Markdown splits into several sections (multiple headings), the one section becomes several in place. sid is a section anchor.
Endpoint
PATCH https://scripto.codika.io/api/articles/{id}/sections/{sid} Auth
Authorization: Bearer scripto_…
Request
| Field | Type | Meaning |
|---|---|---|
markdown | string | Required, non-empty. The new section body. |
{ "markdown": "## What changed\n\nRewritten paragraph." } Response (200)
{
"success": true,
"data": {
"updated": [ { "anchor": "e5f6a7b8", "level": 2, "title": "What changed", "words": 22, "source": "markdown" } ],
"outline": [ "… the full fresh outline …" ]
}
} Errors
| HTTP | code | Cause | nextAction |
|---|---|---|---|
| 400 | invalid-argument | Empty markdown, or ambiguous anchor. | Use a longer anchor. |
| 404 | not-found | No such article, or no section matches the anchor. | Call GET /outline for current anchors. |
| 401 | unauthenticated | Missing or invalid key. | — |
curl
curl -sS -X PATCH "https://scripto.codika.io/api/articles/$ID/sections/e5f6a7b8" \
-H "Authorization: Bearer $SCRIPTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"markdown":"## What changed\n\nRewritten paragraph."}' Next
- DELETE …/sections/[sid] — remove a section.
- POST …/sections/[sid]/move — reorder.