Authentication

How your requests identify themselves.

API key

curl -G "https://handelsregister.ai/api/v1/fetch-organization" \
  -H "x-api-key: YOUR_API_KEY" \
  --data-urlencode 'q=Hetzner Online GmbH'
The API is ready as soon as you confirm your email address. Until then it answers with 403.

Three ways to authenticate

Way
Way What it looks like Works for
API key in the header (recommended) x-api-key: YOUR_API_KEY All endpoints
Bearer token: a token from /v1/auth/tokens or an AI agent's OAuth token Authorization: Bearer YOUR_TOKEN All endpoints except /v1/auth/tokens
API key as a parameter in the URL ?api_key=YOUR_API_KEY Data endpoints and /v1/auth/tokens; /v1/account/* rejects it with 400
The same request with a bearer token
curl -G "https://handelsregister.ai/api/v1/fetch-organization" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  --data-urlencode "q=Hetzner Online GmbH"

Create a bearer token

curl -X POST "https://handelsregister.ai/api/v1/auth/tokens/create" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "token_name": "CRM-Abgleich",
    "abilities": [
        "api:data",
        "account:read"
    ],
    "expires_at": "2027-12-31"
}'
Parameters
Name Type Description Example
token_nameBody stringrequired A name you recognize the token by, such as the name of your application.Limits: at most 255 characters CRM-Abgleich
abilitiesBody list of stringoptional The abilities as a list. If omitted, the token gets api:data for the data endpoints and account:read for the account endpoints. monitoring:manage allows changes to monitors.Default: ["*"] ["api:data","account:read"]
expires_atBody string (date-time)optional Expiry date in the future. If omitted, the token is valid until you revoke it. 2027-12-31
Ability
Ability Meaning
api:data Query data: company profiles, person profiles, Search & Export, documents and Signals. These endpoints accept any valid token.
account:read Read the account: balance, usage, credit subscription, API keys, monitors and webhook endpoints.
monitoring:manage Create, update, pause, resume and archive monitors, verify and test webhook endpoints, resend deliveries.
account:keys Manage API keys and webhook endpoints. Only the admin token has this ability.

Admin token

Action
Action API key Bearer token needs
Read the account (every GET under /v1/account) yes account:read
Manage monitors, verify and test webhook endpoints, resend deliveries yes account:read, monitoring:manage
Create and delete API keys no, only with the admin token account:keys
Create webhook endpoints, rotate the secret, enable, disable and archive them no, only with the admin token account:read, account:keys
Keep the admin token apart from your applications' keys. It belongs only in tools that manage credentials.

OAuth for AI agents

What
What URL
Metadata of the MCP server (protected resource) https://mcp.handelsregister.ai/.well-known/oauth-protected-resource
Metadata of the authorization server https://handelsregister.ai/.well-known/oauth-authorization-server
Register a client (Dynamic Client Registration) POST https://handelsregister.ai/oauth/register
Sign-in and consent https://handelsregister.ai/oauth/authorize
Get and refresh tokens POST https://handelsregister.ai/oauth/token
Revoke a token POST https://handelsregister.ai/oauth/revoke
Scope
Scope Meaning
mcp Use the tools of the MCP server. The token also works for the API's data endpoints.
api Use the API on your behalf: query data and read the account.
offline_access Stay connected while you are away (refresh token).

Protect your keys

If a key has leaked, delete it right away under Account › API keys. From that moment on, the API rejects requests with it.

Authentication errors

Status
Status Cause What you can do
400 api_key in the URL of a request to /v1/account/*. Send the key in the header x-api-key.
401 No credentials sent, or the key or token is invalid, deleted or expired. Check the header, compare the key under Account › API keys.
403 The account's email address is not confirmed yet. Open the confirmation link in the email.
403 The token lacks an ability, or an API key tries to manage credentials. Use a token with the right ability; for credentials, the admin token.
1{2  "error": "Unauthorized: Missing or invalid authentication. Please provide a valid API key (via x-api-key header or api_key parameter) or Bearer token."3}
401 · Example response without valid credentials