Rate Limits

Understand rate limits, quotas, and how to handle 429 responses.

Rate limits

AllToken enforces rate limits to ensure fair usage across all users. Limits are applied per API key and vary by account plan.

If you exceed a rate limit, the API returns 429 Too Many Requests. Implement exponential backoff in your retry logic:

TypeScript
1async function withRetry(fn, maxRetries = 3) {
2 for (let i = 0; i < maxRetries; i++) {
3 try {
4 return await fn();
5 } catch (err) {
6 if (err.status === 429 && i < maxRetries - 1) {
7 await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000));
8 continue;
9 }
10 throw err;
11 }
12 }
13}

Rate limit headers

Rate limit information is included in response headers:

  • x-ratelimit-limit — maximum requests per window
  • x-ratelimit-remaining — remaining requests in the current window
  • x-ratelimit-reset — timestamp when the window resets