Documentation menu

API reference

18 operations in documents. Raw spec: openapi.json.

GET/api/v1/documents

GET /api/documents

Parameters

NameInTypeRequiredDescription
qquery—NoTitle substring narrowing; ranked full-text search rides /api/search.
client_idquery—NoScope narrow: a client uuid, or the literal `global` for org-wide documents (docs-platform v1). Absent = all scopes.
layout_idquery—No

Responses

StatusDescription
200

Security: bearer

POST/api/v1/documents

POST /api/documents — instant-first (IF1/IF2); creates the document and its immutable version 1 in one commit.

Request body

CreateDocumentRequest

Responses

StatusDescription
200
409idempotency key reused
422title/body rejected by document rules

Security: bearer

GET/api/v1/documents/layouts

GET /api/documents/layouts — the org's layout catalog (system first).

Responses

StatusDescription
200

Security: bearer

POST/api/v1/documents/layouts

POST /api/documents/layouts — instant-first; system slugs are reserved.

Request body

CreateLayoutRequest

Responses

StatusDescription
200
409idempotency key reused or slug taken
422invalid field schema

Security: bearer

PATCH/api/v1/documents/layouts/{id}

PATCH /api/documents/layouts/{id} — instant-first; system layouts are editable (schema and branding), never deletable.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

UpdateLayoutRequest

Responses

StatusDescription
200
404layout not visible in scope

Security: bearer

DELETE/api/v1/documents/layouts/{id}

DELETE /api/documents/layouts/{id} — custom layouts only; system layouts are a typed 409 (imports and the DMS seam rely on them).

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200deleted
404layout not visible in scope
409system layouts cannot be deleted

Security: bearer

GET/api/v1/documents/{id}

GET /api/documents/{id}

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200
404document not visible in scope

Security: bearer

PATCH/api/v1/documents/{id}

PATCH /api/documents/{id} — instant-first (IF1/IF2); an edit APPENDS the next immutable version and moves the document's head to it. No existing version row is touched.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

UpdateDocumentRequest

Responses

StatusDescription
200
404document not visible in scope
409version conflict or idempotency key reused
422title/body rejected by document rules

Security: bearer

GET/api/v1/documents/{id}/attachments

GET /api/documents/{id}/attachments — newest-first list for one doc.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200

Security: bearer

POST/api/v1/documents/{id}/attachments

POST /api/documents/{id}/attachments — raw octet-stream upload (same header contract as the ticket surface: `x-filename` + declared content-type verified against sniffed magic bytes).

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

array<integer>

Responses

StatusDescription
200
404document not visible in scope
422validation failed

Security: bearer

DELETE/api/v1/documents/{id}/attachments/{attachment_id}

DELETE /api/documents/{id}/attachments/{attachment_id} — author-gated (the uploader, or an org owner/admin). The stored object is reclaimed only when NO row in EITHER attachments table still references the same content-addressed key.

Parameters

NameInTypeRequiredDescription
idpathstringYes
attachment_idpathstringYes

Responses

StatusDescription
200
404attachment not visible in scope

Security: bearer

GET/api/v1/documents/{id}/attachments/{attachment_id}/download

GET /api/documents/{id}/attachments/{attachment_id}/download — streams the stored object behind documents authz, or answers with a presigned URL when the caller asks for one (`?presign=true`) and the store can sign it.

Same rule as the ticket attachment door: the stream is the contract and the ticket is the optimisation, and no URL is minted for an object whose scan verdict has not been read and admitted.

Parameters

NameInTypeRequiredDescription
idpathstringYes
attachment_idpathstringYes
presignquerybooleanNo`true` asks for a download ticket instead of the bytes; the answer says whether a URL was minted

Responses

StatusDescription
200
409the object is held by the scan gate: neither a URL nor the bytes are issued

Security: bearer

POST/api/v1/documents/{id}/restore

POST /api/documents/{id}/restore — instant-first (IF1/IF2); §6 rule: the restore APPENDS a new version copying the target's content. The target's title comes along, renames after it are not silently undone.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

RestoreDocumentRequest

Responses

StatusDescription
200
404document or restore target not visible in scope
409version conflict or idempotency key reused
422restore rejected by document rules

Security: bearer

GET/api/v1/documents/{id}/versions

GET /api/documents/{id}/versions — the full immutable history, newest first, complete bodies included so any pair is diffable.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200
404document not visible in scope

Security: bearer

GET/api/v1/documents/{id}/versions/{version}

GET /api/documents/{id}/versions/{version} — one immutable snapshot.

Parameters

NameInTypeRequiredDescription
idpathstringYes
versionpathintegerYes

Responses

StatusDescription
200
404document or version not visible in scope

Security: bearer