π« Documents API
Base URL:
https://api.dockflow.com/v3
Quick startβ
# 1. Fetch available document types
curl https://api.dockflow.com/v3/downstream/documents/types \
-H "Authorization: Bearer prod_acme-logistics_kJ8sV3nQ..."
# 2. Upload a document (replace the `<β¦>` values)
curl -X POST https://api.dockflow.com/v3/downstream/documents \
-H "Authorization: Bearer <APIβtoken>" \
-H "Content-Type: application/json" \
-d '{ ... see JSON example below ...}'
Endpointsβ
| Method | Path | Purpose |
|---|---|---|
| GET | /downstream/documents/types | List supported business document types (e.g. INV, POD, β¦). |
| POST | /downstream/documents | Upload a new document to a Tradeflow. |
| GET | /downstream/documents/{tradeflow_reference} | List every document already attached to a Tradeflow. |
| PATCH | /downstream/documents/{id} | Update the filename, business type or container link of a single document. |
| DELETE | /downstream/documents/{id} | Permanently remove a document. |
1 Β· List business document types GET /typesβ
Returns an array of objects:
[
{
"type": "INV",
"description": "Commercial invoice"
},
{
"type": "POD",
"description": "Proof of delivery"
}
]
2 Β· Create a document POST /downstream/documentsβ
Request bodyβ
| Field | Type | Required | Notes |
|---|---|---|---|
tradeflow_reference | string | βοΈ | Your own reference (PO / SO / BL / β¦). |
document_extension | string | βοΈ | An allowed extension (see "Validation rules"). |
document_payload_base64 | string(base64) | βοΈ | The raw file encoded with Baseβ64. |
document_filename | string | β | Friendly file name shown in Dockflow. |
document_type | string | β | Must match one of /types (INV, POD, β¦). |
container_reference | string | β | ISO 6346 container number to link to. |
Example request (Invoice PDF)
{
"tradeflow_reference": "PO4564268",
"document_extension": "pdf",
"document_filename": "Invoice 4564268",
"document_type": "INV",
"container_reference": "ABCD1234567",
"document_payload_base64": "JVBERi0xLjQgCjEgMCBvYmog..."
}
Successful response 202 Acceptedβ
{
"id": 123456789,
"tradeflow_reference": "PO4564268",
"document_type": "INV",
"filename": "Invoice 4564268.pdf",
"filetype": "pdf",
"container_reference": "ABCD1234567",
"created_at": "2025β05β05T14:22:07Z"
}
(The payload itself is not returned.)
3 Β· List Tradeflow documents GET /{tradeflow_reference}β
curl https://api.dockflow.com/v3/downstream/documents/PO4564268 \
-H "Authorization: Bearer <APIβtoken>"
Successful response 200 OKβ
{
"data": [
{
"id": 123456789,
"name": "2025-05-05t14_22_07_00_00_invoice_4564268_inv_tf_789_123456789_v1.pdf",
"filetype": "pdf",
"input_name": "Invoice 4564268",
"version": 0,
"document_type": {
"name": "INV",
"description": "Commercial invoice"
},
"metadata": null,
"created_at": "2025-05-05T14:22:07+00:00",
"updated_at": "2025-05-05T14:22:07+00:00"
}
],
"tradeflow_reference": "PO4564268",
"count": 1
}
| Field | Type | Description |
|---|---|---|
data | array | Array of document objects. |
id | integer | Unique document identifier. |
name | string | Generated filename (includes timestamp, type, ID). |
filetype | string | File extension (pdf, doc, etc.). |
input_name | string|null | Original filename provided during upload. |
version | integer | Document version (starts at 0). |
document_type | object|null | Document type with name and description. |
metadata | object|null | Custom metadata (JSON). |
created_at | string | ISO 8601 timestamp. |
updated_at | string | ISO 8601 timestamp. |
count | integer | Total number of documents returned. |
4 Β· Update a document PATCH /{id}β
Request body can contain any of:
{
"document_filename": "New name.pdf",
"document_type": "POD",
"container_reference": "EFGH7654321"
}
Returns 200 OK with the updated document, in the same shape as an item of the list in Β§3.
- An unknown
document_typeis ignored and the type is left unchanged. - An unknown
container_referenceunlinks the document from any container.
5 Β· Delete a document DELETE /{id}β
Irreversible.
curl -X DELETE https://api.dockflow.com/v3/downstream/documents/123456789
204 No Content on success.
Validation rulesβ
tradeflow_referenceanddocument_extensionare required.document_extensionmust be one ofpdf|doc|docx|xls|xlsx|jpg|jpeg|png|gif|bmp|tif|tiff|svg|webp(lower case).document_payload_base64is required and must be valid Baseβ64.tradeflow_referencehas to exist on your Dockflow entity.document_typeshould be one of the codes from the/typesendpoint. An unknown or missing value is not rejected; the document is stored without a business type.- An unknown
container_referenceis accepted and the document is stored without a container link.
The backend responds with 400 Bad Request and a message if any of the first four rules fails.
Common errorsβ
| Status | When it happens |
|---|---|
| 400 | Invalid JSON, missing required fields, bad Baseβ64, unsupported document_extension, or on POST a tradeflow_reference that does not exist on your entity; also Token format invalid. |
| 401 | Missing or malformed Authorization header, or unknown token. |
| 403 | Token environment does not match the host (prod_ vs uat_), or the token is revoked. |
| 404 | GET: tradeflow not found. PATCH / DELETE: document not found, or not on one of your tradeflows. |
| 500 | The document could not be created, updated or deleted. |