API · Endpoints

Doc body

Read and write a doc-mode workspace's body. Send Markdown OR ProseMirror JSON; reads always return ProseMirror JSON. The append endpoint saves the fetch+merge+PUT round-trip for agents producing content in chunks.

Generated from src/lib/api-paths/doc.ts. The body schemas come from UpdateDocSchema and AppendDocSectionSchema in the runtime.

get/api/workspaces/{slug}/doc

Read the doc body

Returns the workspace's doc body as ProseMirror JSON. 403 if the workspace is in table mode.

Auth: Bearer token (API key or OAuth access token).

Path parameters

NameTypeRequiredDescription
slugstringyes

Query parameters

NameTypeRequiredDescription
surfacestringnoSurface slug for multi-doc workspaces. Omit for the primary doc surface.
format"json" | "markdown" | "text"noResponse shape: `json` (ProseMirror, default) · `markdown` (CommonMark + GFM, useful for LLM context or textual diff) · `text` (plain text, no formatting marks). Overrides `Accept` header.

Responses

StatusBodyDescription
200objectDoc body.
403ErrorWorkspace is in table mode (no doc surface).

put/api/workspaces/{slug}/doc

Replace the doc body

Send either `content` (ProseMirror JSON) or `markdown` (string). When both are present, `content` wins. Markdown gets converted server-side via remark + remark-gfm + Dock's rich format set (mermaid, math, callouts, cross-refs, embeds).

Auth: Bearer token (API key or OAuth access token).

Path parameters

NameTypeRequiredDescription
slugstringyes

Request body

FieldTypeRequiredDescription
contentobjectno
markdownstringno

Responses

StatusBodyDescription
200objectReplaced.
400ErrorBody shape failed validation, OR doc body exceeded byte/depth/node-count cap.

post/api/workspaces/{slug}/doc/sections

Append a markdown section to the doc

Append-only counterpart to PUT /doc. Saves the round-trip cost of fetch+merge+PUT for agents producing content in chunks (changelog updates, daily standups, ingest pipelines).

Auth: Bearer token (API key or OAuth access token).

Path parameters

NameTypeRequiredDescription
slugstringyes

Request body

FieldTypeRequiredDescription
markdownstringyes

Responses

StatusBodyDescription
200objectAppended.