← Back to docs

Validation API Reference

Validation API Reference

The validation endpoint checks XML invoices against the EN 16931 standard and XRechnung-specific rules. It supports UBL 2.1, CII (Cross Industry Invoice), and ZUGFeRD profiles.

Endpoint

POST /v1/invoices/validate

Authentication

Pass your API key in the Authorization header:

Authorization: Bearer ps_live_...

Request

Send the raw XML invoice as the request body with Content-Type: application/xml.

curl -X POST https://api.postscale.io/v1/invoices/validate \
  -H "Authorization: Bearer ps_live_..." \
  -H "Content-Type: application/xml" \
  -d @invoice.xml

Query Parameters

ParameterTypeDefaultDescription
profilestringautoForce a specific profile: xrechnung-ubl, xrechnung-cii, zugferd-basic, zugferd-comfort, zugferd-extended. When auto, the format is detected from the XML.

Response

Success (200)

{
  "valid": true,
  "format": "xrechnung-ubl",
  "standard": "EN 16931",
  "profile_version": "3.0.2",
  "errors": [],
  "warnings": [
    {
      "rule": "BR-CL-01",
      "path": "/Invoice/InvoiceTypeCode",
      "message": "Invoice type code should use UNTDID 1001 subset",
      "severity": "warning"
    }
  ]
}

Validation Failed (200)

{
  "valid": false,
  "format": "xrechnung-ubl",
  "standard": "EN 16931",
  "errors": [
    {
      "rule": "BR-02",
      "path": "/Invoice/AccountingSupplierParty/Party/PartyName",
      "message": "An Invoice shall have a Seller name (BT-27)",
      "severity": "error"
    },
    {
      "rule": "BR-DE-01",
      "path": "/Invoice/AccountingSupplierParty/Party/Contact",
      "message": "A German invoice must contain seller contact information",
      "severity": "error"
    }
  ],
  "warnings": []
}

Error Codes

HTTP StatusMeaning
200Validation completed (check valid field for result)
400Request body is not valid XML
401Missing or invalid API key
413XML exceeds 10 MB size limit
429Rate limit exceeded

Validation Rules

The validator applies rules in three layers:

  1. EN 16931 Business Rules (BR-*) — core European e-invoicing standard rules
  2. XRechnung Rules (BR-DE-*) — Germany-specific rules (Leitweg-ID, contact info, payment terms)
  3. Syntax Rules — UBL 2.1 or CII D16B schema validation

Each error includes the rule ID, the XML path where the violation occurred, and a human-readable message.

Rate Limits

Validation requests are rate-limited per API key:

PlanRequests/minute
Free30
Pro300
EnterpriseCustom