Rate Limits
To ensure fair usage and maintain service quality, the MagicSlides API implements rate limiting on all endpoints.
Default Limits
Plan
Rate Limit
Free Tier
10 requests per hour
Basic
100 requests per hour
Professional
1,000 requests per hour
Enterprise
Custom limits available
Rate Limit Headers
Each API response includes headers that provide information about your current rate limit status:
X-RateLimit-Limit
Maximum number of requests allowed per hour
X-RateLimit-Remaining
Number of requests remaining in the current time window
X-RateLimit-Reset
Unix timestamp when the rate limit will reset
Rate Limit Response
When you exceed the rate limit, the API will return a 429 Too Many Requests response:
{
"success": false,
"error": "Rate limit exceeded",
"code": "RATE_LIMIT_ERROR",
"reset_at": 1678945200
}
Best Practices
- Implement exponential backoff when retrying failed requests
- Cache API responses when possible
- Monitor your rate limit status using response headers
- Consider upgrading your plan if you consistently hit rate limits
Example Implementation
import axios from 'axios';
const api = axios.create({
baseURL: 'https://magicslides-tools-api.onrender.com/public/api'
});
api.interceptors.response.use(
response => response,
error => {
if (error.response?.status === 429) {
const resetTime = error.response.headers['x-ratelimit-reset'];
const waitTime = Math.max(resetTime - Date.now() / 1000, 0);
console.log(`Rate limit exceeded. Retry after ${Math.ceil(waitTime)} seconds`);
// Implement retry logic here
return new Promise(resolve => {
setTimeout(() => {
resolve(api(error.config));
}, (waitTime + 1) * 1000);
});
}
return Promise.reject(error);
}
);
Enterprise Solutions
For enterprise customers with high-volume requirements, we offer custom rate limits and dedicated infrastructure. Please contact our sales team to discuss your specific needs.