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 /v1/validate/ubl

Request

Parameter Type Description
file * binary The invoice file to validate. Accepted formats: UBL 2.1 XML, or PDF with embedded UBL XML.

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 with the validation result.
Content-Type: application/json
{
  "valid": true,
  "message": "The invoice is valid.",
  "profile": "EN16931",
  "standard": "ubl"
}
400 Validation failed. Returns a ProblemDetails object with structured error information.
{
  "type": "https://tools.ietf.org/html/rfc9110#section-15.5.1",
  "title": "Validation Failed",
  "status": 400,
  "detail": "The invoice contains 3 validation error(s).",
  "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."
    ]
  }
}

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 a human-readable description.

Status Meaning Action
200 Invoice is valid — all Schematron rules passed. No action required.
400 Validation errors found in the invoice. Inspect errors.xml and fix the listed rule violations.
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.

Code Example

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

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.