← Back to Library

Document-Store API

api ·  integrators

Document-Store API

What it is. The document-store owns the lifecycle of documents — records that conform to a template and live in a namespace. It computes and enforces the template's identity hash on write (natural-upsert: writing the same identity again versions the document in place rather than erroring or duplicating), validates document data against the template's fields, and tracks version history per document. Beyond plain CRUD it also owns: file attachments (first-class entities with their own orphan/active/inactive lifecycle), relationship documents and BFS traversal between them (with an optional peer projection to avoid an N+1 fetch), a per-template table view for flattened/tabular consumption (JSON or CSV), template-version migration (re-pinning a cohort of documents from one template version to another without changing their identity), CSV/XLSX bulk import, replay sessions (republishing stored documents as events), and namespace backup job/restore job export/import.

Reaching it. Base path /api/document-store, mounted by the service's own APIRouter(prefix="/api/document-store") (components/document-store/src/document_store/api/__init__.py). See also: Routing & Ingress. Every route requires an API key — X-API-Key header, the ApiKeyAuth security scheme declared in schemas/document-store.json — enforced via require_api_key; most routes additionally call check_namespace_permission(identity, namespace, "read"|"write"|"admin") scoped to the namespace(s) the request resolves to. See also: Auth & Access.

Conventions that apply.

See also: API Conventions; PoNIFs.

Endpoints

Examples below use $API for the mounted base URL (.../api/document-store) and $KEY for a valid X-API-Key value. Grouped by router (Documents, Validation, Table View, Files, Import, Replay, Backup, Health) in registration order (components/document-store/src/document_store/api/__init__.py); endpoints within each group are in source-file order.

Documents

POST /documents

PATCH /documents

POST /documents/migrate

GET /documents

GET /documents/{document_id}

GET /documents/{document_id}/versions

GET /documents/{document_id}/versions/{version}

GET /documents/{document_id}/latest

GET /documents/{document_id}/relationships

GET /documents/{document_id}/traverse

DELETE /documents

POST /documents/archive

POST /documents/query

GET /documents/by-identity/{identity_hash}

Validation

POST /validation/validate

POST /validation/validate-bulk

Table View

GET /table/{template_id}

GET /table/{template_id}/csv

Files

POST /files

GET /files

GET /files/{file_id}

GET /files/{file_id}/download

GET /files/{file_id}/content

PATCH /files

DELETE /files

GET /files/{file_id}/documents

DELETE /files/{file_id}/hard

GET /files/orphans/list

GET /files/by-checksum/{checksum}

GET /files/health/integrity

Import

POST /import/preview

POST /import

Replay

POST /replay/start

GET /replay/{session_id}

POST /replay/{session_id}/pause

POST /replay/{session_id}/resume

DELETE /replay/{session_id}

Backup

POST /backup/namespaces/{namespace}/backup

POST /backup/namespaces/{namespace}/restore

GET /backup/jobs/{job_id}

GET /backup/jobs

GET /backup/jobs/{job_id}/events

GET /backup/jobs/{job_id}/download

DELETE /backup/jobs/{job_id}

Health

GET /health

Store-specific gotchas

See also

Generated from real source code, not hand-written — see the WIP Technical Library.