---
title: POST /api/articles/[id]/sections/[sid]/move
description: Reorder a section relative to another, by anchor — exactly one of after/before, and not the section being moved. Backs scripto section mv.
---

<Note>

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

</Note>

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

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

## Auth

`Authorization: Bearer scripto_…`

## Request

| Field | Type | Meaning |
|---|---|---|
| `after` | string (anchor) | Move after this section. |
| `before` | string (anchor) | Move before this section. |

Exactly one is required.

```json
{ "before": "a1b2c3d4" }
```

## Response (200)

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

## Errors

| HTTP | `code` | Cause | `nextAction` |
|---|---|---|---|
| 400 | `invalid-argument` | Not exactly one of `after`/`before`; or moving a section relative to itself; 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

```bash
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

- **[The ordered-sections model](/concepts/sections)** — positions and ordering.
