Scripto docs
View as Markdown

POST /api/articles

Create an empty draft owned by the authenticated user, returning the full new row. Pair with PATCH to set the body.

The CLI’s scripto articles create --file draft.md calls this to make an empty draft, then immediately PATCHes the body from your Markdown.

Creates an empty draft owned by the authenticated user and returns the full new row. The article starts with a title of Untitled and one seed section, so it’s editable immediately. Set its body with PATCH /api/articles/[id].

Endpoint

POST https://scripto.codika.io/api/articles

Auth

Authorization: Bearer scripto_…

Request

No body required.

Response (201)

{
  "success": true,
  "data": {
    "article": {
      "id": "0a1b2c3d-…",
      "title": "Untitled",
      "subtitle": null,
      "content": "<h1>…</h1>",
      "status": "draft",
      "wordCount": 0,
      "slug": null,
      "createdAt": "2026-06-25T14:30:00.000Z",
      "updatedAt": "2026-06-25T14:30:00.000Z"
    }
  }
}

Errors

HTTPcodeCause
401unauthenticatedMissing or invalid key.
500internalBackend error.

curl

# 1. Create the draft.
ID=$(curl -sS -X POST https://scripto.codika.io/api/articles \
  -H "Authorization: Bearer $SCRIPTO_API_KEY" | jq -r '.data.article.id')

# 2. Set the body from Markdown (the server splits it into sections).
curl -sS -X PATCH "https://scripto.codika.io/api/articles/$ID" \
  -H "Authorization: Bearer $SCRIPTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"markdown":"# My title\n\nFirst paragraph."}'

Next