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.
https://api.invoicexml.com/v1/validate/xrechnung
Code Example
curl -X POST https://api.invoicexml.com/v1/validate/xrechnung \ -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.
Request
| Parameter | Type | Description |
|---|---|---|
| file * | binary | The invoice file to validate. Accepted format: standalone XRechnung XML document (CII or UBL syntax). |
| 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
{
"valid": true,
"detail": "Your invoice is xrechnung compliant and meets the EN 16931 specifications.",
"data": {
"schemaValid": true,
"schematronValid": true,
"conformanceLevel": "EN16931"
}
}
{
"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 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.