Rate Limiting
Understanding rate limits
To ensure fair usage and system stability, the API is rate-limited to 600 requests per minute per IP address.
Understanding Rate Limits
Each API response includes headers to help you track your rate limit status:
X-RateLimit-Limit: Total requests allowed per minute (600)X-RateLimit-Remaining: Requests remaining in the current windowX-RateLimit-Reset: Time when the rate limit resets (Unix timestamp)
Handling Rate Limits
If you exceed the rate limit, you'll receive a 429 Too Many Requests response. Here are some best practices:
- Monitor the headers: Check
X-RateLimit-Remainingin your responses - Implement backoff: When you get a 429, wait before retrying
- Cache when possible: Store responses that don't change frequently
- Use pagination efficiently: Request only the data you need
Example of handling rate limits in JavaScript:
async function makeRequest(url) {
const response = await fetch(url, {
headers: { Authorization: "Bearer YOUR_API_KEY" },
});
if (response.status === 429) {
// Rate limited - wait and retry
const resetTime = response.headers.get("X-RateLimit-Reset");
const waitTime = resetTime * 1000 - Date.now();
await new Promise((resolve) => setTimeout(resolve, waitTime));
return makeRequest(url); // Retry
}
return response.json();
}