Skip to content

Validate XML

This endpoint allows customers to validate their XML documents before submitting them via Peppol. It ensures that the document meets the required schema and business rules, helping to prevent errors during transmission. No data is stored during validation, and the service returns detailed feedback on any validation issues encountered.

  • Method: POST
  • Path: /v3/documents/validate

Full URLs

  • Test: https://apitest.4exchange.app/v3/documents/validate
  • Production: https://api.4exchange.app/v3/documents/validate

Request size limit

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

  • Authorization: Bearer token (requires 4Exchange/send scope)
  • Content-Type: application/xml
<?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
{
    "transactionId": "dda3af05-ea32-40b2-ba50-zf0210311c9",
    "validationResult": "valid",
    "validationResults": {
        "xmlSyntax": {
            "valid": true,
            "messages": "No Errors found"
        },
        "xsdValidation": {
            "valid": true,
            "xsdFile": "/UBL21/maindoc/….xsd",
            "messages": [],
            "result": "No Errors found"
        },
        "schematronValidation": [
            {
                "xslFile": "/eu.peppol.bis3/….xslt",
                "warnings": 0,
                "errors": 0,
                "messages": [],
                "valid": true
            },
            {
                "xslFile": "/eu.peppol.bis3/….xslt",
                "warnings": 0,
                "errors": 0,
                "messages": [],
                "valid": true
            }
        ]
    }
}
  • 422 Unprocessable Entity
{
    "transactionId": null,
    "validationResult": "invalid",
    "validationResults": {
        "xmlSyntax": {
            "valid": true,
            "messages": [],
            "result": "No Errors found"
        },
        "xsdValidation": {
            "valid": false,
            "messages": [
                {
                    "type": "GenericXsdError",
                    "message": "cvc-complex-type.2.4.a: Invalid content was found starting with element '{\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\":IssueDate}'. One of '{\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\":ProfileExecutionID, \"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\":ID}' is expected."
                }
            ],
            "result": "Errors found"
        },
        "schematronValidation": []
    }
}
  • 401 Unauthorized
{
    "message": "Unauthorized"
}