Skip to main content

Error Codes

All error responses share the same JSON shape:

{
"error": "invalid_policy_number",
"message": "The policy number format is not recognised for the specified country.",
"code": 400
}

HTTP status codes

StatusMeaning
200Success
400Bad request — invalid input
401Unauthorised — missing or invalid API key
403Forbidden — API key lacks permission for this operation
404Not found — policy not found in registry
422Unprocessable — request is well-formed but semantically invalid
429Rate limit exceeded
500Internal server error

Error codes

error valueStatusDescription
invalid_policy_number400Policy number format not recognised for the specified country
missing_required_field400A required field (policy_number, country, or type) is absent
unsupported_country400Country code is not in the supported list
unsupported_insurance_type400Insurance type is not motor, travel, or health
unauthorized401Authorization header missing or key prefix invalid
invalid_api_key401API key not found or revoked
insufficient_credits402Verification credits exhausted for this billing period
insurer_not_found404Insurer not found in registry for the given country
policy_not_found404Policy number not found in registry
rate_limit_exceeded429Too many requests — see Rate Limits
internal_error500Unexpected server-side failure — retry with exponential backoff

Example: invalid API key

curl -X POST https://api.policynumbers.com/v1/verify \
-H "Authorization: Bearer bad_key" \
-H "Content-Type: application/json" \
-d '{"policy_number":"DE-KFZ-88821","country":"DE","type":"motor"}'
{
"error": "invalid_api_key",
"message": "The API key provided is invalid or has been revoked.",
"code": 401
}

Example: rate limit exceeded

{
"error": "rate_limit_exceeded",
"message": "You have exceeded your request limit. Retry after 47 seconds.",
"code": 429,
"retry_after": 47
}

When you receive a 429, check the Retry-After header and wait that many seconds before retrying. See Rate Limits for tier limits and backoff guidance.