Write

apply_outline_changes

Apply many changes in one call — the primary write path for agents.


All-or-Nothing Execution

The batch is executed in memory and only persisted if all operations succeed. If any op fails, the call returns an error with the failing index and nothing is written.

Parameters

NameTypeRequiredDescription
outlineIdstring—Outline ID. Defaults to your own outline.
ifUpdatedAtstring—Optional optimistic-concurrency guard: the outline updatedAt you last read (from get_profile or a previous write's response). If the outline changed since, the call fails with CONFLICT and nothing is written.
idempotencyKeystring—Optional key (≤128 chars). Returns idempotency: 'enforced' on success, 'replayed' on identical retry, or fails on hash mismatch.
confirmDeletesboolean—Required to be true when any op is delete_card or delete_stack.
opsarrayYesAn array of operations to apply in order. Max 50 ops.

Available ops:
- add_stack: { op: 'add_stack', ref?, title?, afterStackId? }
- update_stack: { op: 'update_stack', stackId, title? }
- delete_stack: { op: 'delete_stack', stackId }
- move_stack: { op: 'move_stack', stackId, toIndex }
- add_card: { op: 'add_card', stackId, ref?, afterCardId?, index?, kind?, fields? }
- update_card: { op: 'update_card', stackId, cardId, fields }
- delete_card: { op: 'delete_card', stackId, cardId }
- move_card: { op: 'move_card', stackId, cardId, toIndex, toStackId? }
- set_cover: { op: 'set_cover', stackId, cardId, mediaId, coverColor?, forceHorizontalFit? }
- set_profile: { op: 'set_profile', name?, look?, profileType? }
- set_seo: { op: 'set_seo', title?, description?, imageId? }
- set_social_links: { op: 'set_social_links', links }

Response

FieldTypeWhat it means
outlineIdstringResolved outline ID.
updatedAtstring | nullThe new updatedAt timestamp.
resultsarrayArray of results matching each op index.
refsobjectMap of provided refs to generated IDs.
idempotencystringOne of 'none', 'enforced', or 'replayed'.

Example

Request

json
{ "ops": [ { "op": "add_stack", "ref": "my_new_stack", "title": "New Section" }, { "op": "add_card", "stackId": "my_new_stack", "fields": { "heading": "First Card" } } ] }

Response

json
{ "outlineId": "42", "updatedAt": "2026-09-13T00:00:00.000Z", "results": [ { "index": 0, "ok": true, "id": "stack-new-1" }, { "index": 1, "ok": true, "id": "card-new-2" } ], "refs": { "my_new_stack": "stack-new-1" }, "idempotency": "enforced" }