Rate Limits¶
AMP enforces rate limits to ensure fair usage and system stability.
Overview¶
| Plan | Requests/Minute | Burst |
|---|---|---|
| Free | 60 | 10 |
| Pro | 300 | 50 |
| Enterprise | 1000+ | Custom |
Rate Limit Headers¶
Every response includes rate limit information:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per window |
X-RateLimit-Remaining | Requests remaining |
X-RateLimit-Reset | Unix timestamp when limit resets |
Rate Limit Response¶
When rate limited, you receive a 429 Too Many Requests:
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Retry after 45 seconds.",
"retry_after": 45
}
}
The Retry-After header is also included.
Endpoint-Specific Limits¶
Some endpoints have additional limits:
| Endpoint | Additional Limit |
|---|---|
POST /missions | 10/hour |
POST /content/*/regenerate | 20/hour |
POST /onboard | 5/hour |
GET /analytics/export | 5/hour |
Best Practices¶
Exponential Backoff¶
async function withRetry(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (error.code === 'rate_limit_exceeded') {
const delay = Math.min(1000 * Math.pow(2, i), 30000);
await sleep(delay);
} else {
throw error;
}
}
}
}
Request Batching¶
Instead of many small requests, batch operations:
// Instead of this
for (const id of ids) {
await client.content.approve(id);
}
// Do this
await client.content.bulkApprove(ids);
Caching¶
Cache responses when possible:
const cache = new Map();
async function getCachedMission(id) {
if (cache.has(id)) {
return cache.get(id);
}
const mission = await client.missions.get(id);
cache.set(id, mission);
return mission;
}
Requesting Limit Increase¶
Enterprise customers can request higher limits:
- Contact your account manager
- Provide use case details
- Specify required limits
- Allow 24-48 hours for approval
Monitoring Usage¶
View your current usage: