Leitweg-ID check

Checks the structure and check digits of a Leitweg-ID against the official format specification (KoSIT, version 2.0.2). If the check digits are missing, they are calculated.

What is a Leitweg-ID?

The Leitweg-ID is the e-invoicing address of a German public authority. Federal, state and local authorities use it to route incoming XRechnung invoices to the right office. You get it from the authority you invoice, usually with the order or contract.

Structure

A Leitweg-ID has up to three parts separated by hyphens:

Example from the specification: 04011000-1234512345-06.

Where does it go in an XRechnung?

In the Buyer reference (BT-10) field. For invoices to public authorities it is mandatory there, and invoices without a valid Leitweg-ID are usually rejected.

Billing with Stripe? With Invoiceer for Stripe you add the Leitweg-ID once as customer metadata leitweg_id, and every invoice to that customer becomes an XRechnung with the right buyer reference.

Questions

Where do I find the Leitweg-ID?

The authority you invoice gives it to you, usually in the order or contract, or on request from its accounts department. Don't guess it: it decides who receives your invoice.

Do I need a Leitweg-ID for invoices to companies?

No. For invoices to businesses, any agreed reference such as a purchase order or customer number is enough as the buyer reference.

What does a wrong check digit mean?

Usually a character was mistyped or swapped. Confirm the Leitweg-ID with the authority instead of changing the check digits yourself.