Rate Limits
FHIRfly uses rate limiting to ensure fair usage and maintain service quality for all users.
Default Limits
| Plan | Rate Limit | Monthly Quota |
|---|---|---|
| Free | 10 req/sec | 10,000 requests |
| Developer | 50 req/sec | 100,000 requests |
| Pro | 100 req/sec | 250,000 requests |
| Business | 200 req/sec | 500,000 requests |
| Enterprise | Custom | Custom |
See our Pricing page for full plan details.
Rate Limit Headers
Every API response includes headers showing your current rate limit status:
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 115
X-RateLimit-Reset: 1704067200
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per minute |
X-RateLimit-Remaining | Requests remaining in current window |
X-RateLimit-Reset | Unix timestamp when the window resets |
Handling Rate Limits
When you exceed your rate limit, the API returns a 429 Too Many Requests response:
{
"error": "rate_limit_exceeded",
"error_description": "Rate limit exceeded. Try again in 45 seconds.",
"retry_after": 45
}
Best Practices
- Implement exponential backoff - Wait longer between retries
- Use batch endpoints - Fetch multiple items in one request
- Cache responses - NDC and NPI data changes infrequently
- Monitor the headers - Slow down before hitting limits
Example: Exponential Backoff
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || Math.pow(2, i);
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
continue;
}
return response;
}
throw new Error('Max retries exceeded');
}
Batch Requests
Use batch endpoints to fetch multiple items efficiently:
curl -X POST "https://api.fhirfly.io/v1/ndc/_batch" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"codes": ["0069-0151-01", "0069-0152-01", "0069-0153-01"]}'
Batch requests count as 1 request toward your rate limit, regardless of how many items you fetch.
Quota Management
Track your monthly usage in the Dashboard. You'll receive email alerts at:
- 80% of quota used
- 90% of quota used
- 100% of quota used (requests will be rejected)
Need Higher Limits?
Contact us for enterprise plans with custom rate limits and dedicated support.