rate_limited
The message text is shown in the example below.
| HTTP status | 429 |
type | rate_limit_error |
| Retry? | Yes, with back-off after Retry-After |
| Status | In the public catalog (error-envelope.ts) |
| Extra fields | retry_after, retry_after_seconds |
When it happens
More than 600 requests in a minute for one API key (or one signed-in user).
Example
{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Too many requests. Retry shortly.",
"param": null,
"request_id": "req_6f1c2a9e0b7d4c3a8e5f1b2d",
"retry_after": 12,
"retry_after_seconds": 12
}
}How to fix it
- Wait
Retry-Afterseconds, then retry with jitter. - Smooth bursts with a client-side queue.
- Move bulk work to batches, which do not count against this limit.
Detect it in code
err = resp.json().get("error", {})
if resp.status_code == 429 and err.get("code") == "rate_limited":
delay = err.get("retry_after") or 2
time.sleep(delay) # then retryRelated
Was this page helpful?