CRATEAPI

XRechnung and the Leitweg-ID, explained

Germany2 min read

Every guide to German e-invoicing mentions the Leitweg-ID and moves on quickly, as if it's self-explanatory. It isn't, if you haven't dealt with German public-sector procurement before — so here's what it actually is and where it comes from.

XRechnung, briefly

XRechnung is Germany's CIUS on EN 16931 — a UBL or CII invoice, with a handful of fields EN 16931 leaves optional made mandatory. It's been required for invoicing German federal and most state public administrations (B2G) since November 2020. B2B issuance is becoming mandatory in stages: from 2027 for businesses over €800k turnover, from 2028 for everyone.

What the Leitweg-ID solves

Germany's public sector isn't one organization — it's federated across federal, state (Land) and municipal bodies, each with their own departments and procurement offices. A supplier addressing "the German government" or even "the Ministry of X" isn't specific enough for an invoice to reach the right desk automatically. The Leitweg-ID is a hierarchical routing identifier — think of it as a very specific postal code for German public-sector bureaucracy — that tells the receiving e-invoicing infrastructure exactly which unit should get the document.

It isn't something a supplier invents. The buyer — the public body placing the order — issues its own Leitweg-ID and gives it to you, usually in the purchase order or contract. If you don't have one, you ask the contracting authority, not the tax office.

Not a special field

Here's the part worth being precise about, because it's easy to assume XRechnung invented a proprietary extension: the Leitweg-ID maps directly to the ordinary EN 16931 buyer reference business term, BT-10. In our canonical model, that's the plain buyer_reference field — verified directly against the model source, not a guess. Generic EN 16931 makes BT-10 optional; XRechnung's CIUS simply makes it mandatory and expects it to hold a valid Leitweg-ID when the buyer is a German public body.

Two other things XRechnung requires that plain EN 16931 leaves optional, worth checking at the same time:

Checking it before you send

curl -X POST "$BASE/v1/validate/cii?profile=xrechnung" \
  -H "Content-Type: application/xml" --data-binary @invoice.xml

A missing or malformed Leitweg-ID shows up as a BR-DE-* finding against BT-10 — browse the error code reference for the exact rule text, or read the full XRechnung format page for endpoint details and a sample file.

Keep reading

Want to try this against a real invoice?

Every example above calls the same API you can call today — validate for free, or read the full reference.