# stdnum.de.handelsregisternummer

Handelsregisternummer (German company register number).

The number consists of the court where the company has registered, the type of register and the registration number.

The type of the register is either HRA or HRB where the letter “B” stands for HR section B, where limited liability companies and corporations are entered (GmbH’s and AG’s). There is also a section HRA for business partnerships (OHG’s, KG’s etc.). In other words: businesses in section HRB are limited liability companies, while businesses in HRA have personally liable partners.

More information:

- https://www.handelsregister.de/

- https://en.wikipedia.org/wiki/German_Trade_Register

- https://offeneregister.de/

    >>> validate('Aachen HRA 11223')
    'Aachen HRA 11223'
    >>> validate('Frankfurt/Oder GnR 11223', company_form='e.G.')
    'Frankfurt/Oder GnR 11223'
    >>> validate('Aachen HRC 44123')
    Traceback (most recent call last):
      ...
    InvalidFormat: ...
    >>> validate('Aachen HRA 44123', company_form='GmbH')
    Traceback (most recent call last):
      ...
    InvalidComponent: ...

stdnum.de.handelsregisternummer.check_offeneregister(number: str, timeout: float = 30, verify: bool | str = True) → dict[str, Any] | None

  Retrieve registration information from the OffeneRegister.de web site.

  The timeout argument specifies the network timeout in seconds.

  The verify argument is either a boolean that determines whether the server’s certificate is validate or a string which must be a path the CA certificate bundle to use for verification.

  This basically returns the JSON response from the web service as a dict. It will contain something like the following:

      {
          'companyId': 'U1206_HRB14011',
          'courtCode': 'U1206',
          'courtName': 'Chemnitz',
          'globalId': 'sn_293298',
          'isCurrent': 'True',
          'name': 'Internet hier GmbH Presentation Provider',
          'nativeReferenceNumber': 'Chemnitz HRB 14011',
          'referenceNumberFirstSeen': '2020-06-12',
          'stdRefNo': 'U1206_HRB14011',
          'validFrom': '2020-06-12',
          'validTill': '',
      }

  Will return None if the number is invalid or unknown.

stdnum.de.handelsregisternummer.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.handelsregisternummer.is_valid(number: str) → bool

  Check if the number is a valid company registry number.

stdnum.de.handelsregisternummer.validate(number: str, company_form: str | None = None) → str

  Check if the number is a valid company registry number. If a company_form (eg. GmbH or PartG) is given, the number is validated to have the correct registry type.