linkAvoiding the rate limiter
Sometimes, you may find yourself occasionally needing to send API requests in high volume, causing rate limiting errors. Here are a few things to try:
- Slow down. If you're sending a large sequence of requests, add a small delay of 1–200ms between each request and see if that improves things. This is especially important when paginating large datasets or creating resources in bulk.
- Add jitter. In cases where you're running a cron job or invoking requests at a set interval across multiple machines, adding in some "jitter" can help reduce a thundering herd problem. In this case, "jitter" can simply be random delay value of 10ms to 10m, to help spread out the licensing requests across time.
- Add caching. In order to reduce request volume, you can cache previous responses for a set duration, to avoid hitting the network with superfluous requests. You can store response signatures to verify cache integrity.
- Use a token pool. In some instances, it may be more feasible to issue additional tokens to support higher request volume. For example, if you were attempting to license a fleet of hundreds of machines which all shared the same IP, you may want to issue a pool of tokens instead of a single token.
- Obey the headers. If all else fails, you can look at the rate limiting headers above
and derive a delay from the
X-RateLimit-Reset
header once yourX-RateLimit-Remaining
count falls below a certain threshold.
Looking for a more customized rate limit? Reach out to our support team and we can discuss a custom rate limit. From trusting your proxies to whitelisting IPs, we'll find a solution that will work with your requirements.
Most customized rate limits require an Ent tier or above.
Example response / 429 Too Many Requests
X-RateLimit-Window: 5mX-RateLimit-Count: 501X-RateLimit-Limit: 500X-RateLimit-Remaining: 0X-RateLimit-Reset: 1490973281Retry-After: 59{ "errors": [ { "title": "Too many requests", "detail": "Throttle limit has been reached for your IP address.", "code": "TOO_MANY_REQUESTS" } ]}