Limitations

Rate Limits

The Lottery Results REST API employs rate limits to ensure a uniform experience for all users.

Info

Rate limits are not fixed values and may change in the future.

Global Applications

To prevent service overload, a global rate limit per public IP address applies to all API routes. It is calculated across all routes, and limits are cumulative.

  • 20 requests per second
  • 1200 requests per minute
  • 72000 requests per hour

Bursts of up to twice these values are allowed.

Lottery routes

For lottery routes, you are authenticated with a specific token, and the following specific rate limits are additionally applied:

  • ~20 requests per second
  • 1200 requests per minute
  • 72000 requests per hour

Working with rates limits

How can your application gracefully interact with these limits? This section describes how our API informs client applications about rate limiting and covers some best practices.

Reaching the limit

If your application reaches a limit, the HTTP response code is 429 and the response body indicates that rate limiting has occurred:

HTTP/1.1 429 Too Many Requests
...
{ "code": 429, "error": "Too Many Requests" }

In addition, the X-RateLimit-Reset header indicates the number of seconds to wait before the next retry.

HTTP/1.1 429 Too Many Requests
...
X-RateLimit-Reset: 10
...

To avoid 429 errors, check the X-RateLimit-Remaining header to know whether you are about to reach the limit.

Best practices

  • Make sure your application can handle being rate limited, because failed requests count against your quota.
  • Do not retry before the number of seconds given in X-RateLimit-Reset has elapsed.
  • Do not send a new request when X-RateLimit-Remaining is not a positive value.