Errors
Every error the check endpoint can return, what causes it, and what your code should do about it.
Error format
Section titled “Error format”An error answers with a 4xx or 5xx status and a JSON body with one error object:
{ "error": { "code": "rate_limited", "message": "Too many requests this second for this key. Retry in a second." }}codeis stable. Branch on it in code.messageis written for the developer reading a log. It can change, and it is not meant for your users.
Error codes
Section titled “Error codes”| Status | Code | Cause | What to do |
|---|---|---|---|
400 |
invalid_request |
Neither ip nor email was sent, a value is not a string or is longer than 320 characters, or the POST body is not a JSON object. |
Fix the request. |
400 |
invalid_ip |
ip is not a single IPv4 or IPv6 address. Ports, CIDR ranges and zone ids are refused. |
Send a bare address, or leave ip out. |
400 |
invalid_email |
email has no @, or no domain with a dot after it. |
Validate the address before you call. |
401 |
missing_api_key |
No key in Authorization: Bearer or x-api-key. |
Send the key. See Authentication. |
401 |
invalid_api_key |
The key does not exist or was revoked. | Check the key, or create a new one. |
402 |
subscription_required |
The account has no active subscription. | Start or renew the subscription in the dashboard. |
413 |
payload_too_large |
The request body is larger than 16 KB. | Send only ip and email. |
429 |
rate_limited |
The key went over its per-second limit, or this address sent too many requests with a missing or invalid key. | Wait for the time in Retry-After and retry. See Rate limits. |
503 |
lists_unavailable |
Heimdal has just started and has not loaded its lists yet. | Retry shortly. Let the signup through in the meantime. |
503 |
service_unavailable |
Something failed on Heimdal’s side, or it is restarting. | Retry shortly (after Retry-After, when sent). Let the signup through in the meantime. |
Messages
Section titled “Messages”These are the messages the API sends today. They read like this in your logs:
| Code | Message |
|---|---|
invalid_request |
Send ip, email, or both, as strings of at most 320 characters. |
invalid_ip |
ip must be one IPv4 or IPv6 address, without a port or zone. |
invalid_email |
email must be an address with a domain, like name@example.com. |
missing_api_key |
Send your API key in the Authorization header: Bearer hd_… |
invalid_api_key |
This API key is not valid. |
subscription_required |
This account has no active subscription. Start or renew one in the dashboard. |
rate_limited |
Too many requests this second for this key. Retry in a second. |
rate_limited |
Too many requests with a missing or invalid API key from this address. Retry later. |
payload_too_large |
Request body too large. |
lists_unavailable |
The lists are still loading. Retry shortly. |
service_unavailable |
The service is temporarily unavailable. Retry shortly. |
Order of checks
Section titled “Order of checks”A request is checked in this order, and the first failure is the answer:
- API key (
401, or429after too many bad keys from one address) - Subscription (
402) - Rate limit for the key (
429) - Input (
400) - Lists loaded (
503)
So a request with a bad key and a bad body answers 401, and a request refused with 400 has already counted toward the rate limit.
Handling errors
Section titled “Handling errors”Do not make a signup depend on Heimdal being reachable. On a timeout, a network error, a 429 or any 5xx, let the signup through and log what happened. A 401 or a 402 means your integration needs attention: let the signup through as well, and alert yourself. Best practices shows the pattern.
Limits
Section titled “Limits”Request rates per key and per address are on Rate limits.
| Limit | Value |
|---|---|
| Monthly quota | None |
Length of ip, email |
320 characters |
| Request body | 16 KB |
| Key and subscription changes | Take effect within 60 seconds |
| Access after a failed renewal | 3 days |
| Custom lists | 20 lists, 50,000 entries per account |
Subscription and grace period
Section titled “Subscription and grace period”The API answers while your subscription is active, the trial included. If a renewal payment fails, access continues for 3 days. After that every call answers 402 subscription_required until the subscription is active again.
A change to your subscription or your keys can take up to 60 seconds to reach the API. That covers a new subscription, a cancellation that takes effect, and a revoked key.
Degraded answers
Section titled “Degraded answers”Every check also reads your custom lists. If that read fails, Heimdal still answers 200 with every other signal and adds this header:
Heimdal-Degraded: custom_listscustom.matched is then empty and custom_list is missing from reasons, whether or not an entry would have matched. If your custom lists are essential to a decision, check for the header and treat the answer as incomplete.
Caching
Section titled “Caching”Every response carries Cache-Control: no-store. The Tor and proxy lists change every hour, and your custom lists change whenever you edit them, so do not keep an answer to reuse later. Check once, at the moment of the signup.
© 2026 CodeBrewerz. All rights reserved.
