Rate limiting

Per-key rate limits, standard headers, and how to handle 429s.

Requests are rate limited per API key using a fixed one-minute window.

Headers

Every response includes:

HeaderDescription
X-RateLimit-LimitMax requests allowed in the window
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp when the window resets

Handling 429

When you exceed the limit you receive 429 with a Retry-After header (seconds):

{ "error": { "code": "rate_limited", "message": "Rate limit exceeded..." } }

Back off and retry after the indicated delay. A simple strategy:

async function withRetry(fn, max = 5) {
  for (let i = 0; i < max; i++) {
    const res = await fn();
    if (res.status !== 429) return res;
    const wait = Number(res.headers.get("Retry-After") || 1) * 1000;
    await new Promise((r) => setTimeout(r, wait));
  }
  throw new Error("Rate limit: retries exhausted");
}

Idempotency

For POST requests, send an Idempotency-Key header so safe retries never create
duplicates - the original response is replayed.


Did this page help you?