API Rate Limits
Rate limiting protects the API from abuse and ensures fair usage for all clients.
Rate Limit Tiers
| Tier | Requests per Minute | Notes |
|---|---|---|
| Starter | 60 | Default for all API keys |
| Growth | 300 | For high-volume integrations |
| Enterprise | 1,000 | Custom enterprise plans |
Rate Limit Headers
Every API response includes rate limit information:
| Header | Description |
|---|---|
X-RateLimit-Limit |
Maximum requests allowed per window |
X-RateLimit-Remaining |
Requests remaining in current window |
X-RateLimit-Reset |
Unix timestamp when the window resets |
Handling 429 Errors
When 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: 1703123456
Retry-After: 45
{
"error": {
"statusCode": 429,
"message": "Rate limit exceeded. Try again in 45 seconds."
}
}
Best Practices
- Check headers - Monitor
X-RateLimit-Remainingto avoid hitting limits - Use Retry-After - Wait the specified seconds before retrying
- Implement exponential backoff - If retries fail, increase wait time
- Cache responses - Reduce API calls by caching frequently-accessed data
- Batch requests - Use bulk endpoints when available
Example: Handling Rate Limits
async function fetchWithRateLimit(url, options) {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || 60;
console.log(`Rate limited. Waiting ${retryAfter} seconds...`);
await sleep(retryAfter * 1000);
return fetchWithRateLimit(url, options); // Retry
}
return response;
}
Need Higher Limits?
Contact support@getdemi.co to discuss growth or enterprise rate limit tiers.