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
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | yes |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
surface | string | no | Surface slug for multi-doc workspaces. Omit for the primary doc surface. |
format | "json" | "markdown" | "text" | no | Response shape: `json` (ProseMirror, default) · `markdown` (CommonMark + GFM, useful for LLM context or textual diff) · `text` (plain text, no formatting marks). Overrides `Accept` header. |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | Doc body. |
403 | Error | Workspace 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
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | yes |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
content | object | no | |
markdown | string | no |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | Replaced. |
400 | Error | Body 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
| Name | Type | Required | Description |
|---|---|---|---|
slug | string | yes |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
markdown | string | yes |
Responses
| Status | Body | Description |
|---|---|---|
200 | object | Appended. |
Related
- Web → Doc mode — UI for the same surfaces (slash menu, image upload).
- Doc formats — Mermaid, math, callouts, cross-refs, embeds (with caps).
- Comments API — anchor a comment to a doc range.
- Workspaces API — pass
initialMarkdownon create to seed the body.