Skip to content

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:

  1. Enqueue a download work item (AddWorkItemDownload) that tells the bot to fetch the file(s).
  2. Once the work item finishes, call GetResult to 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 documentReference of the document you want to download.
  • For VLM MAD: the operatorCode that 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):

{
  "workBatchId": 12345,
  "workItemId": 67892
}

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):

{
  "workBatchId": 23456,
  "workItemId": 78903
}

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 Found on GetResult — the workItemId does not belong to your tenant (most common cause: you stored the id from a different environment) or it has been hard-deleted. Verify against customerReference first.
  • Empty documents array — the work item finished but the portal returned no file. Inspect the log array; this is usually a Faulted outcome 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 — documents will be null or empty until the bot has actually fetched the file. Poll status first (see Poll work-item status) or wait for the webhook.

AI-drafted from VlmMadController.cs and TracesDocomController.cs. Verify field names against the live Swagger UI before publishing.