---
title: PATCH /api/articles/[id]
description: Update an article's body and/or subtitle. Three body shapes — markdown (CLI replace-all), content (editor HTML), and subtitle — all routed through the section model.
---

<Note>

The CLI equivalent is `scripto articles update <id> --file draft.md`, which sends `markdown`. To edit just one part, prefer the [section endpoints](/api-reference/add-section) — they keep your context small.

</Note>

Updates a body and/or the subtitle (owner-scoped). All body writes route through the [section model](/concepts/sections), so the invariant `content === concat(sections.html)` always holds, and `title` / `coverImage` / `wordCount` are re-derived server-side whenever a body is present.

## Endpoint

```text
PATCH https://scripto.codika.io/api/articles/{id}
```

## Auth

`Authorization: Bearer scripto_…`

## Request

Send at least one of three fields:

| Field | Type | Meaning |
|---|---|---|
| `markdown` | string | **CLI replace-all.** Split fresh sections from this Markdown. |
| `content` | string | **Editor autosave (HTML).** Reconcile into sections, keeping unchanged sections' Markdown. |
| `subtitle` | string \| null | Set or clear the dek. No body change. |

If both `markdown` and `content` are sent, `markdown` wins.

```json
{ "markdown": "# Our launch\n\nWhat changed…\n\n## Why it matters\n\n…" }
```

## Response (200)

```json
{ "success": true, "data": { "article": { "id": "0a1b2c3d-…", "title": "Our launch", "…": "…" } } }
```

## Errors

| HTTP | `code` | Cause |
|---|---|---|
| 400 | `invalid-argument` | Body isn't JSON; wrong field type; or none of `markdown`/`content`/`subtitle` provided. |
| 401 | `unauthenticated` | Missing or invalid key. |
| 404 | `not-found` | No such article, or you don't own it. |
| 500 | `internal` | Backend error. |

## curl

```bash
# Set the subtitle only.
curl -sS -X PATCH "https://scripto.codika.io/api/articles/$ID" \
  -H "Authorization: Bearer $SCRIPTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subtitle":"What changed and why"}'
```

## Next

- **[The section endpoints](/api-reference/add-section)** — edit one part at a time.
- **[POST .../publish](/api-reference/publish-article)** — go live.
