Rate limits
Calls are counted over two windows at once. A window starts with your first call and lasts exactly its length.
The limits
| Window | Calls |
|---|---|
minute | 60 |
hour | 1000 |
These are the defaults. Read the numbers from the headers rather than hard-coding them.
Only calls that are let through count. A call refused with 401, 403 access_not_approved or 429 does not use up your allowance.
Who shares a limit
| You are | The limit is counted |
|---|---|
| An affiliate or advertiser user | Per user. All your keys draw on the same allowance. |
| A Network or Admin user | Per key. Each key has its own allowance. |
So for an affiliate or advertiser, a second key does not buy a second allowance: four keys calling at once still add up to 60 calls a minute between them. Create more keys to keep integrations apart, not to call more.
The network also sets how many keys an affiliate or advertiser user may have. Your API keys page shows how many you are using.
Headers
Every answer to a valid key says where you stand, once per window. For an affiliate or advertiser key the numbers are those of your user, shared by all your keys:
X-RateLimit-Limit-minute: 60
X-RateLimit-Remaining-minute: 57
X-RateLimit-Reset-minute: 41
X-RateLimit-Limit-hour: 1000
X-RateLimit-Remaining-hour: 942
X-RateLimit-Reset-hour: 2210
| Header | Meaning |
|---|---|
X-RateLimit-Limit-* | Calls allowed in that window. |
X-RateLimit-Remaining-* | Calls left in it, after this one. |
X-RateLimit-Reset-* | Seconds until that window ends and the count starts again from zero. |
The same numbers are in GET /me, under data.token.rate_limit.
At the limit
The call is not carried out and answers 429, whichever of your keys made it. The message names the window that ran out, and meta.rate_limit has the state of both:
HTTP/1.1 429 Too Many Requests
{
"errors": [
{ "code": "rate_limited", "message": "Rate limit exceeded for the \"minute\" window." }
],
"meta": {
"rate_limit": {
"minute": { "limit": 60, "remaining": 0, "reset_in": 23 },
"hour": { "limit": 1000, "remaining": 688, "reset_in": 1740 }
}
}
}
Wait reset_in seconds for the window that ran out, then carry on.
Staying under it
- Ask for bigger pages (
per_page=200) instead of many small ones. - Use the stats endpoints for totals instead of adding up rows from the click and conversion lists.
- Read the Reference lists once and keep them.
- For "tell me when a conversion happens", use webhooks instead of polling.