Rate Limits

Rate Limits

Understand request limits and how to handle rate limiting gracefully in your applications.

Rate Limit Overview

Rate limits vary by plan to ensure fair usage across all users.

When you exceed your rate limit, you'll receive a 429 status code with a Retry-After header indicating when you can retry your request.

Retry-After: 60

The value is in seconds. Wait this duration before retrying.

Handling Rate Limits

Best practices for implementing retry logic with exponential backoff.

async function makeRequestWithRetry(url, options, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const response = await fetch(url, options);
      
      if (response.status === 429) {
        const retryAfter = response.headers.get('Retry-After');
        const delay = retryAfter ? parseInt(retryAfter) * 1000 : Math.pow(2, i) * 1000;
        
        if (i < maxRetries - 1) {
          await new Promise(resolve => setTimeout(resolve, delay));
          continue;
        }
      }
      
      return response;
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      await new Promise(resolve => setTimeout(resolve, Math.pow(2, i) * 1000));
    }
  }
}

Best Practice: Implement exponential backoff when receiving 429 responses. Start with the Retry-After header value, then double the delay for each subsequent retry.

Tip: Always respect the Retry-After header value when provided. It tells you exactly when the rate limit will reset.

Plan Limits

Rate limits are based on your subscription plan. Higher-tier plans have higher rate limits. Check your plan details in the billing dashboard.