check_leitweg_id
Checks a German Leitweg-ID — the routing identifier that goes in BT-10 of an XRechnung to a public authority. An invoice to a German public body with a wrong or missing Leitweg-ID is rejected, so this is worth checking before building a document.
It verifies the structure (Grobadressierung of 2 to 12 digits, an optional Feinadressierung of up to 30 alphanumerics, then two check digits) and recomputes the ISO/IEC 7064 MOD 97-10 check digit, the same procedure an IBAN uses. When the check digits are wrong it returns the ones the address parts actually imply, so the value can be corrected rather than merely rejected. It also names the Bundesland the leading two digits point at, or Bund for the federation.
One real limit: the check digit is computed over the address parts with the hyphens removed, which is what KoSIT specifies, so it CANNOT detect a hyphen in the wrong place. '04011000-1234512345-06' and '040110001-234512345-06' both pass. That is the specification's behaviour, not a defect here.
What this does NOT do: it does not confirm that the ID belongs to a real authority or that they are reachable. It checks the number, not the recipient — there is no directory lookup.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| leitwegId | Yes | The Leitweg-ID, e.g. '04011000-1234512345-06'. Surrounding whitespace is ignored. |