Operations
Rate limiting
The API can enforce a per-minute request budget. Read the rate-limit headers on every response and honor Retry-After when you are throttled.
Budgets
When usage rate limiting is enabled, default budgets are:
- 600 requests/minute per key
- 120 requests/minute per IP (used when the request can't be attributed to a key)
Separately, authentication attempts are limited to 10 per minute per IP to slow credential guessing (error 5209).
Headers
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Your budget for the window |
X-RateLimit-Remaining | Requests left in the window |
X-RateLimit-Reset | When the window resets |
Retry-After | On 429: seconds to wait before retrying |
Handling 429
Tip
When you get a
429, wait for the number of seconds in Retry-After before retrying, and add jitter if you run many workers. Watch X-RateLimit-Remaining to slow down before you hit the limit.async function call(url, opts) {
const res = await fetch(url, opts);
if (res.status === 429) {
const wait = Number(res.headers.get("Retry-After") || 1);
await new Promise(r => setTimeout(r, wait * 1000));
return call(url, opts);
}
return res.json();
}