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:| Header | Description |
|---|---|
x-ratelimit-limit | Total number of requests allowed in the current time window |
x-ratelimit-remaining | Number of requests remaining in the current time window |
x-ratelimit-reset | Number of seconds until the rate limit resets |
retry-after | If the limit has been reached, how many seconds the client must wait before making new requests |
Example Headers
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:Best practices for handling rate limits
- Always check
x-ratelimit-remainingbefore making requests. - Respect the
retry-afterheader to avoid being blocked. - Implement exponential backoff or request queuing.
- Cache responses when possible to reduce unnecessary requests.