Documents
18 endpoints under /v1/documents.
List Documents
/v1/documentsList documents, filtered by workspace, category, tags, kind, visibility or origin.
Defaults to the current workspace; include_shared adds org-wide
documents (workspace_id null). Paginated by limit and offset.
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
/v1/documents/{document_id}Get document details
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Update Document
/v1/documents/{document_id}Update document metadata
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 Document
/v1/documents/{document_id}Delete a document
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Update Document Categories
/v1/documents/{document_id}/categoriesReplace all categories for a document
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}Add document to category
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}Remove document from category
Path parameters
document_idstring (uuid)requiredcategory_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Get Document Content
/v1/documents/{document_id}/contentReturn a txt/md document's text for editing.
Served 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.
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Update Document Content
/v1/documents/{document_id}/contentSave a txt/md document's text; free to call on every autosave.
Served 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.
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
contentstringrequired
Failures return the error envelope; branch on error_code.
Get Document Diagnostics
/v1/documents/{document_id}/diagnosticsReport DC ingest lifecycle health for one document.
Returns a typed deviation list to branch on without parsing strings.
Free read; documents:read suffices.
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Update Extracted Text
/v1/documents/{document_id}/extracted-textUpdate extracted text content for a document
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Recompile Guideline
/v1/documents/{document_id}/guideline/recompileForce the guideline classify+distill pass for one document.
Confirms 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.
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Index Document
/v1/documents/{document_id}/indexSend a written document's saved text to DeepContext for search.
Called 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.
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Keep Document As Reference
/v1/documents/{document_id}/keep-as-referenceKeep an RFP-like document in the knowledge base on purpose. The 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.
Path parameters
document_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Failures return the error envelope; branch on error_code.
Preflight Documents
/v1/documents/preflightCheck whether files would be accepted, before any byte moves. Returns 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.
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
filesobject[]requiredworkspace_kindenumoptionaldataguideline
Failures return the error envelope; branch on error_code.
Upload Document
/v1/documents/uploadUpload a document; indexing runs in the background.
Poll processing_status for completion. Gated by the
document_upload operation (max_documents, max_storage_gb).
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 Document Text
/v1/documents/upload-textUpload a document as a raw markdown or plaintext JSON body.
Same document_upload gating (scope, limits) and atomic credit commit
as POST /upload. Only .md and .txt; binary formats need the
multipart route.
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
filenamestringrequiredcontentstringrequiredcategory_idsstring (uuid)[]optionalindex_on_leavebooleanoptional
Failures return the error envelope; branch on error_code.
Write Document
/v1/documents/writeStart a model writing a document, the same writing Arthur's start_document starts.
A 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.
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.