Download a document¶
When to use this¶
You need the PDF (and any sidecar files) for an existing document at the source portal — for example to archive a copy, attach it to an invoice, or to reproduce a signed copy that was originally generated elsewhere. The download happens in two steps:
- Enqueue a download work item (
AddWorkItemDownload) that tells the bot to fetch the file(s). - Once the work item finishes, call
GetResultto retrieve the binary content.
NVWA RVDM does not expose a download endpoint via the External API — only VLM MAD and Traces DOCOM do.
Prerequisites¶
- A valid JWT (see Authentication) issued for an API key with
Role.ApiKey. - The
documentReferenceof the document you want to download. - For VLM MAD: the
operatorCodethat owns the document.
Walkthrough¶
1a. VLM MAD — POST a download work item¶
POST /api/VlmMad/AddWorkItemDownload
curl -X POST "https://api.docmation.eu/api/VlmMad/AddWorkItemDownload" \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d @body.json
body.json:
{
"customerReference": "ORDER-2026-0001-download",
"documentReference": "MAD-BE-2026-000123456",
"webhookUrl": "https://example.com/docmation/webhook/{0}",
"operatorCode": "OP-001"
}
Response (HTTP 200 OK):
1b. Traces DOCOM — POST a download work item¶
POST /api/TracesDocom/AddWorkItemDownload
curl -X POST "https://api.docmation.eu/api/TracesDocom/AddWorkItemDownload" \
-H "Authorization: Bearer <jwt>" \
-H "Content-Type: application/json" \
-d @body.json
body.json:
{
"customerReference": "DOCOM-2026-0001-download",
"documentReference": "DOCOM-BE-2026-987654",
"webhookUrl": "https://example.com/docmation/webhook/{0}"
}
Response (HTTP 200 OK):
2. Fetch the binary once the work item is Finished¶
For VLM MAD:
curl "https://api.docmation.eu/api/VlmMad/GetResult?workItemId=67892" \
-H "Authorization: Bearer <jwt>"
For Traces DOCOM:
curl "https://api.docmation.eu/api/TracesDocom/GetResult?workItemId=78903" \
-H "Authorization: Bearer <jwt>"
Response (abbreviated — VLM MAD shown; Traces DOCOM has the same shape with TracesDocomDocumentData):
{
"workItemId": 67892,
"customerReference": "ORDER-2026-0001-download",
"documentReference": "MAD-BE-2026-000123456",
"documentId": "MAD-BE-2026-000123456",
"task": "Vlm_Mad_Download",
"status": "Finished",
"processingTime": 4321,
"documents": [
{
"id": 5544,
"documentData": "<base64-encoded PDF bytes>",
"properties": {
"name": "MAD-BE-2026-000123456.pdf",
"mimeType": "application/pdf"
}
}
],
"log": [
{ "date": "2026-06-04T08:00:00+02:00", "logLevel": "Information", "message": "Document fetched" }
]
}
Decode documents[].documentData (base64) to disk and use properties.name + properties.mimeType for the filename and content type.
What to watch for¶
404 Not FoundonGetResult— theworkItemIddoes not belong to your tenant (most common cause: you stored the id from a different environment) or it has been hard-deleted. Verify againstcustomerReferencefirst.- Empty
documentsarray — the work item finished but the portal returned no file. Inspect thelogarray; this is usually aFaultedoutcome that the bot recorded as a soft failure. - Large payloads — documents are returned inline as base64; for multi-megabyte attachments expect significant response sizes. Stream the response rather than buffering if your client is memory-constrained.
- Status not yet
Finished—documentswill benullor empty until the bot has actually fetched the file. Pollstatusfirst (see Poll work-item status) or wait for the webhook.
AI-drafted from
VlmMadController.csandTracesDocomController.cs. Verify field names against the live Swagger UI before publishing.