Scripto docs
View as Markdown

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

FieldTypeMeaning
markdownstringRequired, 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

HTTPcodeCausenextAction
400invalid-argumentEmpty markdown, or ambiguous anchor.Use a longer anchor.
404not-foundNo such article, or no section matches the anchor.Call GET /outline for current anchors.
401unauthenticatedMissing 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