What are Rate Limits?
Rate limits determine how frequently you can call an API. Rate limits are currently placed at a generous level, and should not impact you negatively under normal circumstances. However, you may be impacted if your app generates an unusually high volume of API calls.
Default Rate limits are as follows:
Type | Rate Limit |
---|---|
2-legged access token | 500 requests per minute |
3-legged access token | 500 requests per minute |
Every success response has the current rate limit information for your client in response headers. You can see the description of all rate limit related headers below:
Header | Description |
---|---|
x-ads-rate-limit-value | The client id of your application. |
x-rate-limit-reset | The time that the rate limit will be reset to the original configuration in UTC. |
x-ads-rate-limit-type | Type of the rate limit applied (2lo or 3lo). |
x-rate-limit-used | Number of requests done in the current window. |
x-rate-limit-remaining | Remaining number of requests that can be done in the current window. |
x-rate-limit-limit | The rate limit for the client. |
If user level rate limit is applied for the specific user, additional headers are added to the headers above for user rate limit information. You can see the description of the headers added for this case below:
Header | Description |
---|---|
x-ads-rate-limit-user-value | The user id that is queried. |
x-rate-limit-user-reset | The time that the user rate limit will be reset to the original configuration in UTC. |
x-ads-rate-limit-type | Type of the rate limit applied (only 3lo possible for this case). |
x-rate-limit-user-used | Number of user requests done in the current window. |
x-rate-limit-user-remaining | Remaining number of user requests that can be done in the current window. |
x-rate-limit-user-limit | The rate limit for the user. |
When an app exceeds the rate limit for a given endpoint, the API returns an HTTP 429 “Too many requests” response code.
The response header has a parameter named Retry-After
, which specifies how many seconds to wait before making a new
request. We strongly recommend that you retry only after the waiting period has lapsed.
Example Response Header & Body (429)
HTTP/1.1 429 Too Many Requests
Content-Type: application/json; charset=utf-8
Retry-After: 25
Content-Length: 54
{
"error": {
"code": 429,
"message": "Too Many Requests!!"
}
}
Why Rate Limits?
Rate limits help keep the number of API calls within the capacity of the backend. This ensures continued availability and consistent quality of service for all users.