Automation Blog Pricing Contact

Validate UBL Invoice using REST-API

Validate a UBL 2.1 invoice against the full Peppol compliance stack: OASIS UBL 2.1 XML schema (XSD), EN 16931 Schematron business rules, and Peppol BIS Billing 3.0 constraints. Upload a UBL XML file or a PDF with embedded UBL and receive a detailed validation report.

POST https://api.invoicexml.com/v1/validate/ubl

Code Example

curl -X POST https://api.invoicexml.com/v1/validate/ubl \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "[email protected]" \
  -F "version=2.3.2" \
  -F "profile=extended"

Try it out online — no coding required

Upload an invoice and get a full compliance report instantly, right in your browser.

Try It Online

Request

Parameter Type Description
file * binary The invoice file to validate. Accepted formats: UBL 2.1 XML, or PDF with embedded UBL XML.
version string Standard version (e.g. 2.3.2). Defaults to the latest supported version.
profile string Compliance profile. Values: minimum, basicwl, basic, en16931, extended. Defaults to en16931.

Content-Type: multipart/form-data

Headers

Header Value
Authorization * Bearer YOUR_API_KEY
Content-Type multipart/form-data

Response

200 The invoice is valid. Returns a JSON object confirming compliance.
Content-Type: application/json
{
  "valid": true,
  "detail": "Your invoice is ubl compliant and meets the EN 16931 specifications.",
  "data": {
    "schemaValid": true,
    "schematronValid": true,
    "conformanceLevel": "EN16931"
  }
}
200 The invoice has validation errors. Returns a JSON object with structured error information.
{
  "valid": false,
  "detail": "Validation failed with 3 error(s)",
  "data": {
    "conformanceLevel": "EN16931"
  },
  "errors": {
    "xml": [
      "[BR-01] An invoice shall have a specification identifier.",
      "[BR-06] An invoice shall contain the seller name.",
      "[BR-08] An invoice shall contain the document total amount."
    ],
    "friendly": [
      {
        "rule": "BR-01",
        "line": null,
        "message": "The invoice is missing a specification identifier (BT-24)."
      },
      {
        "rule": "BR-06",
        "line": null,
        "message": "The seller must have a name (BT-27). Add the seller's name."
      },
      {
        "rule": "BR-08",
        "line": 2,
        "message": "Line item 2: The document total amount with VAT is missing or incorrect."
      }
    ]
  }
}

Error Reference

When an invoice fails validation, the errors.xml array contains one entry per violated business rule. Each entry starts with the rule identifier (e.g. [BR-01]) followed by the raw Schematron description.

The errors.friendly array provides a parallel set of user-facing messages — one object per violation. Each object contains:

Field Type Description
rule string The business rule identifier (e.g. BR-01, BR-DE-15).
line int | null The 1-based invoice line item number the error relates to, or null when the error applies to the document level.
message string A plain-language explanation of the violation, suitable for displaying directly to end users.
Status Meaning Action
200 Validation completed. Check valid to determine compliance. If valid is false, inspect errors.xml or errors.friendly.
401 Missing or invalid API key. Check the Authorization header.
422 File is not a valid PDF or XML document. Ensure you are uploading a supported file format.

Frequently Asked Questions

What does UBL validation check?

The validator runs three layers of checks: (1) OASIS UBL 2.1 XML schema conformance (XSD), (2) EN 16931 Schematron business rules (BR-01 through BR-65 and all co-occurrence rules), and (3) Peppol BIS Billing 3.0 constraints — exactly what any Peppol access point enforces on receipt.

What is Peppol BIS Billing 3.0?

Peppol BIS Billing 3.0 is the Peppol specification for invoice exchange over the global Peppol network. It uses UBL 2.1 as its XML syntax and builds on EN 16931. It is mandatory for public sector B2G invoicing in Norway, Denmark, Sweden, Singapore, Australia, and New Zealand.

How does UBL validation differ from CII validation?

Both target EN 16931 compliance but for different syntaxes. UBL validation applies the UBL 2.1 schema and Peppol-specific rules — use it for invoices destined for the Peppol network. CII validation applies the UN/CEFACT D16B schema and is the right choice for ZUGFeRD or Factur-X invoices.

What are the PEPPOL- rules in the error response?

PEPPOL- rules are Peppol BIS Billing 3.0 constraints layered on top of EN 16931. For example, PEPPOL-EN16931-R001 enforces the correct CustomizationID for the Peppol profile. These rules are applied in addition to the standard EN 16931 BR rules.

Can I validate a PDF file with this endpoint?

Yes, if the PDF contains embedded UBL XML. The API extracts the XML automatically before running validation. For ZUGFeRD or Factur-X PDFs (which embed CII XML), use the /v1/validate/zugferd or /v1/validate/facturx endpoints instead.