Skip to main content

Overview

To ensure fair usage and system stability, the API enforces rate limits. We implement a leaky bucket algorithm to limit the number of requests per second. The current rate limits are configured as follows:
  • Rate: 30 requests per second (You can make up to 30 requests per second on average)
  • Burst: 60 requests (You have a burst capacity of 60 requests that can be used when needed)
  • Period: 1 second (The rate limit window resets every 1 second)
This allows for short bursts above the average rate (up to 60 requests) while maintaining a steady average rate of 30 requests per second over time. If you exceed the burst capacity, requests will be rate limited until capacity becomes available again.

Handling Rate Limits

If you encounter rate limit errors, implement exponential backoff in your client applications. This means:
  1. When you receive a rate limit error, wait before retrying
  2. Gradually increase the wait time between retries
  3. Continue until the request succeeds or a maximum retry limit is reached

Example Rate Limit Response

When rate limited, the API will return an error response indicating the limit has been exceeded. The response includes detailed information about the rate limit status in the extensions field:
{
  "errors": [
    {
      "message": "Rate limit exceeded....",
      "extensions": {
        "code": "RATE_LIMIT_EXCEEDED"
      }
    }
  ],
  "data": {
    "account": null
  },
  "extensions": {
    "rateLimit": {
      "requestRate": 20,
      "remaining": 40,
      "retryAfterMs": 377,
      "resetAfterMs": 19377
    }
  }
}
The extensions.rateLimit object provides:
  • requestRate: The current request rate (requests per time window)
  • remaining: Number of requests remaining in the current window
  • retryAfterMs: Milliseconds to wait before retrying the request
  • resetAfterMs: Milliseconds until the rate limit window resets

Best Practices

  • Cache requests: Cache frequently accessed requests to minimize the number of API requests
  • Monitor usage: Track your API usage using the extensions.rateLimit field in API responses to stay within limits