Create XRechnung Invoice: Step-by-Step Guide 2026

Table of Contents
XRechnung is Germany's mandatory e-invoicing standard for all invoices to public sector buyers. Every federal ministry, public agency, and an increasing number of state and municipal bodies require it. As B2B e-invoicing obligations roll out from 2025 onward, the XRechnung invoice format is becoming unavoidable for virtually every business operating in Germany.
An XRechnung invoice is pure XML. It follows the European standard EN 16931, with German-specific business rules layered on top (the XRechnung CIUS). Getting it right means correctly mapping over a dozen mandatory fields, choosing between two XML syntaxes, validating against KoSIT rules, and routing to the right submission channel.
Complyance handles all of that.
Quick answer: To create a valid XRechnung invoice, you need the recipient's Leitweg-ID and your invoice data. Complyance generates the correct UBL 2.1 or CII XML, runs built-in KoSIT validation, and routes delivery via Peppol or the ZRE portal. The current binding version is XRechnung 3.0.2, validated against the 2026-01-31 configuration.
Key Takeaways
- XRechnung is mandatory for all invoices to German federal agencies, and increasingly required for B2B from 2025 onward.
- You need the recipient's Leitweg-ID before you can create a valid invoice.
- Complyance generates a UBL 2.1 or CII XRechnung invoice from your data.
- Validation is built in — every invoice Complyance generates is checked against current KoSIT rules before delivery.
- The Complyance API lets you automate the entire flow from data entry to submission in a single call.
What You Need Before You Start
Two things are required:
The recipient's Leitweg-ID. This is the routing identifier that tells the government's system which department should receive your invoice. The format looks like this: 04011000-1234512345-06. Without it, the invoice will be rejected.
Your invoice data. Invoice number, issue date, due date, line items with quantities and unit prices, VAT rates, seller VAT ID, and bank details (IBAN).
How Complyance Creates Your XRechnung
Via the Platform (No Code Required)
You enter your invoice data into structured fields — seller, buyer, line items, payment terms. Complyance maps the data to the correct XRechnung invoice business terms, selects the right XML syntax (UBL 2.1 by default), runs validation, and prepares the file for submission.
Via the API (For Developers and ERP Integration)
import requests
API_KEY = "your_complyance_api_key"
BASE_URL = "https://api.complyance.io/v1"
invoice_data = {
"format": "xrechnung-ubl",
"invoice_number": "RE-2026-00142",
"issue_date": "2026-04-21",
"due_date": "2026-05-21",
"buyer_reference": "04011000-1234512345-06",
"currency": "EUR",
"seller": {
"name": "Musterfirma GmbH",
"street": "Musterstrasse 1",
"city": "Berlin",
"postal_code": "10115",
"country": "DE",
"vat_id": "DE123456789"
},
"buyer": {
"name": "Bundesministerium XYZ",
"street": "Bundesallee 10",
"city": "Berlin",
"postal_code": "10117",
"country": "DE"
},
"lines": [
{
"description": "IT Consulting",
"quantity": 10,
"unit": "HUR",
"unit_price": 100.00,
"vat_rate": 19.0
}
]
}
response = requests.post(
f"{BASE_URL}/invoices/create",
json=invoice_data,
headers={"Authorization": f"Bearer {API_KEY}"}
)
result = response.json()
print(f"Validation: {result['validation_status']}")
print(f"Download: {result['xml_download_url']}")One API call creates the XRechnung invoice, validates it, and returns the finished XML.
What Complyance Handles Automatically
Format selection and namespace handling. UBL 2.1 by default, CII on request.
CustomizationID. The current value is:
urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0Tax breakdowns. Line-level VAT calculations, tax subtotals per category, and monetary totals must all be consistent and correctly rounded.
Unit codes. XRechnung requires UN/ECE unit codes — HUR for hours, C62 for pieces, MTR for metres.
Validation before delivery. Every invoice is checked against XSD schema, Schematron rules, and XRechnung-specific business rules.
The XRechnung XML Structure (For Developers)
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0</cbc:CustomizationID>
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
<cbc:ID>RE-2026-00142</cbc:ID>
<cbc:IssueDate>2026-04-21</cbc:IssueDate>
<cbc:DueDate>2026-05-21</cbc:DueDate>
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>04011000-1234512345-06</cbc:BuyerReference>
<cac:AccountingSupplierParty>
<cac:Party>
<cac:PartyName>
<cbc:Name>Musterfirma GmbH</cbc:Name>
</cac:PartyName>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="EUR">1000.00</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="EUR">1000.00</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="EUR">1190.00</cbc:TaxInclusiveAmount>
<cbc:PayableAmount currencyID="EUR">1190.00</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="HUR">10</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">1000.00</cbc:LineExtensionAmount>
<cac:Item>
<cbc:Name>IT Consulting</cbc:Name>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="EUR">100.00</cbc:PriceAmount>
</cac:Price>
</cac:InvoiceLine>
</Invoice>Mandatory Fields Reference
| BT Field | Name | Example Value | Notes |
|---|---|---|---|
| BT-1 | Invoice number | RE-2026-00142 | Must be unique per seller |
| BT-2 | Invoice issue date | 2026-04-21 | ISO 8601 format |
| BT-3 | Invoice type code | 380 | 380 = standard invoice; 381 = credit note |
| BT-5 | Invoice currency code | EUR | ISO 4217 |
| BT-9 | Payment due date | 2026-05-21 | Required for payment terms |
| BT-10 | Buyer reference (Leitweg-ID) | 04011000-1234512345-06 | Most common rejection cause |
| BT-24 | Specification identifier | urn:cen.eu:en16931:2017#... | Must match current version |
| BT-27 | Seller name | Musterfirma GmbH | Legal name |
| BT-30 | Seller VAT identifier | DE123456789 | Must begin with country code |
| BT-44 | Buyer name | Bundesministerium XYZ | Legal name |
| BT-84 | Payment account identifier | DE89370400440532013000 | IBAN |
| BT-112 | Invoice total without VAT | 1000.00 | Must equal sum of line amounts |
| BT-115 | Amount due for payment | 1190.00 | Net + VAT |
The most common rejection cause: BT-10 (Buyer Reference) is the field where the Leitweg-ID goes.
Submission Channels
| Channel | Recipients | Complyance Support |
|---|---|---|
| Peppol network | B2G and B2B, Germany and internationally | Yes — certified Peppol Access Point |
| ZRE (Central Invoice Receipt Platform) | Direct federal agencies | Yes |
| OZG-RE | Indirect federal administration | Yes |
| State portals | State administrations | Via export and portal upload |
Do's and Don'ts
| Do | Don't |
|---|---|
| Always put the Leitweg-ID in BT-10 | Leave BT-10 empty |
| Validate every invoice before submission | Submit XML that has not been validated |
| Use UBL 2.1 as default unless CII is required | Switch between UBL and CII without confirming |
| Set the CustomizationID to the latest version | Use outdated specification identifiers |
| Include complete payment details | Omit bank account information |
| Use UN/ECE unit codes | Use free-text units like "hours" |
| Keep seller and buyer addresses complete | Leave mandatory address fields empty |
Conclusion
An XRechnung invoice has specific field requirements, two XML syntax options, and strict validation rules. Complyance handles format generation, field mapping, validation, and submission as a single integrated workflow.
Related posts
Frequently Asked Questions
Any business invoicing a German public sector entity. With Germany's B2B e-invoicing mandate rolling in from 2025, XRechnung is also becoming the standard format for B2B invoicing.
XRechnung is pure XML. ZUGFeRD is a hybrid format that embeds an XML file inside a PDF/A-3 document.
UBL 2.1 is the right choice for the vast majority of German B2G invoices.
The recipient's system rejects it automatically. With Complyance, validation happens before delivery.
Yes. The Complyance REST API connects to any system that can make HTTP requests.
Free tier covers 100 invoices per month. Paid plans start from EUR 49 per month.
If you are submitting directly to federal agencies via the ZRE portal, yes. When sending via Peppol through Complyance, you do not need to interact with the ZRE portal directly.
Complyance runs the same validation logic as the official KoSIT Validator — XSD schema, Schematron rules, and XRechnung business rules — in a single pass.





















