What are the rate limits?
The Bags API implements rate limiting to ensure fair usage and system stability.
Rate Limit Details
- Limit: 1,000 requests per hour per user
- Scope: Rate limits apply across all your API keys (shared quota)
- Headers: Response headers include rate limit information
Monitoring Your Usage
Check these response headers to monitor your API usage:
X-RateLimit-Limit: Total requests allowed per hour (1,000)
X-RateLimit-Remaining: Requests remaining in current window
X-RateLimit-Reset: Unix timestamp when the limit resets
Example
const response = await fetch('https://public-api-v2.bags.fm/api/v1/endpoint', {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
console.log('Remaining:', response.headers.get('X-RateLimit-Remaining'));
console.log('Resets at:', new Date(
parseInt(response.headers.get('X-RateLimit-Reset')) * 1000
));
Distribute requests evenly throughout the hour to avoid hitting rate limits. Consider implementing exponential backoff for failed requests.
See the Rate Limits guide for more detailed information.