Understanding API rate limits and best practices
Rate limits protect the API from abuse and ensure fair usage across all customers. Each API key has a rate limit based on your subscription plan.
Rate limits are calculated per API key, per minute. If you need more capacity, you can create multiple API keys or upgrade your plan.
Every API response includes headers that tell you about your current rate limit status:
X-RateLimit-LimitYour total rate limit (requests per minute)
X-RateLimit-RemainingNumber of requests remaining in the current window
X-RateLimit-ResetSeconds until your rate limit resets
HTTP/1.1 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 32
Content-Type: application/jsonWhen you exceed your rate limit, you'll receive a 429 Too Many Requests response:
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 15
Retry-After: 15
{
"detail": "Rate limit exceeded. Limit: 60 requests per minute."
}Best Practice: When you receive a 429 response, wait for the number of seconds indicated in the Retry-After header before making another request.
If you hit a rate limit, wait before retrying. Increase the wait time exponentially with each retry.
async function fetchWithBackoff(url, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url);
if (response.status !== 429) return response;
const retryAfter = parseInt(response.headers.get('Retry-After') || '60');
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
}
}X-RateLimit-Remaining header and slow down requests proactively when approaching your limit.GET /products call instead of making individual requests for each product.