Validate XRechnung Invoice using REST-API
Validate an XRechnung XML invoice against the full German B2G compliance stack. The API checks CII or UBL XML schema conformance, EN 16931 Schematron business rules, and the additional XRechnung CIUS constraints defined by KoSIT — ensuring your invoices are accepted by German government portals such as ZRE and OZG-RE.
/v1/validate/xrechnung
Request
| Parameter | Type | Description |
|---|---|---|
| file * | binary | The invoice file to validate. Accepted format: standalone XRechnung XML document (CII or UBL syntax). |
Content-Type: multipart/form-data
Headers
| Header | Value |
|---|---|
| Authorization * | Bearer YOUR_API_KEY |
| Content-Type | multipart/form-data |
Response
{
"valid": true,
"message": "The invoice is valid.",
"profile": "EN16931",
"standard": "xrechnung"
}
{
"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/xrechnung \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "[email protected]"
Frequently Asked Questions
What is XRechnung validation?
XRechnung validation checks your XML invoice against the German CIUS (Core Invoice Usage Specification) of EN 16931. It applies all EN 16931 core business rules plus the additional XRechnung-specific constraints defined by KoSIT, such as mandatory Leitweg-ID and stricter field requirements.
What is the difference between XRechnung and ZUGFeRD validation?
XRechnung validation expects a standalone XML file and applies stricter German CIUS rules. ZUGFeRD validation expects a hybrid PDF with embedded XML and applies ZUGFeRD profile rules. Both share the EN 16931 core rules, but XRechnung adds B2G-specific constraints.
Does this endpoint accept PDF files?
No. The XRechnung validator expects a standalone XML document (CII or UBL syntax). If you have a ZUGFeRD or Factur-X PDF, use the /v1/validate/zugferd or /v1/validate/facturx endpoints instead.
Which XRechnung versions are supported?
The validator supports XRechnung 2.0, 2.1, and 3.0. The version is auto-detected from the CustomizationID in the XML. Validation rules are aligned with the current KoSIT validator release.
Is the Leitweg-ID mandatory?
Yes. XRechnung requires a Leitweg-ID (routing identifier) in the BuyerReference field for B2G invoicing. The validator flags its absence as a rule violation.