Rate Limits
Understanding API rate limits and how to handle throttling
Overview
How rate limits work on the AXIFI API
The AXIFI API uses rate limiting to ensure fair access and optimal performance for all users. Rate limits are applied based on your API key and measured in requests per time window.
Per Endpoint
Different limits for different endpoints
Rolling Window
Limits reset based on time windows
Burst Allowed
Higher limits for hourly usage
Endpoint Rate Limits
Per-endpoint rate limits by tier
| Endpoint | Per Minute | Time Window | Hourly Burst |
|---|---|---|---|
Compounds Search POST /v1/compounds/search | 100 requests | 1 minute | 500 requests/hour |
Get Compound GET /v1/compounds/{slug} | 200 requests | 1 minute | 1000 requests/hour |
Batch Compounds POST /v1/batch/compounds | 50 requests | 1 minute | 250 requests/hour |
Chat Completions POST /v1/chat/completions | 50 requests | 1 minute | 300 requests/hour |
Chat Streaming POST /v1/chat/stream | 50 requests | 1 minute | 300 requests/hour |
Semantic Search POST /v1/search | 200 requests | 1 minute | 1000 requests/hour |
Documents GET /v1/documents | 100 requests | 1 minute | 500 requests/hour |
Monographs GET /v1/monographs | 100 requests | 1 minute | 500 requests/hour |
Bio-Age Calculator POST /v1/tools/bioage/calculate | 30 requests | 1 minute | 200 requests/hour |
Bloodwork Analysis POST /v1/tools/bloodwork/analyze | 20 requests | 1 minute | 150 requests/hour |
InBody Analysis POST /v1/tools/inbody/analyze | 30 requests | 1 minute | 200 requests/hour |
Drug Interaction Check POST /v1/tools/interactions/check | 50 requests | 1 minute | 300 requests/hour |
Macro Calculator POST /v1/tools/macros/calculate | 50 requests | 1 minute | 300 requests/hour |
Nutrition Analyzer POST /v1/tools/nutrition/analyze | 50 requests | 1 minute | 300 requests/hour |
Peptide Stack Builder POST /v1/tools/peptide-stack/build | 20 requests | 1 minute | 100 requests/hour |
Protocol Builder POST /v1/tools/protocol/build | 10 requests | 1 minute | 50 requests/hour |
API Keys GET/POST /v1/api-keys | 30 requests | 1 minute | 100 requests/hour |
Webhooks GET/POST /v1/webhooks | 30 requests | 1 minute | 100 requests/hour |
Response Headers
Rate limit information in response headers
Every API response includes headers with rate limit information:
X-RateLimit-Limit
Maximum number of requests allowed in the time window
X-RateLimit-Remaining
Number of requests remaining in the current window
X-RateLimit-Reset
Unix timestamp when the rate limit window resets
Retry-After
Seconds to wait before retrying (sent when rate limited)
Handling Rate Limits
Best practices for handling 429 responses
Exponential Backoff Strategy
// Implement exponential backoff
async function makeRequestWithRetry(url, options, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
try {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = parseInt(response.headers.get('Retry-After'));
const delay = retryAfter ? retryAfter * 1000 : Math.pow(2, attempt) * 1000;
await new Promise(resolve => setTimeout(resolve, delay));
continue;
}
return response;
} catch (error) {
if (attempt === maxRetries - 1) throw error;
const delay = Math.pow(2, attempt) * 1000;
await new Promise(resolve => setTimeout(resolve, delay));
}
}
}
Monitor Rate Limit Headers
// Monitor remaining requests before hitting the limit
const response = await fetch(url, options);
const remaining = parseInt(response.headers.get('X-RateLimit-Remaining'));
const limit = parseInt(response.headers.get('X-RateLimit-Limit'));
if (remaining / limit < 0.1) {
console.warn('Approaching rate limit threshold!');
// Implement backoff or queue additional requests
}
Queue Requests
For high-volume applications, implement a request queue to smooth out traffic and stay within limits.
Increasing Your Limits
Contact us for higher rate limits
If your application requires higher rate limits, contact our support team. We can discuss your use case and potentially increase your limits based on your subscription tier and business requirements.
support@axifi.ai