Skip to content

2 Get document

Retrieves a processed document by ID and returns its metadata plus a files array of downloadable resources, each file object includes purpose (e.g., document, image, attachment), file name, MIME type, and a pre-signed downloadUrl for direct download of the XML, PDFs, or attachments.

Note: GETs are tracked, if a document is retrieved more than 10 times without being completed (EXPORTED or ERROR), subsequent requests will return 409 Conflict.

  • Method: GET
  • Path: /v4/documents/export/{documentId}

Full URLs

  • Test: https://apitest.4exchange.app/v4/documents/export/{documentId}
  • Production: https://api.4exchange.app/v4/documents/export/{documentId}
  • documentId (string, required): One of the IDs returned by the list endpoint.

Example: GET /v4/documents/export/8e6e870e-854b-46ef-a4d5-dfe5a5799cf8

  • Authorization: Bearer token (requires 4Exchange/receive scope)

none

  • 200 OK
{
  "documentId": "8e6e870e-854b-46ef-a4d5-dfe5a5799cf8",
  "status": "READY", 
  "importDate": "2025-10-20T10:30:00Z",
  "timestamp": "2025-10-20T10:35:00Z",
  "documentType": "invoice",
  "channel": "peppol",
  "files": [
    {
      "purpose": "document",
      "fileName": "invoice_12345.xml", 
      "mimeType": "application/xml",
      "downloadUrl": "https://s3.amazonaws.com/bucket/presigned-url"
    },
    {
      "purpose": "image",
      "fileName": "invoice_12345.pdf",
      "mimeType": "application/pdf", 
      "downloadUrl": "https://s3.amazonaws.com/bucket/presigned-url"
    },
    {
      "purpose": "attachment",
      "fileName": "invoice_12345.png",
      "mimeType": "image/png",
      "downloadUrl": "https://s3.amazonaws.com/bucket/presigned-url"
    }
  ]
}
  • 401 Unauthorized
{
    "message": "Unauthorized"
}
  • 404 Not Found

Example: GET /v4/documents/export/8e6e870e-854b-46ef-a4d5-dfe5a5799c

{
    "Error": "Document not found"
}

Note: Documents are retained by default for 90 days. If a document is older than 90 days it may have been removed and the endpoint will return a 404 Not Found response.

  • 409 Conflict

Occurs when getCount >= 10 (i.e., the 11th retrieval attempt).

{
  "message": "Document retrieved more than 10 times without being completed (exported or failed)"
}
  • 400 Bad Request
{
    "message": "Document is not waiting to be exported"
}
Field Type Description
documentId string Unique identifier for the processed document
status string Processing status: READY, DELIVERED, or ERROR
importDate string ISO 8601 timestamp when document was first imported
timestamp string ISO 8601 timestamp when webhook was generated
documentType string Type of document: invoice, applicationresponse, ereport
channel string Source channel: email, peppol, api, pagero