These two limits are separate from feature allowances. Some features also have an allowance of their own, such as credential comparison reports, Attack Surface assessments and Infra search scans. Some resources have a fixed number of slots, such as monitors. Plans and quotas explains those. This page covers the two limits that every API-key request passes.
How the two limits compare
Both limits count per organization, and all of an organization’s API keys share them. A key created for a client workspace counts toward that workspace’s limits, not yours. Dashboard requests have a per-second budget of their own, separate from API-key requests. The sources that a wide search queries draw on the dashboard budget, so heavy dashboard use can make a source report
quota_exceeded.
The per-second rate limit
The rate limit allows a fixed number of requests per second for each organization. DarknetSearch sets the number, and it is the same on every plan. Read it from theX-RateLimit-Limit header of a response whose X-RateLimit-Reset is 1.
- Every request counts. That includes requests that end in a
4xxor5xxfrom the endpoint. Failed requests are not refunded from this count, so a loop of failing requests still uses up the second. - Rejected requests do not count. A request the limit rejects with
429is not added to the count. - Some refusals come first. A
401, or a403for an inactive license or a feature outside your plan, is returned before the limit is checked. It does not count.
429 with Retry-After: 1. The window starts again one second later.
The API Calls allowance
Every request made with an API key draws one unit from your organization’s monthly API Calls allowance. That covers searches, status polls, result pages, downloads and usage reads alike.- Only
2xxresponses count. The unit is taken when the request arrives. If the response is any other status, the unit is refunded, so a400,404,409,429or5xxuses no API call. - The window is the calendar month in UTC. The count resets to zero at 00:00 UTC on the 1st. Unused calls do not carry over.
- Your plan sets the size. Extra API calls packs, bought in the dashboard, add to the plan’s allowance every month while they are active. A pack counts as soon as its invoice is paid. Plans and quotas explains how allowances and packs work.
- Your plan must include API Calls to create a key. See Authentication.
429 is not a 2xx, so the API call is refunded.
To see how much of the month’s allowance is left, open Manage → Usage in the dashboard. Org Admins, System Admins and System Users can open it. Plans and quotas describes the page. The X-RateLimit-* headers also switch to the API Calls allowance when it is close to running out.
Read the X-RateLimit headers
Responses carry three headers that describe one of your limits:
The headers describe whichever limit has the fewest requests left. Usually that is the per-second window, and
X-RateLimit-Reset reads 1. When fewer API calls remain in the month than requests remain in the current second, the headers switch to the API Calls allowance:
2xx, endpoint errors and the 429 from the limit itself. On that 429 they describe the limit you hit. They are absent on 401 and on the 403 refusals that come before the limit check.
When you exceed a limit
Both limits answer with429 Too Many Requests and the same message. The body tells you which one you hit.
Per-second rate limit. Wait one second, then retry.
limit, remaining and reset_at. Retry-After and retry_after_seconds count down to the reset, which can be weeks away.
limit is your monthly allowance, packs included. reset_at is the moment the allowance resets, 00:00 UTC on the 1st. The timestamp can read a fraction of a second earlier. Every request made with any of your organization’s keys gets this response until then, unless an extra API calls pack raises the allowance first.
A third 429 comes from a feature allowance, not from the rate limits on this page. Tell them apart by the body:
A feature allowance
429 has no Retry-After header. Any other 429 body comes from the service behind the endpoint, and that endpoint’s guide describes it. Errors lists every error the API returns.
Review past API activity
get_api_call_usage returns your organization’s request counts for a range of months, split by day and by HTTP status code. Use it to see trends, error rates and 429 counts over time.
Availability: every plan with a license in force.
Cost: 1 unit of your monthly API Calls allowance, like any request. The unit is refunded if the response is not a 2xx.
Pass the first and last month as YYYYMM. Both are required, and the range is inclusive.
- It counts all of your organization’s traffic. API-key requests and dashboard requests are counted together, with every status code,
403and429included. Requests rejected with401are not recorded. The2xxcount can therefore be higher than the API Calls you used. - It is activity history, not your balance. For the API Calls left this month, see Manage → Usage in the dashboard, as described in The API Calls allowance. The
X-RateLimit-*headers switch to the allowance only when it is almost used up. - It updates once a day. The most recent day can be missing or incomplete until the next daily update.
- Days are counted in UTC. Months with no recorded requests are left out of
months.
It has no plan feature check, no feature allowance and no capacity limit.
Best practices
1
Pace requests below the per-second limit
All of your organization’s keys share one per-second budget. Send requests from one shared queue rather than from many workers that each send at full speed. When
X-RateLimit-Remaining reaches 0 and X-RateLimit-Reset reads 1, pause until the next second.2
Back off on a per-second 429
Wait the
Retry-After seconds, then retry the same request. If the next attempt also returns 429, double the wait each time up to a few seconds, and add a little random delay so parallel workers do not retry in step.3
Stop on an allowance 429
A
429 with reset_at means the month’s API Calls are used up. Queue the work until reset_at instead of retrying in a loop. A 429 with resource means a feature allowance is used up. Retrying cannot succeed until the allowance resets or a pack is added.4
Poll asynchronous jobs at a steady interval
Each status poll that returns
200 uses one API call. Poll every 10 to 30 seconds, or at the interval the job’s guide recommends, and stop at the first terminal status. A job polled every 10 seconds for 20 minutes uses 120 API calls.5
Budget the month
Count every call a workflow makes. A search that creates a job, polls 30 times and reads 5 result pages uses 36 API calls. Request larger pages where an endpoint allows it, since one page is one call. Cache results and reuse them instead of repeating the same search.
6
Watch usage before it runs out
Read
X-RateLimit-Reset on your responses. When it reads more than 1, the API Calls allowance is now the tighter limit and X-RateLimit-Remaining is the number of calls left this month. Use get_api_call_usage to review trends and error rates over past months.