Rate Limits
Understanding and working with API rate limits.
speed
Rate Limits by Plan
| Plan | API Requests | CDN Requests | Bandwidth |
|---|---|---|---|
| Free | 100/min | 1,000/min | 1 GB/month |
| Starter | 500/min | 10,000/min | 20 GB/month |
| Pro | 2,000/min | 50,000/min | 100 GB/month |
| Enterprise | Custom | Custom | Custom |
info
CDN requests (image delivery) have much higher limits than API requests. Most applications primarily use CDN requests.
code
Rate Limit Headers
Every API response includes headers to help you track your rate limit status.
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per minute |
X-RateLimit-Remaining | Requests remaining in current window |
X-RateLimit-Reset | Unix timestamp when limit resets |
Retry-After | Seconds to wait (only when limited) |
Example Response Headers
HTTP/1.1 200 OK
X-RateLimit-Limit: 500
X-RateLimit-Remaining: 487
X-RateLimit-Reset: 1704067200tips_and_updates
Handling Rate Limits
429 Too Many Requests
When you exceed the rate limit, you'll receive a 429 response.
HTTP/1.1 429 Too Many Requests
Retry-After: 30
Content-Type: application/json
{
"error": "rate_limit_exceeded",
"message": "Too many requests. Please retry after 30 seconds.",
"retryAfter": 30
}Best Practices
Exponential Backoff
async function fetchWithRetry(url: string, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url);
if (response.status === 429) {
const retryAfter = parseInt(response.headers.get('Retry-After') || '1');
const backoff = retryAfter * 1000 * Math.pow(2, i);
await new Promise(resolve => setTimeout(resolve, backoff));
continue;
}
return response;
}
throw new Error('Max retries exceeded');
}