Rate Limiting
This guide explains the rate limiting policies for the RUE API and provides strategies for working within these limits.
Rate Limit Overview
To ensure fair usage and maintain the quality of our service, we implement rate limiting on API requests. The specific limits depend on your subscription plan:
- Basic Plan: 100 requests per minute
- Pro Plan: 500 requests per minute
- Enterprise Plan: Custom limits (contact sales for details)
Rate Limit Headers
Each API response includes headers to help you track your rate limit usage:
X-RateLimit-Limit
: Your total request limitX-RateLimit-Remaining
: The number of requests left for the current time windowX-RateLimit-Reset
: The time at which the current rate limit window resets (in UTC epoch seconds)
Handling Rate Limit Errors
If you exceed your rate limit, the API will return a 429 Too Many Requests error. Here's an example of how to handle this error:
const axios = require('axios');
async function makeApiRequest() {
try {
const response = await axios.get('https://api.rue.ai/v1/some_endpoint', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
console.log('Success:', response.data);
} catch (error) {
if (error.response && error.response.status === 429) {
const resetTime = error.response.headers['x-ratelimit-reset'];
const waitTime = Math.ceil((resetTime * 1000 - Date.now()) / 1000);
console.log(`Rate limit exceeded. Try again in ${waitTime} seconds.`);
} else {
console.error('Error:', error.message);
}
}
}
makeApiRequest();
Best Practices for Managing Rate Limits
- Implement exponential backoff and retry logic for rate limit errors
- Cache API responses when possible to reduce the number of requests
- Use bulk endpoints when available to reduce the number of individual requests
- Monitor your usage and adjust your request patterns if you're consistently hitting limits
- Consider upgrading your plan if you regularly need more requests
Requesting Higher Rate Limits
If you need higher rate limits, consider upgrading your plan or contacting our sales team for a custom Enterprise solution. We can work with you to determine the appropriate limits for your use case.
For more information on our pricing plans and rate limits, please visit our Pricing page. If you have any questions about rate limiting, don't hesitate to reach out to our support team.