curl --request POST --fail-with-body --max-time 30 \
"${AMLOK_API_BASE_URL}/v1/documents" \
--header "Authorization: Bearer ${AMLOK_API_KEY}" \
--header 'Accept: application/json' \
--header 'Idempotency-Key: uploadDocument-synthetic-0042' \
--form file=@/path/to/financial-statement.pdf \
--form context=borrower \
--form borrower_id=bor_synthetic \
--form document_type=financial_statementimport os
import requests
headers = {'Accept': 'application/json', 'Idempotency-Key': 'uploadDocument-synthetic-0042'}
headers["Authorization"] = "Bearer " + os.environ["AMLOK_API_KEY"]
with open("/path/to/financial-statement.pdf", "rb") as upload:
response = requests.request('POST', os.environ["AMLOK_API_BASE_URL"] + '/v1/documents', headers=headers, data={'context': 'borrower', 'borrower_id': 'bor_synthetic', 'document_type': 'financial_statement'}, files={"file": upload}, timeout=30, allow_redirects=False)
response.raise_for_status()
print(response.json())
import { readFile } from "node:fs/promises";
const headers = {"Accept": "application/json", "Idempotency-Key": "uploadDocument-synthetic-0042"};
headers.Authorization = `Bearer ${process.env.AMLOK_API_KEY}`;
const form = new FormData();
form.append("file", new Blob([await readFile("/path/to/financial-statement.pdf")]), "financial-statement.pdf");
form.append("context", "borrower");
form.append("borrower_id", "bor_synthetic");
form.append("document_type", "financial_statement");
const response = await fetch(process.env.AMLOK_API_BASE_URL + "/v1/documents", {
method: "POST", headers, redirect: "error", signal: AbortSignal.timeout(30000),
body: form
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.json());
{
"data": {
"id": "doc_synthetic",
"context": "borrower",
"borrower_id": "bor_synthetic",
"file_name": "financial-statement.pdf",
"mime_type": "application/pdf",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"size_bytes": 12500,
"status": "processing",
"restriction_reason": null,
"created_at": "2026-11-06T12:00:00Z",
"document_type": "financial_statement",
"origination_id": null,
"requirement_id": null,
"origin": "institution_upload",
"record_version": 1,
"failure": null
},
"meta": {
"request_id": "req_synthetic",
"schema_version": "1.0.0",
"environment": "sandbox"
}
}{
"error": {
"code": "validation_error",
"message": "Validation error.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "unauthenticated",
"message": "Unauthenticated.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "insufficient_credits",
"message": "Insufficient credits.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "forbidden",
"message": "Forbidden.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "not_found",
"message": "Not found.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "idempotency_conflict",
"message": "Idempotency conflict.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "cursor_expired",
"message": "Cursor expired.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "payload_too_large",
"message": "payload too large",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "unsupported_media_type",
"message": "unsupported media type",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "validation_error",
"message": "Validation error.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limited.",
"retryable": true,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "temporarily_unavailable",
"message": "Temporarily unavailable.",
"retryable": true,
"request_id": "req_synthetic",
"field": null
}
}Upload document
Upload borrower evidence or documents supporting a lending product or risk policy. Upload creates a new record; it cannot overwrite an existing document.
curl --request POST --fail-with-body --max-time 30 \
"${AMLOK_API_BASE_URL}/v1/documents" \
--header "Authorization: Bearer ${AMLOK_API_KEY}" \
--header 'Accept: application/json' \
--header 'Idempotency-Key: uploadDocument-synthetic-0042' \
--form file=@/path/to/financial-statement.pdf \
--form context=borrower \
--form borrower_id=bor_synthetic \
--form document_type=financial_statementimport os
import requests
headers = {'Accept': 'application/json', 'Idempotency-Key': 'uploadDocument-synthetic-0042'}
headers["Authorization"] = "Bearer " + os.environ["AMLOK_API_KEY"]
with open("/path/to/financial-statement.pdf", "rb") as upload:
response = requests.request('POST', os.environ["AMLOK_API_BASE_URL"] + '/v1/documents', headers=headers, data={'context': 'borrower', 'borrower_id': 'bor_synthetic', 'document_type': 'financial_statement'}, files={"file": upload}, timeout=30, allow_redirects=False)
response.raise_for_status()
print(response.json())
import { readFile } from "node:fs/promises";
const headers = {"Accept": "application/json", "Idempotency-Key": "uploadDocument-synthetic-0042"};
headers.Authorization = `Bearer ${process.env.AMLOK_API_KEY}`;
const form = new FormData();
form.append("file", new Blob([await readFile("/path/to/financial-statement.pdf")]), "financial-statement.pdf");
form.append("context", "borrower");
form.append("borrower_id", "bor_synthetic");
form.append("document_type", "financial_statement");
const response = await fetch(process.env.AMLOK_API_BASE_URL + "/v1/documents", {
method: "POST", headers, redirect: "error", signal: AbortSignal.timeout(30000),
body: form
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
console.log(await response.json());
{
"data": {
"id": "doc_synthetic",
"context": "borrower",
"borrower_id": "bor_synthetic",
"file_name": "financial-statement.pdf",
"mime_type": "application/pdf",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"size_bytes": 12500,
"status": "processing",
"restriction_reason": null,
"created_at": "2026-11-06T12:00:00Z",
"document_type": "financial_statement",
"origination_id": null,
"requirement_id": null,
"origin": "institution_upload",
"record_version": 1,
"failure": null
},
"meta": {
"request_id": "req_synthetic",
"schema_version": "1.0.0",
"environment": "sandbox"
}
}{
"error": {
"code": "validation_error",
"message": "Validation error.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "unauthenticated",
"message": "Unauthenticated.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "insufficient_credits",
"message": "Insufficient credits.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "forbidden",
"message": "Forbidden.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "not_found",
"message": "Not found.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "idempotency_conflict",
"message": "Idempotency conflict.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "cursor_expired",
"message": "Cursor expired.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "payload_too_large",
"message": "payload too large",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "unsupported_media_type",
"message": "unsupported media type",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "validation_error",
"message": "Validation error.",
"retryable": false,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limited.",
"retryable": true,
"request_id": "req_synthetic",
"field": null
}
}{
"error": {
"code": "temporarily_unavailable",
"message": "Temporarily unavailable.",
"retryable": true,
"request_id": "req_synthetic",
"field": null
}
}Authorizations
Server-to-server API key bound to exactly one workspace, institution tenant and environment. No caller-supplied workspace override is accepted. Do not use in public browser code.
Headers
Stable for one intended command and its retries, scoped to key workspace/environment and operation. Mismatched body returns 409. Full response replay 24 hours; durable receipt remains.
1Body
Upload once, then reference document ID in the origination. A later upload may include origination_id and an open requirement_id: borrower and requirement ownership are checked and association occurs atomically. Late attachment is accepted only while collecting/requires_action, otherwise 409. Never overwrite a file or change a completed assessment.
File for UploadDocument. Constraints, requiredness and allowed values are defined by this schema.
Context for UploadDocument. Constraints, requiredness and allowed values are defined by this schema.
borrower, lending_product, risk_policy Document type for UploadDocument. Constraints, requiredness and allowed values are defined by this schema.
1Opaque identifier, authorized within the API key workspace and environment.
1Opaque identifier, authorized within the API key workspace and environment.
1Opaque identifier, authorized within the API key workspace and environment.
1