Skip to main content

Overview

APIs often enforce rate limits to prevent abuse and ensure stability. This section explains how rate limits work, the relevant headers, and how to handle cases when the limit is exceeded.

Rate limit Headers

The API provides the following headers in each response to help you manage your request quota:
HeaderDescription
x-ratelimit-limitTotal number of requests allowed in the current time window
x-ratelimit-remainingNumber of requests remaining in the current time window
x-ratelimit-resetNumber of seconds until the rate limit resets
retry-afterIf the limit has been reached, how many seconds the client must wait before making new requests

Example Headers

x-ratelimit-limit: 1000
x-ratelimit-remaining: 999
x-ratelimit-reset: 120
retry-after: 0

When the limit is reached

If you exceed the allowed number of requests, the API responds with HTTP 429 Too Many Requests.

Example Response

Headers:
x-ratelimit-limit: 1000
x-ratelimit-remaining: 0
x-ratelimit-reset: 120
retry-after: 119
Body:
{
  "error": "Too Many Requests",
  "error_description": "Rate limit exceeded, retry in 119 seconds"
}

Best practices for handling rate limits

  • Always check x-ratelimit-remaining before making requests.
  • Respect the retry-after header to avoid being blocked.
  • Implement exponential backoff or request queuing.
  • Cache responses when possible to reduce unnecessary requests.