Documents
18 endpoints under /v1/documents.
List documents, filtered by workspace, category, tags, kind, visibility or origin.
/v1/documentsDefaults to the current workspace; include_shared adds org-wide documents (workspace_id null). Paginated by limit and offset.
Requiresdocuments:read
Query parameters
category_idstring (uuid)optionalFilter by specific category ID
workspace_idstringoptionalFilter by workspace ID (uses current workspace if not specified)
tagsstringoptionalComma-separated category names to filter by
kindenumoptionalFilter by document role.
kbreturns only knowledge-base documents (the wizard's KB-doc step uses this);guidelinereturns only guideline documents. Omit to list every kind.kbguideline
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Get document details
/v1/documents/{document_id}Requiresdocuments:read
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Update document metadata
/v1/documents/{document_id}Requiresdocuments:write
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
filenamestringoptionaldescriptionstringoptional
Failures return the error envelope; branch on error_code.
Delete a document
/v1/documents/{document_id}Requiresdocuments:delete
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Replace all categories for a document
/v1/documents/{document_id}/categoriesRequiresdocuments:write
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
category_idsstring (uuid)[]required
Failures return the error envelope; branch on error_code.
Add document to category
/v1/documents/{document_id}/categories/{category_id}Requirescategories:write
Path parameters
document_idstring (uuid)requiredcategory_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Remove document from category
/v1/documents/{document_id}/categories/{category_id}Requirescategories:write
Path parameters
document_idstring (uuid)requiredcategory_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Return a txt/md document's text for editing.
/v1/documents/{document_id}/contentServed on /api/documents/{id}/content (dashboard) and /v1/documents/{id}/content (SDK). Other file types are refused: what comes out is what PUT can replace.
Requiresdocuments:read
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Save a txt/md document's text; free to call on every autosave.
/v1/documents/{document_id}/contentServed on /api/documents/{id}/content (admin role) and /v1/documents/{id}/content (SDK, documents:write scope). Idempotency-Key required. DeepContext is not touched; call POST /documents/{id}/index once the writer is done.
Requiresdocuments:write
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
contentstringrequired
Failures return the error envelope; branch on error_code.
Report DC ingest lifecycle health for one document.
/v1/documents/{document_id}/diagnosticsReturns a typed deviation list to branch on without parsing strings. Free read; documents:read suffices.
Requiresdocuments:read
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Update extracted text content for a document
/v1/documents/{document_id}/extracted-textRequiresdocuments:write
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Force the guideline classify+distill pass for one document.
/v1/documents/{document_id}/guideline/recompileConfirms a likely_kb verdict ("compile it anyway") or re-runs after a prompt-version bump. Enqueues with force=True, bypassing the classifier gate and the hash short-circuit. Tracked-only (0 credits); returns 202 with the task queued.
Requiresdocuments:write
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Send a written document's saved text to DeepContext for search.
/v1/documents/{document_id}/indexCalled when the writer leaves the document. A no-op when DeepContext already holds this text, so repeated calls are safe; indexed says whether anything was sent.
Requiresdocuments:write
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Keep an RFP-like document in the knowledge base on purpose.
/v1/documents/{document_id}/keep-as-referenceThe flag records the choice so the check never asks again and retrieval can tell it from company material. "Start a proposal from it" needs no route: the client sends the same file to the proposal upload and deletes this document.
Requirescategories:write
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Check whether files would be accepted, before any byte moves.
/v1/documents/preflightReturns one verdict per file, in order (a drop of twelve with room for ten admits the first ten), plus the room left. The upload remains the authority.
Requiresdocuments:read
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
filesobject[]requiredworkspace_kindenumoptionaldataguideline
Failures return the error envelope; branch on error_code.
Upload a document; indexing runs in the background.
/v1/documents/uploadPoll processing_status for completion. Gated by the document_upload operation (max_documents, max_storage_gb).
Requiresdocuments:write
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Form fields
filefilerequiredcategory_idsstringoptionalkindenumoptionalDocument role override. When omitted, the document inherits the parent workspace's kind (data → kb, guideline → guideline) — the legacy implicit behaviour preserved for every existing caller. The KB pane upload defaults the kind via the workspace; the Guidelines pane upload routes through
X-Workspace-IDto the guideline workspace and the kind seeds from there.kbguidelinevisible_in_workspace_idstring (uuid)optionalPer-workspace visibility scope for guideline documents (mig 123). NULL (default) = org-wide visibility (today's behavior, preserved). Set to a data workspace id = the guideline is only visible from that workspace's wizard / Guidelines tab. Meaningful only for guideline-kind uploads; the service layer rejects this field on KB-kind uploads with a 400, mirroring the DB-level CHECK.
Failures return the error envelope; branch on error_code.
Upload a document as a raw markdown or plaintext JSON body.
/v1/documents/upload-textSame document_upload gating (scope, limits) and atomic credit commit as POST /upload. Only .md and .txt; binary formats need the multipart route.
Requiresdocuments:write
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
filenamestringrequiredcontentstringrequiredcategory_idsstring (uuid)[]optionalindex_on_leavebooleanoptional
Failures return the error envelope; branch on error_code.
Start a model writing a document, the same writing Arthur's start_document starts.
/v1/documents/writeA new document's row exists on return, so its card can show at once. The text streams on GET /runs/{run_id}/stream as stage=document frames (snapshot | delta | complete); the run's lifecycle rides /runs/live with kind=document and the document_id.
Requiresdocuments:write
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
instructionsstringoptionalWhat the document should contain (new / rewrite / append).
contextstringoptionalMaterial to write from, sent whole.
titlestringoptionalmodeenumoptionalnewrewriteappendedit
Failures return the error envelope; branch on error_code.