Skip to content

Upload XML

Uploads a document using raw XML in the request body. Please embed the image as a Base64-encoded element in the XML, or allow 4CEE Exchange to generate an image automatically based on the content of the XML.

  • Method: POST
  • Path: /v3/documents/{documentType}/{direction}/xml

Full URLs

  • Test: https://apitest.4exchange.app/v3/documents/{documentType}/{direction}/xml
  • Production: https://api.4exchange.app/v3/documents/{documentType}/{direction}/xml

Request size limit

The maximum request size is 6 MB (after Base64 encoding and headers). Requests over this limit are rejected with 413 - Request Entity Too Large response.

Encoding requirement

Please ensure that the XML document is UTF-8 encoded for correct handling.

  • documentType (string, required): Type of document, allowed values are: invoice, applicationresponse, ereport
  • direction (string, required): Direction of document, allowed values are: send or receive

Example: POST /v3/documents/invoice/send/xml

  • Authorization: Bearer token (requires 4Exchange/send scope)
  • Content-Type: application/xml
  • documentId (string, optional): Client-provided identifier for tracking. Any non-empty string; does not need to be a UUID. If omitted, the system generates one.
<?xml version="1.0" encoding="utf-8"?>
<Invoice>
    <cbc:ID>123</cbc:ID>
    <cbc:IssueDate>2025-02-28</cbc:IssueDate>
    .......
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="EUR">100.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="EUR">100.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="EUR">121.00</cbc:TaxInclusiveAmount>
        <cbc:PayableAmount currencyID="EUR">121.00</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
</Invoice>
  • 200 OK
{
    "message": "Successfully received the document",
    "documentId": "8e6e870e-854b-46ef-a4d5-dfe5a5799cf8"
}
  • 401 Unauthorized
{
    "message": "Unauthorized"
}
  • 400 Bas request
{
    "Error": "body is invalid"
}
  • 413 Request Entity Too Large
{
    "message": "Request Too Long"
}