Validate a company identifier (no network call)
validate_company_idCheck whether a national company identifier is well-formed — no network call.
country="NO" checksum-checks a Norwegian organisasjonsnummer (orgnr, org.nr) for
Brønnøysundregistrene / Enhetsregisteret (brreg); this is the cheap norway company
lookup pre-check for the norwegian business registry. country="GB" shape-checks and
normalises a UK company number (company registration number, CRN) for Companies House:
it zero-pads a short number ('445790' → '00445790') and upper-cases a prefix
('oc303675' → 'OC303675'). A CRN has no check digit, so a GB valid: true means the
shape is right and nothing more.
Use it on user input or a spreadsheet column before spending a real lookup_company
call, since it is instant and free.
Returns a ValidationResult and never raises for a malformed identifier: valid: false
comes with reason (what failed) and hint (what to do next) rather than a tool
error — this tool answers a question, it does not fail on bad input
(DECISIONS.md D-010). A valid identifier does not mean the entity exists; follow it
with lookup_company if you need facts.
The only real error here is unsupported_country (no module for that country yet —
call list_countries), raised with the error text {"error": {"code", "message", "hint"}}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The company's national identifier. Norway (country='NO'): a nine-digit organisasjonsnummer (orgnr), e.g. '923609016'; spaces, dots and a 'NO...MVA' VAT suffix are accepted and normalised. United Kingdom (country='GB'): a Companies House company number (CRN), eight characters, e.g. '00445790' or 'OC303675'; a short number is zero-padded for you. | |
| country | No | ISO-3166-1 alpha-2 country code. 'NO' = Norway (Brønnøysundregistrene / Enhetsregisteret), 'GB' = United Kingdom (Companies House). 'UK' is not a country code here and is rejected. Call list_countries for the current set rather than hard-coding one. | NO |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hint | No | What to do next when `valid` is false — the same hint the invalid_id error carries. None when valid: the next call is simply lookup. | |
| input | Yes | The identifier exactly as the caller supplied it. | |
| valid | Yes | True when the identifier passes this country's format and checksum. | |
| reason | No | One English sentence saying why it is valid, or what failed. | |
| country | Yes | ISO-3166-1 alpha-2, upper-case. | |
| registry | Yes | Registry slug, e.g. 'brreg'. | |
| formatted | No | The identifier as a local would write it, e.g. '923 609 016'. None when invalid. | |
| id_scheme | No | Name of the identifier scheme, e.g. 'organisasjonsnummer'. | |
| normalized | No | Canonical form to pass to lookup, e.g. '923609016'. None when invalid. |