Rate limits
Reading limit responses
Use x-ratelimit-* and Retry-After together with error.retryable.
Overview
Successful and throttled responses may include standard rate-limit headers. On 429, also read retry-after.
| Field | Required | Description |
|---|---|---|
| x-ratelimit-limit | No | Max requests in the current window for the applied bucket |
| x-ratelimit-remaining | No | Requests left before the next 429 from this bucket |
| x-ratelimit-reset | No | Unix timestamp (seconds) when the window resets |
| retry-after | No | Seconds to wait (set when status is 429) |
JSON body
json
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Please retry shortly.",
"retryable": true
}
}Client snippet
javascript
const res = await fetch(url, { headers });
const limit = res.headers.get("x-ratelimit-limit");
const remaining = res.headers.get("x-ratelimit-remaining");
const reset = res.headers.get("x-ratelimit-reset");
if (res.status === 429) {
const retryAfterSec = Number(res.headers.get("retry-after") || "1");
// sleep retryAfterSec, then retry
}Always branch on error.code as well—some rate-limit responses may omit headers. See Rate limit errors.