Skip to main content
Complyance is Officially Listed as a UAE Approved Accredited Service Provider
Create XRechnung Invoice: Step-by-Step Guide 2026

Create XRechnung Invoice: Step-by-Step Guide 2026

Swathy
Published on Jul 23, 2026
Create XRechnung Invoice: Step-by-Step Guide 2026

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)

PYTHON
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:

JAVASCRIPT
urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0

Tax 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
<?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 FieldNameExample ValueNotes
BT-1Invoice numberRE-2026-00142Must be unique per seller
BT-2Invoice issue date2026-04-21ISO 8601 format
BT-3Invoice type code380380 = standard invoice; 381 = credit note
BT-5Invoice currency codeEURISO 4217
BT-9Payment due date2026-05-21Required for payment terms
BT-10Buyer reference (Leitweg-ID)04011000-1234512345-06Most common rejection cause
BT-24Specification identifierurn:cen.eu:en16931:2017#...Must match current version
BT-27Seller nameMusterfirma GmbHLegal name
BT-30Seller VAT identifierDE123456789Must begin with country code
BT-44Buyer nameBundesministerium XYZLegal name
BT-84Payment account identifierDE89370400440532013000IBAN
BT-112Invoice total without VAT1000.00Must equal sum of line amounts
BT-115Amount due for payment1190.00Net + VAT
The most common rejection cause: BT-10 (Buyer Reference) is the field where the Leitweg-ID goes.

Submission Channels

ChannelRecipientsComplyance Support
Peppol networkB2G and B2B, Germany and internationallyYes — certified Peppol Access Point
ZRE (Central Invoice Receipt Platform)Direct federal agenciesYes
OZG-REIndirect federal administrationYes
State portalsState administrationsVia export and portal upload

Do's and Don'ts

DoDon't
Always put the Leitweg-ID in BT-10Leave BT-10 empty
Validate every invoice before submissionSubmit XML that has not been validated
Use UBL 2.1 as default unless CII is requiredSwitch between UBL and CII without confirming
Set the CustomizationID to the latest versionUse outdated specification identifiers
Include complete payment detailsOmit bank account information
Use UN/ECE unit codesUse free-text units like "hours"
Keep seller and buyer addresses completeLeave 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.

Share

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.

About the Author

Swathy

Swathy

Content Marketer

I’m a Content Marketer at Complyance, focused on e-invoicing. Over the years, I’ve created a wide range of content, including blog posts, whitepapers, and product guides, which have supported Complyance’s growth across markets such as the UAE and EU regions. My goal is to deliver content that is comprehensive, clear, accurate, and easy to understand, no matter how complex the topic.

Related Posts

Complyance Logo

One API for Global E-invoicing