Guide
Rate limits
300 requests per minute per key, with headers.
Limits
Each key may make 300 requests per minute (sliding window). Every authenticated response tells you where you stand:
| Header | Meaning |
|---|---|
| X-RateLimit-Limit | Requests allowed per minute |
| X-RateLimit-Remaining | Requests left in the current window |
| X-RateLimit-Reset | Unix time when the oldest request leaves the window |
| Retry-After | On 429 only: seconds to wait |
Back off politely
On 429 or 5xx, wait and retry with exponential back-off:
javascript
async function call(url, init, tries = 5) {
for (let i = 0; ; i++) {
const res = await fetch(url, init);
if (res.status !== 429 && res.status < 500 || i === tries - 1) return res;
const wait = Number(res.headers.get("retry-after")) || 2 ** i;
await new Promise((r) => setTimeout(r, wait * 1000));
}
}python
import time, requests
def call(method, url, tries=5, **kw):
for i in range(tries):
res = requests.request(method, url, timeout=30, **kw)
if res.status_code != 429 and res.status_code < 500 or i == tries - 1:
return res
time.sleep(float(res.headers.get("Retry-After", 2 ** i)))