Rate Limits
To ensure fair usage and maintain API performance for all users, the Enhancv API implements rate limiting.
Current Limits
| Plan | Requests per Minute | Requests per Hour | Requests per Day |
|---|---|---|---|
| Business | 60 | 1,000 | 10,000 |
These limits apply per API key. If you need higher limits, please contact our support team.
Rate Limit Headers
Every API response includes rate limit information in the headers:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58
X-RateLimit-Reset: 1640000000
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in the current window |
X-RateLimit-Remaining | Number of requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp when the rate limit resets |
Rate Limit Exceeded
When you exceed the rate limit, you'll receive a 429 Too Many Requests response:
{
"error": "Rate limit exceeded. Please try again later.",
"status": 429,
"retryAfter": 30
}
The retryAfter field indicates how many seconds you should wait before retrying.
Best Practices
1. Monitor Rate Limit Headers
Always check the rate limit headers in your responses to avoid hitting limits:
const response = await fetch('https://api.enhancv.com/api/v1/resumes', {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
const remaining = response.headers.get('X-RateLimit-Remaining');
const reset = response.headers.get('X-RateLimit-Reset');
console.log(`Remaining requests: ${remaining}`);
console.log(`Resets at: ${new Date(reset * 1000)}`);
2. Implement Exponential Backoff
When you receive a 429 error, wait before retrying:
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url, options);
if (response.status !== 429) {
return response;
}
const retryAfter = parseInt(response.headers.get('Retry-After') || '60');
const waitTime = Math.min(retryAfter * Math.pow(2, i), 300); // Max 5 minutes
console.log(`Rate limited. Waiting ${waitTime}s before retry...`);
await new Promise(resolve => setTimeout(resolve, waitTime * 1000));
}
throw new Error('Max retries exceeded');
}
3. Batch Operations
Instead of making individual requests, batch your operations when possible:
// ❌ Bad: Multiple sequential requests
for (const resumeId of resumeIds) {
await downloadResume(resumeId);
}
// ✅ Good: Parallel requests with rate limit awareness
const batchSize = 10;
for (let i = 0; i < resumeIds.length; i += batchSize) {
const batch = resumeIds.slice(i, i + batchSize);
await Promise.all(batch.map(id => downloadResume(id)));
// Add delay between batches
if (i + batchSize < resumeIds.length) {
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
4. Cache Responses
Cache responses on your end to reduce unnecessary API calls:
const cache = new Map();
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
async function getCachedResumes() {
const cached = cache.get('resumes');
if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
return cached.data;
}
const response = await fetch('https://api.enhancv.com/api/v1/resumes', {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
const data = await response.json();
cache.set('resumes', { data, timestamp: Date.now() });
return data;
}
5. Use Pagination Wisely
Don't request more data than you need:
// ❌ Bad: Requesting all resumes at once
const allResumes = await fetch('https://api.enhancv.com/api/v1/resumes?limit=100');
// ✅ Good: Request only what you need
const recentResumes = await fetch('https://api.enhancv.com/api/v1/resumes?limit=10');
Monitoring Usage
Track your API usage to avoid unexpected rate limits:
class APIClient {
constructor(apiKey) {
this.apiKey = apiKey;
this.requestCount = 0;
this.requestWindow = Date.now();
}
async request(url, options = {}) {
// Reset counter every minute
const now = Date.now();
if (now - this.requestWindow > 60000) {
this.requestCount = 0;
this.requestWindow = now;
}
this.requestCount++;
if (this.requestCount > 50) { // Buffer below limit
console.warn('Approaching rate limit');
}
return fetch(url, {
...options,
headers: {
'Authorization': `Bearer ${this.apiKey}`,
...options.headers
}
});
}
}
Need Higher Limits?
If your use case requires higher rate limits:
- Contact our support team at support@enhancv.com
- Describe your use case and expected request volume
- We'll work with you to find a suitable solution
Enterprise customers can get custom rate limits tailored to their needs. Contact sales for more information.