Scripto docs
View as Markdown

POST /api/articles/[id]/sections/[sid]/move

Reorder a section relative to another, by anchor — exactly one of after/before, and not the section being moved. Backs scripto section mv.

The CLI equivalent is scripto section mv <id> <anchor> [--after|--before <anchor>].

Reorders a section. The body must contain exactly one of after / before (a section anchor), and it must not be the section being moved.

Endpoint

POST https://scripto.codika.io/api/articles/{id}/sections/{sid}/move

Auth

Authorization: Bearer scripto_…

Request

FieldTypeMeaning
afterstring (anchor)Move after this section.
beforestring (anchor)Move before this section.

Exactly one is required.

{ "before": "a1b2c3d4" }

Response (200)

{ "success": true, "data": { "outline": [ "… the full fresh outline …" ] } }

Errors

HTTPcodeCausenextAction
400invalid-argumentNot exactly one of after/before; or moving a section relative to itself; 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 POST "https://scripto.codika.io/api/articles/$ID/sections/9c8d7e6f/move" \
  -H "Authorization: Bearer $SCRIPTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"before":"a1b2c3d4"}'

Next