Rate Limits
The rate limit currently stands at 750 units per minute per user. Each API function has a cost, which is deducted from your rate limit when you call it. Rate limits aren't reset, instead they are replenished continuously - so after 30 seconds, a previously empty rate limit will have 375 units available.
Avoiding rate limiting
Spread your requests
Performing a high number of API calls in a short space of time will quickly use your rate limit. Spreading the requests over a minute or so will allow the rate limit to replenish so you are less likely to get limited.
Caching
Cache API calls for at least a few seconds, and try to avoid making repetitive API calls.
Notes
- The Tracking API is not rate limited, instead it's covered by your Account Limits.
- GoSquared dashboards use the API and therefore use your rate limit, but the cost of each function is divided by 8.
- If you need a higher limit then get in contact through our support page where we can arrange a custom package.
HTTP Headers and Response Codes
API responses contain X-RateLimit
headers which can be used to monitor and control your usage.
If the cost of the API function is higher than the number of remaining units, the API will respond with a HTTP 429 Too Many Requests
status code and a Retry-After
header informing you how many seconds you must wait before you can retry the request.
Header | Description | Example |
---|---|---|
X-RateLimit-Cost | The unit cost of this API function. | 5 |
X-RateLimit-Full | The number of seconds until your rate limit will be full again if it's left to replenish. | 12 |
X-RateLimit-Limit | The maximum number of units which can be built up. | 750 |
X-RateLimit-Remaining | The number of units remaining and available for use. | 745 |
Retry-After | When rate limited, this is the number of seconds until you may retry the request. | 1 |