# stdnum.de.leitweg

Leitweg-ID, a buyer reference or routing identifier for electronic invoices.

For the successful transmission of an electronic invoice as invoicing party or sender, a unique identification and addressing of the invoice recipient is required. The Leitweg-ID must be transmitted as a mandatory requirement for electronic invoicing to public contracting authorities in the federal administration.

More information:

- https://leitweg-id.de/

- https://de.wikipedia.org/wiki/Leitweg-ID

- https://xeinkauf.de/app/uploads/2022/11/Leitweg-ID-Formatspezifikation-v2-0-2-1.pdf

    >>> validate('991-03730-19')
    '991-03730-19'
    >>> validate('1-03730-19')
    Traceback (most recent call last):
        ...
    InvalidFormat: ...

stdnum.de.leitweg.compact(number: str) → str

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.de.leitweg.is_valid(number: str) → bool

  Check if the number provided is valid. This checks the length and check digit.

stdnum.de.leitweg.validate(number: str) → str

  Check if the number provided is valid. This checks the format, state or federal government code, and check digits.