REST API for the Document Management domain — the central store for uploaded files and their metadata across all safety net programs.

Upload model: A document and its first version are created atomically via POST /documents (multipart/form-data). Subsequent versions are uploaded via POST /documents/{documentId}/document-versions. File content is delivered via GET /document-versions/{documentVersionId}/content (proxy by default; states may overlay to redirect).

Context passthrough: Callers attach correlation context to a document via metadata at creation or via PUT /documents/{documentId}/metadata/{domain} after the fact. Metadata is echoed in events so downstream consumers can correlate without additional lookups. Keys are structured as nested objects per domain namespace — { "intake": { "verificationId": "..." } }.

Document types: Baseline types are seeded from document-management-config.yaml. States add program-specific types at runtime via POST /document-types.

Status: Alpha — Breaking changes expected.
Base URL: https://api.example.com/document-management

Documents

Document records and file upload.

GET /documents List documents

Retrieve a paginated list of documents. Filter by document type or subject via document links.

Parameters
Name Type In Req Description
q string query Search query using field:value syntax. Multiple conditions separated by
limit integer query

Maximum number of items to return (1-100).

offset integer query

Number of items to skip before collecting results.

sort string query Comma-separated list of fields to sort the response by. Prefix a field
documentTypeId string query

Filter by document type.

lifecycleState DocumentLifecycleState query

Filter by lifecycle state.

Responses
200 A paginated list of documents.
DocumentList
items array[Document] required
id string (uuid) required
documentTypeId string (uuid) required Links to the DocumentType governing retention rules for this document.
title string required Human-readable label (e.g. "Jane Smith — Pay Stub March 2026"). Distinct from the upload filename.
documentDate string (date) The date on the document's face (e.g. a pay stub date). Required when the document type's retentionTrigger is document_date.
lifecycleState DocumentLifecycleState required Where the document is in its records management lifecycle.
No additional fields
legalHold boolean required When true, the document cannot advance to pending_disposition regardless of retention schedule.
latestVersionId string (uuid) required ID of the most recent DocumentVersion. Single authoritative pointer to the current file.
retentionDeadline string (date) The date when the retention period ends. Null until the document enters retained state.
metadata object Opaque correlation context structured as nested objects per domain namespace. Example: {"intake":{"verificationId":"ver-abc-123"},"workflow":{"taskId":"tsk-xyz-456"}}
dispositionApprovedBy string Identity of the records manager who authorized destruction. Null until destroyed state.
dispositionApprovedAt string (date-time) When destruction was authorized. Null until destroyed state.
createdAt string (date-time) required
updatedAt string (date-time) required
total integer required
limit integer required
offset integer required
hasNext boolean required
400 The request is malformed or contains invalid parameters.
BadRequest
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
POST /documents Upload a document

Create a document and its first version atomically. The document is immediately active. Accepts multipart/form-data with the file bytes and document metadata in a single request.

If the adapter's virus scanner rejects the file, returns 422 with error code file_rejected_by_virus_scan and no document is created.

Pass metadata as a JSON string in the multipart body to attach correlation context at creation time (e.g. { "intake": { "verificationId": "ver-abc" } }).

Request body required
file string (binary) required The file to upload.
documentTypeId string (uuid) required Document type — determines retention rules and classification.
title string required Human-readable label for the document (e.g. "John Smith — Pay Stub March 2026"). Distinct from the upload filename.
documentDate string (date) The date printed on or associated with the document (e.g. the date on a pay stub). Required when the document type's retentionTrigger is document_date.
metadata string JSON string. Correlation context structured as nested objects per domain namespace. Example: {"intake":{"verificationId":"ver-abc-123"}}
Responses
201 Document and first version created successfully.
Document
id string (uuid) required
documentTypeId string (uuid) required Links to the DocumentType governing retention rules for this document.
title string required Human-readable label (e.g. "Jane Smith — Pay Stub March 2026"). Distinct from the upload filename.
documentDate string (date) The date on the document's face (e.g. a pay stub date). Required when the document type's retentionTrigger is document_date.
lifecycleState DocumentLifecycleState required Where the document is in its records management lifecycle.
No additional fields
legalHold boolean required When true, the document cannot advance to pending_disposition regardless of retention schedule.
latestVersionId string (uuid) required ID of the most recent DocumentVersion. Single authoritative pointer to the current file.
retentionDeadline string (date) The date when the retention period ends. Null until the document enters retained state.
metadata object Opaque correlation context structured as nested objects per domain namespace. Example: {"intake":{"verificationId":"ver-abc-123"},"workflow":{"taskId":"tsk-xyz-456"}}
dispositionApprovedBy string Identity of the records manager who authorized destruction. Null until destroyed state.
dispositionApprovedAt string (date-time) When destruction was authorized. Null until destroyed state.
createdAt string (date-time) required
updatedAt string (date-time) required
400 The request is malformed or contains invalid parameters.
BadRequest
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
422 The request was well-formed but contained semantic errors.
UnprocessableEntity
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
GET /documents/{documentId} Get a document

Retrieve a single document by identifier. Documents in destroyed state are returned with their metadata intact but file content is no longer accessible.

Parameters
Name Type In Req Description
documentId string path

Unique identifier of the document.

Responses
200 Document retrieved successfully.
Document
id string (uuid) required
documentTypeId string (uuid) required Links to the DocumentType governing retention rules for this document.
title string required Human-readable label (e.g. "Jane Smith — Pay Stub March 2026"). Distinct from the upload filename.
documentDate string (date) The date on the document's face (e.g. a pay stub date). Required when the document type's retentionTrigger is document_date.
lifecycleState DocumentLifecycleState required Where the document is in its records management lifecycle.
No additional fields
legalHold boolean required When true, the document cannot advance to pending_disposition regardless of retention schedule.
latestVersionId string (uuid) required ID of the most recent DocumentVersion. Single authoritative pointer to the current file.
retentionDeadline string (date) The date when the retention period ends. Null until the document enters retained state.
metadata object Opaque correlation context structured as nested objects per domain namespace. Example: {"intake":{"verificationId":"ver-abc-123"},"workflow":{"taskId":"tsk-xyz-456"}}
dispositionApprovedBy string Identity of the records manager who authorized destruction. Null until destroyed state.
dispositionApprovedAt string (date-time) When destruction was authorized. Null until destroyed state.
createdAt string (date-time) required
updatedAt string (date-time) required
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
PATCH /documents/{documentId} Update a document

Update mutable document fields. Metadata is not patchable here — use the namespace-level metadata endpoints instead.

Parameters
Name Type In Req Description
documentId string path

Unique identifier of the document.

Request body required
DocumentUpdate
title string
documentDate string (date)
Responses
200 Document updated successfully.
Document
id string (uuid) required
documentTypeId string (uuid) required Links to the DocumentType governing retention rules for this document.
title string required Human-readable label (e.g. "Jane Smith — Pay Stub March 2026"). Distinct from the upload filename.
documentDate string (date) The date on the document's face (e.g. a pay stub date). Required when the document type's retentionTrigger is document_date.
lifecycleState DocumentLifecycleState required Where the document is in its records management lifecycle.
No additional fields
legalHold boolean required When true, the document cannot advance to pending_disposition regardless of retention schedule.
latestVersionId string (uuid) required ID of the most recent DocumentVersion. Single authoritative pointer to the current file.
retentionDeadline string (date) The date when the retention period ends. Null until the document enters retained state.
metadata object Opaque correlation context structured as nested objects per domain namespace. Example: {"intake":{"verificationId":"ver-abc-123"},"workflow":{"taskId":"tsk-xyz-456"}}
dispositionApprovedBy string Identity of the records manager who authorized destruction. Null until destroyed state.
dispositionApprovedAt string (date-time) When destruction was authorized. Null until destroyed state.
createdAt string (date-time) required
updatedAt string (date-time) required
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
422 The request was well-formed but contained semantic errors.
UnprocessableEntity
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
PUT /documents/{documentId}/metadata/{domain} Set domain metadata on a document

Replace the calling domain's entire metadata namespace on a document. Other domains' namespaces are unaffected. Used for context passthrough when metadata is not known at upload time.

Parameters
Name Type In Req Description
documentId string path

Unique identifier of the document.

domain string path

The calling domain's namespace to set or remove.

enumclient-management data-exchange document-management eligibility intake workflow
Request body required
object
Responses
200 Metadata set successfully. Returns the updated document.
Document
id string (uuid) required
documentTypeId string (uuid) required Links to the DocumentType governing retention rules for this document.
title string required Human-readable label (e.g. "Jane Smith — Pay Stub March 2026"). Distinct from the upload filename.
documentDate string (date) The date on the document's face (e.g. a pay stub date). Required when the document type's retentionTrigger is document_date.
lifecycleState DocumentLifecycleState required Where the document is in its records management lifecycle.
No additional fields
legalHold boolean required When true, the document cannot advance to pending_disposition regardless of retention schedule.
latestVersionId string (uuid) required ID of the most recent DocumentVersion. Single authoritative pointer to the current file.
retentionDeadline string (date) The date when the retention period ends. Null until the document enters retained state.
metadata object Opaque correlation context structured as nested objects per domain namespace. Example: {"intake":{"verificationId":"ver-abc-123"},"workflow":{"taskId":"tsk-xyz-456"}}
dispositionApprovedBy string Identity of the records manager who authorized destruction. Null until destroyed state.
dispositionApprovedAt string (date-time) When destruction was authorized. Null until destroyed state.
createdAt string (date-time) required
updatedAt string (date-time) required
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
422 The request was well-formed but contained semantic errors.
UnprocessableEntity
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
DELETE /documents/{documentId}/metadata/{domain} Remove domain metadata from a document

Remove the calling domain's entire metadata namespace from a document.

Parameters
Name Type In Req Description
documentId string path

Unique identifier of the document.

domain string path

The calling domain's namespace to set or remove.

enumclient-management data-exchange document-management eligibility intake workflow
Responses
204 Metadata removed successfully.
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.

DocumentVersions

Immutable version history for documents.

POST /documents/{documentId}/document-versions Upload a new version

Upload a subsequent version of an existing document. Creates an immutable DocumentVersion record and updates Document.latestVersionId. Each upload preserves prior versions so the file that was current at any point in time is recoverable (required by 7 CFR § 272.1 and 45 CFR § 164.312).

If the adapter's virus scanner rejects the file, returns 422 with error code file_rejected_by_virus_scan and no version is created.

Parameters
Name Type In Req Description
documentId string path

Unique identifier of the document.

Request body required
file string (binary) required The replacement file to upload.
Responses
201 Version created successfully.
DocumentVersion
id string (uuid) required
documentId string (uuid) required Links to the parent Document.
versionNumber integer required Sequential version number. 1 for the first version.
fileName string required Original filename as uploaded.
mimeType string required MIME type of the uploaded file.
sizeBytes integer required File size in bytes.
contentHash string required SHA-256 hash of the file bytes. Stored for duplicate detection; baseline enforces nothing.
uploadedById string required Identity of the uploader. Required for HIPAA chain-of-custody (45 CFR § 164.312).
createdAt string (date-time) required Authoritative upload timestamp.
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
422 The request was well-formed but contained semantic errors.
UnprocessableEntity
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
GET /document-versions/{documentVersionId} Get a document version

Retrieve metadata for a specific document version. Does not return file bytes — use the content endpoint for that.

Parameters
Name Type In Req Description
documentVersionId string path

Unique identifier of the document version.

Responses
200 Document version retrieved successfully.
DocumentVersion
id string (uuid) required
documentId string (uuid) required Links to the parent Document.
versionNumber integer required Sequential version number. 1 for the first version.
fileName string required Original filename as uploaded.
mimeType string required MIME type of the uploaded file.
sizeBytes integer required File size in bytes.
contentHash string required SHA-256 hash of the file bytes. Stored for duplicate detection; baseline enforces nothing.
uploadedById string required Identity of the uploader. Required for HIPAA chain-of-custody (45 CFR § 164.312).
createdAt string (date-time) required Authoritative upload timestamp.
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
GET /document-versions/{documentVersionId}/content Get file content

Retrieve the file bytes for a document version. Emits a document_version.accessed audit event on every call (required by HIPAA 45 CFR § 164.312).

The baseline response is 200 with the file streamed as application/octet-stream (proxy delivery). States that prefer redirect delivery add x-content-delivery: redirect via overlay — the response then returns 302 to a time-limited signed storage URL. Both response shapes are documented here so clients handle either.

Parameters
Name Type In Req Description
documentVersionId string path

Unique identifier of the document version.

Responses
200 File content (proxy delivery).
string
302 Redirect to signed storage URL (redirect delivery — opt-in via overlay).
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
410 File content is no longer accessible — document has been destroyed.
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.

DocumentTypes

Document type catalog — retention rules and classification.

GET /document-types List document types

Retrieve the catalog of document types. Includes both config-seeded (system) and runtime-created (user) types.

Parameters
Name Type In Req Description
q string query Search query using field:value syntax. Multiple conditions separated by
limit integer query

Maximum number of items to return (1-100).

offset integer query

Number of items to skip before collecting results.

sort string query Comma-separated list of fields to sort the response by. Prefix a field
Responses
200 A paginated list of document types.
DocumentTypeList
items array[DocumentType] required
id string (uuid) required
name string required
retentionYears integer required How many years documents of this type must be retained after the retention trigger fires.
retentionTrigger RetentionTrigger required The event that starts the retention clock for this document type.
No additional fields
source string required read-only "system" types are seeded from config and cannot be deleted. "user" types are created at runtime and can be deleted.
enumsystem user
createdAt string (date-time) required
updatedAt string (date-time) required
total integer required
limit integer required
offset integer required
hasNext boolean required
400 The request is malformed or contains invalid parameters.
BadRequest
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
POST /document-types Create a document type

Create a state-defined document type. Runtime-created types are marked source: user and can be deleted via the API. Config-seeded types cannot be deleted.

Request body required
DocumentTypeCreate
name string required
retentionYears integer required
retentionTrigger RetentionTrigger required The event that starts the retention clock for this document type.
No additional fields
Responses
201 Document type created successfully.
DocumentType
id string (uuid) required
name string required
retentionYears integer required How many years documents of this type must be retained after the retention trigger fires.
retentionTrigger RetentionTrigger required The event that starts the retention clock for this document type.
No additional fields
source string required read-only "system" types are seeded from config and cannot be deleted. "user" types are created at runtime and can be deleted.
enumsystem user
createdAt string (date-time) required
updatedAt string (date-time) required
422 The request was well-formed but contained semantic errors.
UnprocessableEntity
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
GET /document-types/{documentTypeId} Get a document type

Retrieve a single document type by identifier.

Parameters
Name Type In Req Description
documentTypeId string path

Unique identifier of the document type.

Responses
200 Document type retrieved successfully.
DocumentType
id string (uuid) required
name string required
retentionYears integer required How many years documents of this type must be retained after the retention trigger fires.
retentionTrigger RetentionTrigger required The event that starts the retention clock for this document type.
No additional fields
source string required read-only "system" types are seeded from config and cannot be deleted. "user" types are created at runtime and can be deleted.
enumsystem user
createdAt string (date-time) required
updatedAt string (date-time) required
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
DELETE /document-types/{documentTypeId} Delete a document type

Delete a user-created document type. Returns 409 if the type is config-seeded (source: system) or if documents of this type exist.

Parameters
Name Type In Req Description
documentTypeId string path

Unique identifier of the document type.

Responses
204 Document type deleted successfully.
404 The requested resource was not found.
NotFound
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
409 A conflict occurred with the current state of the resource.
Conflict
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.
500 An unexpected error occurred on the server.
InternalError
code string required Machine-readable error code.
message string required Human-readable error description.
details array[object] Additional error details.