Dokmatiq DOKMATIQ

XRechnung

The German XML invoice standard and mandatory format for invoices to public-sector buyers (B2G) in Germany.

Also known as: XRechnung 3.0, German CIUS, German B2G invoice

Short definition

XRechnung is a Core Invoice Usage Specification (CIUS) of the European standard EN 16931, tailored for Germany. It is a pure XML file — no PDF, no image data — and the mandatory format for invoices to German federal and state authorities.

It is published by KoSIT (Coordination Office for IT Standards) in Bremen. Current version: XRechnung 3.0 (February 2024).

CII or UBL?

XRechnung allows two XML syntaxes:

  • UN/CEFACT CII (Cross Industry Invoice) — same syntax as ZUGFeRD
  • OASIS UBL (Universal Business Language) Invoice 2.1

The content is identical — every value carries the same Business Term (BT) number from EN 16931. Which syntax is required depends on the recipient: many German authorities accept both, some Peppol recipients require UBL only.

Required fields — the Leitweg-ID

For B2G, field BT-10 (Buyer reference) must contain a valid Leitweg-ID. Without a correct Leitweg-ID the invoice is rejected by the central intake portal (ZRE Bund, OZG-RE of the states).

Structure: coarse-addr — fine-addr — check-digit, e.g. 991-33333TEST-33.

Who must issue XRechnung?

  • Since 27 Nov 2020: all B2G invoices to federal authorities (except direct orders under €1,000)
  • Since 2025: receiving B2B invoices is mandatory for every German company
  • From 2027 onward: sending B2B invoices becomes mandatory, phased by company size

ZUGFeRD (profile XRECHNUNG or EN16931) counts as an acceptable format — a pure XRechnung XML is stricter but not always required.

Creating XRechnung with the Dokmatiq API

Standalone XML (UBL or CII) in a single API call:

curl -X POST https://api.dokmatiq.com/v1/einvoice/xrechnung \
  -H "Authorization: Bearer $DOKMATIQ_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "syntax": "UBL",
    "invoice": {
      "id": "2026-0042",
      "issueDate": "2026-04-17",
      "leitwegId": "991-33333TEST-33",
      "seller": { "name": "Example GmbH", "vatId": "DE123456789" },
      "buyer": { "name": "Bundesamt XY" },
      "lines": [{ "description": "Service A", "quantity": 1, "unitPrice": 4500.0 }]
    }
  }'

The response is an application/xml document validated against the official XRechnung Schematron (currently 3.0).

Converting CII ↔ UBL

Because many ERP systems only emit one of the two syntaxes, the Dokmatiq API also offers lossless conversion in both directions — both carry identical BT fields.

XRechnung vs. ZUGFeRD

XRechnungZUGFeRD
ContainerXMLPDF/A-3 + XML
Human-readableno (viewer required)yes (the PDF)
German B2Gstandardonly XRECHNUNG profile
Suited forauthorities, PeppolB2B, archiving

Common pitfalls

  1. Leitweg-ID missing or wrong — most frequent rejection reason
  2. Wrong tax codes (BT-151) — must match German VAT law
  3. Rounding errors in total fields — line items must sum to the cent
  4. XRechnung 2.x vs. 3.0 — authorities migrate in phases; check the target version

Ready to use it via API?

Get started for free. No credit card. 100 documents per month included.