Errors
What errors look like and what you can do.
Structure of an error response
The HTTP status always tells you whether a request worked: 2xx means success, anything from 400 up is an error. Check the status first in your code. What the response body looks like depends on the endpoint and the error.
| Form | Where it occurs | Fields |
|---|---|---|
| Error code with meta |
fetch-organization, fetch-person, search-organizations, fetch-document and /v1/account when they reject a request
|
error (a code or a short text), sometimes also message; in meta the explanation message plus request_credit_cost and credits_remaining
|
| List in detail |
No matching company or person found (404), invalid search filters (422)
|
detail, each entry with type (such as not_found), loc, msg and input; plus meta
|
Problem Details (application/problem+json)
|
All errors from signals |
type, title, status, code, detail, for invalid parameters invalid_params; in meta also request_id
|
| Only error |
Authentication (401, 403 for an unconfirmed email address) and limits (429)
|
error; at the limit also message and retry_after
|
| Only meta |
Not enough credits (402), except for signals
|
meta.message, meta.request_credit_cost (the amount needed) and meta.credits_remaining
|
In your code, decide by the status and by the fixed codes in error or code. The texts in message, msg and detail are in English and meant for humans. Write them to your log.
Send the header Accept: application/json. Then the API answers with JSON even for an unknown path or a wrong method.
1{2 "error": "validation_failed",3 "meta": {4 "message": "financial_statement_type must be one of: auto, annual, consolidated.",5 "request_credit_cost": 0,6 "credits_remaining": 1457 }8}
1{2 "detail": [3 {4 "type": "not_found",5 "loc": [6 "query",7 "person_q"8 ],9 "msg": "Could not verify with sufficient confidence that 'Erika Musterfrau-Nichtvorhanden' is affiliated with 'Hetzner Online GmbH'",10 "input": {11 "person_q": "Erika Musterfrau-Nichtvorhanden",12 "organization_q": "Hetzner Online GmbH"13 }14 }15 ],16 "meta": {17 "request_credit_cost": 0,18 "credits_remaining": 14519 }20}
1{2 "type": "https://handelsregister.ai/problems/invalid-request",3 "title": "Invalid request",4 "status": 422,5 "code": "INVALID_REQUEST",6 "detail": "One or more Signals parameters are invalid.",7 "invalid_params": {8 "limit": [9 "Unknown Signals parameter."10 ]11 },12 "meta": {13 "request_id": "req_01m6b25551xazxjpc5ny6b2cx0",14 "request_credit_cost": 0,15 "credits_remaining": 14516 }17}
Status codes
The table shows every error status of the API, what triggers it and what you can do. Which of them an endpoint returns is listed on its page.
| Status | Cause | What you can do |
|---|---|---|
| 400 |
A parameter is invalid, such as a wrong company_id or a search term that is too short. Also api_key in the URL for /v1/account/*. |
Fix the request according to meta.message. |
| 401 | No valid API key and no valid token. |
Send the key in the header x-api-key, see Authentication. |
| 402 | Your balance does not cover the highest possible cost of the request. | Top up credits or request fewer features, see Billing. |
| 403 | Email address not confirmed, a plan required (such as for fetch-person, search filters from Pro, or individual Signals topics) or the token lacks an ability. | Confirm your email, choose a credit subscription or use a token with the right ability. |
| 404 | No matching company, person or document. For account endpoints, an unknown ID. |
Use the register court with the register number, or the entity_id. |
| 408 | The request took too long, for example because the register answers slowly during a realtime fetch. | Retry later. Nothing was billed. |
| 409 | Monitoring and webhooks: the idempotency key belongs to different parameters or is still running, or a monitor for this company already exists. | Use a new key, wait briefly or use the existing monitor. |
| 415 | The register holds the document only as a TIFF image. The API delivers documents as PDF or XML. | Fetch the document directly from the Registerportal (register portal). Nothing was billed. |
| 422 |
A value is invalid, such as financial_years outside the allowed range. Also an idempotency key that already belongs to different parameters. |
Fix the value according to meta.message or invalid_params; for new parameters, use a new key. |
| 428 | A write request to Monitoring or webhooks without an idempotency key. |
Send the header Idempotency-Key. |
| 429 | Too many requests in one minute. |
Wait as many seconds as Retry-After says, see Limits. |
| 500 | A temporary error, for example because the data source was briefly unavailable or the register returned an error. | Retry with increasing intervals. |
| 502 | The search or the register returned an unreadable response. | Retry with increasing intervals. Nothing was billed. |
| 503 |
A service is temporarily unavailable: Signals, Monitoring, webhook checks or a document fetch with async=true. |
Retry after Retry-After or a little later. |
| 504 | fetch-document: the register did not answer in time. |
Request again after Retry-After. Nothing was billed. |
504 and pay nothing. If a realtime fetch fails, fetch-organization returns the stored data, without the Realtime surcharge. If a request takes too long, you get 408, also at no cost. Retry the request a few minutes later.
Free requests
A rejected or failed request costs nothing. You can tell by meta.request_credit_cost: 0, for Signals also by the header X-Credits-Charged: 0.
In particular, these are free:
- Requests without valid credentials (
401,403) and over the limit (429) - Requests with invalid parameters (
400,422) and with too few credits (402) - Requests that find no company, person or document (
404), except with AI Mode - Timeouts (
408, for documents504) and data source outages (5xx)
AI Mode is the exception: it is billed as soon as the research has run, even if it finds no company or the data source reports an error. Only when the API aborts the request with 408 is it not billed either.
The reverse also holds: a successful search without results and an empty page of Signals are billed. Features without data, on the other hand, never cost anything, see Billing. The AI Mode and Realtime surcharges follow their own rules, see Surcharges.