Odds API rate limits
Odds API rate limits by plan: requests per minute, WebSocket connections, the rate limit headers on every response and how to handle a 429.
Rate limits are applied per account over a rolling 60-second window and shared by all of the account's keys. Limits are listed on Credits & billing.
Headers
X-RateLimit-Limit | Requests allowed per minute on your plan. |
X-RateLimit-Remaining | Requests left in the current window. |
X-RateLimit-Reset | Seconds until the window resets. |
Retry-After | Sent with 429 responses: seconds to wait before retrying. |
Handling 429s
Back off for the number of seconds in Retry-After, then retry. Rate-limited requests cost nothing.
retry.js
async function getWithRetry(url, key, attempts = 4) {
for (let i = 0; i < attempts; i++) {
const res = await fetch(url, { headers: { Authorization: `Bearer ${key}` } });
if (res.status !== 429 && res.status < 500) return res;
const wait = Number(res.headers.get('retry-after')) || 2 ** i;
await new Promise((r) => setTimeout(r, wait * 1000));
}
throw new Error('Gave up after retries');
}Staying under the limit
- Request several leagues or event ids in one call instead of one call per event.
- Cache reference data (leagues, sources, teams) — it rarely changes.
- Use the WebSocket stream for anything that refreshes faster than every few seconds.
Previous: Credits & billing · Next: Errors