← 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
| Parameter | Type | Default | Description |
|---|---|---|---|
profile | string | auto | Force 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 Status | Meaning |
|---|---|
| 200 | Validation completed (check valid field for result) |
| 400 | Request body is not valid XML |
| 401 | Missing or invalid API key |
| 413 | XML exceeds 10 MB size limit |
| 429 | Rate limit exceeded |
Validation Rules
The validator applies rules in three layers:
- EN 16931 Business Rules (
BR-*) — core European e-invoicing standard rules - XRechnung Rules (
BR-DE-*) — Germany-specific rules (Leitweg-ID, contact info, payment terms) - 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:
| Plan | Requests/minute |
|---|---|
| Free | 30 |
| Pro | 300 |
| Enterprise | Custom |