Rate Limits
Sesamy APIs implement rate limiting to ensure fair usage and maintain service quality.
Rate Limit Overview
| API | Requests per Minute | Burst Limit |
|---|---|---|
| Client API | 300 | 500 |
| Management API | 100 | 200 |
Rate Limit Headers
All API responses include rate limit information in headers:
bash
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 275
X-RateLimit-Reset: 1698858900Handling Rate Limits
When you exceed the rate limit, you'll receive a 429 Too Many Requests response:
json
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Please retry after 60 seconds.",
"retry_after": 60
}
}Best Practices
- Implement Exponential Backoff: Retry failed requests with increasing delays
- Cache Responses: Cache frequently accessed data
- Batch Requests: Combine multiple operations when possible
- Monitor Usage: Track your API usage to avoid hitting limits
Example Implementation
typescript
async function makeRequestWithRetry(fn: () => Promise<any>, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (error.statusCode === 429 && i < maxRetries - 1) {
const delay = Math.pow(2, i) * 1000;
await new Promise(resolve => setTimeout(resolve, delay));
} else {
throw error;
}
}
}
}python
import time
def make_request_with_retry(fn, max_retries=3):
for i in range(max_retries):
try:
return fn()
except SesamyError as e:
if e.status_code == 429 and i < max_retries - 1:
delay = 2 ** i
time.sleep(delay)
else:
raiseIncreasing Limits
Need higher rate limits? Contact support@sesamy.com to discuss your requirements.