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",
  "senderIdentifier": "0106:09135999",
  "receiverIdentifier": "0106:34236560",
  "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"
    }
  ]
}
  • 200 OK
{
  "documentId": "f1a2b3c4-5678-90ab-cdef-1234567890ab",
  "status": "READY",
  "importDate": "2025-10-20T11:00:00Z",
  "timestamp": "2025-10-20T11:05:00Z",
  "documentType": "applicationresponse",
  "channel": "peppol",
  "senderIdentifier": "0106:09135999",
  "receiverIdentifier": "0106:34236560",
  "applicationResponse": {
    "referenceDocumentNumber": "INV-2025-12345",
    "referenceDocumentId": "8e6e870e-854b-46ef-a4d5-dfe5a5799cf8",
    "responseCode": "RE",
    "responseMessage": "Rejected due to invalid VAT number"
  },
  "files": [
    {
      "purpose": "document",
      "fileName": "appresponse_123.xml",
      "mimeType": "application/xml",
      "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
senderIdentifier string Identifier of the message sender (typically a Peppol participant code like 0106:12345678).
receiverIdentifier string Identifier of the message receiver (typically a Peppol participant code like 0106:87654321).
Field Type Description
applicationResponse.referenceDocumentNumber string The referenced document number (e.g., invoice number).
applicationResponse.referenceDocumentId string The unique identifier of the document this application response refers to, if sent via 4CEE Exchange.
applicationResponse.responseCode string Short response code: AP = Accepted, RE = Rejected, etc.
applicationResponse.responseMessage string Human-readable response message or reason for rejection.
Field Type Description
purpose string File purpose: document, image, attachment, response
fileName string Original filename
mimeType string MIME type of the file
downloadUrl string Pre-signed URL for file download (expires in 10 minutes). No authentication required.
messageType string (Optional) Message type for response files: MDN, VALIDATION
  • document: Main processed document (e.g., invoice XML)
  • image: Image representation of the document
  • attachment: Additional files (e.g., original XML, receipts)
  • response: System-generated response files (validation reports, delivery notifications)