Rate limits and usage
How your limits work, which calls count against them, and how to read your usage and handle a 429.
Limits keep the service fast for everyone. They belong to your account and are set by your plan. Test and live calls are counted separately, so building in test mode never uses up your live allowance. Read your numbers from the usage endpoints, rather than writing them into your code.
What is limited
Each API limits requests a minute, and new searches a minute.
Flights Search API
| Limit | What counts |
|---|---|
requests_per_minute | Every call with a key. |
new_trips_per_minute | Every search call (GET or POST /v1/flights/search) without a cursor, even when a stored answer serves it. |
Hotels Search API
| Limit | What counts |
|---|---|
requests_per_minute | Every call with a key. |
new_searches_per_minute | Every search or rates call, even when a stored answer serves it. |
search_reads_per_minute | Reading a search again by its search_id. When your plan sets it, it sits below the request limit, so polling can't use up all your requests. |
What doesn't count as a new search
Reading a search by its search_id, and paging with cursor, never counts as a new search. So the cheapest way to collect results is to search once, then read that search.
Over a limit
Over any limit, the answer is 429 rate_limited, with retry: "after".
Separately, the service has a limit on the new searches it can start for everyone at once. When that is reached, a new search answers 503 search_capacity. Trips searched recently still answer.
Headers
Every answer to a key we accept carries:
| Header | Meaning |
|---|---|
RateLimit-Limit | Requests you may make a minute. |
RateLimit-Remaining | Requests left in the current minute. |
RateLimit-Reset | Seconds until the minute starts again. |
X-Request-Id | Names this request. |
Retry-After | On 429 and 503: seconds to wait. |
Handle a 429
Wait for Retry-After seconds (the same number as error.retry_after_s), then try again. Don't retry at once in a loop: requests over the limit still count as errors. The sample in Errors does this for you.
Read your usage
Each API has a usage endpoint that reports your limits and what you have used:
curl https://api.voyagelabs.ai/v1/flights/usage \
-H "X-API-Key: $VOYAGE_LABS_API_KEY"{
"data": {
"key": { "id": "key_2c4b3dc27e82", "name": "Docs local test", "mode": "test" },
"limits": { "requests_per_minute": 1200, "new_trips_per_minute": 200 },
"this_minute": { "requests": 15, "new_trips": 9 },
"today": { "requests": 22, "answered_from_memory": 8, "new_trips": 9, "errors": 7 },
"partner": {
"id": "prt_ef6091cb3df6",
"tier": "tier_standard_v1",
"active_streams": 0,
"today": { "requests": 22, "answered_from_memory": 8, "new_trips": 9, "errors": 7 }
}
},
"meta": { "request_id": "req_47aaa0fad039", "mode": "test" }
}keynames the key that made the call. It never includes the key itself.this_minutecounts from the start of the current minute.todaycounts this key since midnight UTC.errorsincludes requests refused for being over a limit.partneris your account: its plan (tier) and its totals today across all its keys.
The hotels endpoint, GET /v1/hotels/usage, answers the same way for its own calls, with new_searches in place of new_trips. Its limits also has search_reads_per_minute, which is null when only requests_per_minute applies, and it has no partner block. See the reference for flights and hotels.
The console shows the same numbers over time, with a log of your recent requests.