Skip to content

Rate Limits ​

Sesamy APIs implement rate limiting to ensure fair usage and maintain service quality.

Rate Limit Overview ​

APIRequests per MinuteBurst Limit
Client API300500
Management API100200

Rate Limit Headers ​

All API responses include rate limit information in headers:

bash
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 275
X-RateLimit-Reset: 1698858900

Handling 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 ​

  1. Implement Exponential Backoff: Retry failed requests with increasing delays
  2. Cache Responses: Cache frequently accessed data
  3. Batch Requests: Combine multiple operations when possible
  4. 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:
                raise

Increasing Limits ​

Need higher rate limits? Contact support@sesamy.com to discuss your requirements.

Released under the MIT License.