Rate limits
How many calls each API key, OAuth client and address can make, and what to do when you get 429 from the API or its edge.
Rate limits keep the API fast for everyone. They count per minute.
The limits
| What is counted | Limit |
|---|---|
| Calls with one API key, across all operations | 120 a minute |
| Calls with the access tokens of one OAuth client, across all operations | 120 a minute |
| Each of the two subscribe operations (by body and by path), per key or client | 60 a minute, inside the 120 |
| Failed key or token checks from one address | 20 a minute |
| Access tokens issued to one OAuth client | 30 a minute |
| Failed client checks at the token URL from one address | 20 a minute |
Other limits:
| What | Limit |
|---|---|
| Size of a JSON request body | 100 KB |
| Size of a form-encoded body at the token URL | 8 KB |
| REST hooks per organisation | 100 |
| Responses per page in List completed responses | 200 (default 50) |
Limits by plan
When limits by plan are turned on for your organisation, your plan sets the limit of each key and of the access tokens of each OAuth client, and Settings > API access > API usage shows it:
| Plan | Calls with one API key or one OAuth client, across all operations |
|---|---|
| Trial | 60 a minute |
| Starter | 120 a minute |
| Growth | 300 a minute |
| Enterprise | 600 a minute |
Monthly API quotas are turned on separately. When they are on for your organisation and your plan includes a monthly number of API calls, it counts every call made with your organisation's live keys and OAuth access tokens from the first day of the month (Riyadh time); calls with test keys are not counted, and neither are calls refused for another reason (for example a missing scope, or an API your plan does not include); those still count toward the per-minute limit. API usage shows how many are used and when they renew. Past the number, calls answer 429 with the code API_QUOTA_EXCEEDED and a Retry-After up to the start of next month.
While monthly quotas are on, every call that is let through also carries the standard RateLimit headers, so your system can slow down before it is refused:
RateLimit-Policy: 300;w=60, 100000;w=1296000
RateLimit-Limit: 300
RateLimit-Remaining: 287
RateLimit-Reset: 41RateLimit-Policy lists each limit and its window in seconds. RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset (seconds) describe the limit you are closest to.
When you hit a limit
The API answers 429 Too Many Requests with the code RATE_LIMITED and a Retry-After header:
HTTP/1.1 429 Too Many Requests
Retry-After: 12
Content-Type: application/json
{ "code": "RATE_LIMITED", "message": "Too many requests, try again later", "requestId": "..." }Retry-After is the number of seconds to wait. Wait at least that long, then try again.
At the token URL the body follows OAuth 2.0 instead: { "error": "invalid_request", "error_description": "..." }, with the same Retry-After header.
429 answers from the edge
While limits at the edge are on, the edge in front of the API also counts the calls of each API key whose answers carry the RateLimit headers (while limits by plan or monthly quotas are on for your organisation), and can answer 429 itself, before the call reaches the API. It allows about twice your per-minute limit or more, so it stops floods well above your limit; the API stays the exact count. It counts API keys only: calls with OAuth access tokens and calls without a key never get a 429 there. A call the edge refuses does not reach the API, so the API does not count it toward your per-minute limit or your monthly quota.
Its answers use the same codes, messages and body as the API's, with a requestId and the same X-Request-Id header:
| When | Code | Headers |
|---|---|---|
| A key is over its per-minute limit at the edge | RATE_LIMITED |
Retry-After: 60, and RateLimit-Policy, RateLimit-Limit (the key's per-minute limit), RateLimit-Remaining: 0 and RateLimit-Reset: 60 |
The API has just refused a key's call with API_QUOTA_EXCEEDED |
API_QUOTA_EXCEEDED, with details.limit (the monthly quota) |
Retry-After up to the start of next month, and RateLimit-Policy (both limits), RateLimit-Limit (the monthly quota), RateLimit-Remaining: 0 and RateLimit-Reset (the same seconds as Retry-After) |
HTTP/1.1 429 Too Many Requests
Retry-After: 60
RateLimit-Policy: 300;w=60
RateLimit-Limit: 300
RateLimit-Remaining: 0
RateLimit-Reset: 60
Content-Type: application/json; charset=utf-8
{ "code": "RATE_LIMITED", "message": "Too many requests, try again later", "requestId": "..." }How they differ from the API's own answers:
- The API's per-minute
429gives the exact wait inRetry-Afterand noRateLimitheaders. The edge's per-minute429always says60, the longest wait: after 60 seconds the edge does not refuse the key for the same minute again, and a call may be let through sooner. - The edge answers
API_QUOTA_EXCEEDEDitself for at most 5 minutes after the API's answer. After that it sends the key's calls to the API again, which answers until the quota renews.
Handle every 429 the same way: wait for the Retry-After seconds, and do not expect the RateLimit headers on every answer.
Too many failed checks
After 20 failed key or token checks in a minute from one address, every call from that address answers 429 for up to a minute, even with a valid key. Check that your system sends the right key before it retries.
Tips
- Spread bulk work out over time instead of sending it all at once.
- For survey triggers, send an
Idempotency-Key. Then you can safely retry after a429or a network error without sending a second survey. - Reuse an OAuth access token until it nearly expires instead of asking for a new one for each call.
- To read many responses, page through List completed responses with up to 200 per page. See Pagination.
Was this page helpful?
Thanks. Need more help? Email support@sayvara.com