Rate Limits

Understanding and working with API rate limits.

speed

Rate Limits by Plan

PlanAPI RequestsCDN RequestsBandwidth
Free100/min1,000/min1 GB/month
Starter500/min10,000/min20 GB/month
Pro2,000/min50,000/min100 GB/month
EnterpriseCustomCustomCustom
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.

HeaderDescription
X-RateLimit-LimitMaximum requests per minute
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when limit resets
Retry-AfterSeconds to wait (only when limited)
Example Response Headers
HTTP/1.1 200 OK
X-RateLimit-Limit: 500
X-RateLimit-Remaining: 487
X-RateLimit-Reset: 1704067200
tips_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');
}