Back to Blog

Leitweg-ID: What It Is and When You Need It

Published on November 14, 2025by Invapi Team
Leitweg-IDXRechnungPublic SectorE-Invoicing

Leitweg-ID: What It Is and When You Need It

Anyone looking to submit an e-invoice to a German public authority cannot avoid the Leitweg-ID. It is the central routing identifier used to assign electronic invoices to the correct recipient. Without a valid Leitweg-ID, your invoice will be rejected.

What Is a Leitweg-ID?

The Leitweg-ID is a unique identifier used by public sector clients in Germany for receiving e-invoices. It ensures that an electronic invoice can be automatically routed to the responsible organizational unit -- comparable to a postal code for digital invoice receipt.

The Leitweg-ID was introduced as part of the German E-Invoicing Ordinance (ERechV) at the federal level and is now also in use across many state administrations and municipalities.

Structure of the Leitweg-ID

A Leitweg-ID consists of three parts separated by hyphens:

[Coarse routing]-[Fine routing]-[Check digit]

Coarse Routing

The coarse routing identifies the higher-level administrative unit. It is based on the official municipality key or a federal key. For federal authorities, the coarse routing starts with 991; for state authorities, it starts with the respective state code (e.g., 01 for Schleswig-Holstein).

Fine Routing

The fine routing is an optional alphanumeric block that specifies the exact organizational unit within the coarse routing. This could be a particular department, division, or branch office. The assignment is made by the respective contracting authority itself.

Check Digit

The two-digit check digit at the end serves for error detection. It is calculated using the Modulo 97-10 method as defined in ISO/IEC 7064:2003 -- the same method used for IBAN validation. This reliably detects typos during entry.

Example: 991-12345-67 -- Federal authority (991), organizational unit 12345, check digit 67.

When Is the Leitweg-ID Required?

The German Federal E-Invoicing Ordinance (ERechV) stipulates in Section 5 (Content of the electronic invoice) that electronic invoices to federal authorities must contain a Leitweg identification number. At the state level, comparable regulations apply, although specific requirements may vary between individual states.

Mandatory for:

  • Invoices to federal authorities and federal institutions
  • Invoices to state authorities in most German states
  • Invoices to municipalities, where electronic invoicing has been implemented
  • All invoices submitted via the federal invoice receipt platform (OZG-RE)

Not required for:

  • Invoices in the purely private B2B sector
  • Invoices to companies without a public sector background

Where Do You Obtain the Leitweg-ID?

The Leitweg-ID is provided by the public sector client -- typically in the purchase order, the contract, or the procurement documents. You cannot generate the Leitweg-ID yourself or look it up online.

If you do not have the Leitweg-ID, you should:

  1. Check the order documents or the contract
  2. Contact the contracting authority directly (procurement office or accounting department)
  3. Look for e-invoicing guidance on the authority's website

Technical Integration in XRechnung

In XRechnung, the Leitweg-ID is entered in the field BT-10 (Buyer Reference). This is a mandatory field in the XRechnung standard. Without this entry, validation will fail.

When transmitting in UBL format, the Leitweg-ID is placed in the cbc:BuyerReference element; in CII format, it goes in the ram:BuyerReference element within the ApplicableHeaderTradeAgreement.

With invapi, you can simply specify the Leitweg-ID in the JSON invoice object under additional_data.leitweg_id -- the correct mapping to UBL or CII is handled automatically during conversion.

Common Mistakes to Avoid

  • Forgetting the Leitweg-ID: The most common reason for rejected e-invoices. Before sending, verify that the BT-10 field is populated.
  • Wrong Leitweg-ID: Pay attention to the exact format with hyphens. Even a single transposed digit will lead to rejection.
  • Leitweg-ID in the wrong field: The ID belongs in BT-10 (Buyer Reference), not in the comment field or the order number.
  • Outdated Leitweg-ID: Authorities may change their Leitweg-IDs, for example during organizational restructuring. Always use the most recently communicated ID.

Conclusion

The Leitweg-ID is a small but critical detail for e-invoices to the public sector. Without it, your invoice will not be delivered. Make sure you obtain the ID from the contracting authority, capture it accurately, and enter it in the correct field of your XRechnung. This way, you avoid delays and ensure smooth invoice processing.