Rate limit
To avoid flooding the API, we use the token bucket model:
- Each client has a bucket, containing a maximum of 5 tokens.
- Every time a request is made, a token is used and taken out of the bucket.
- The bucket has a refill rate of 0.1 per second.
- If the token still has tokens when the request is made, the request is executed. But if the bucket is empty, requests are thrown out until new tokens get added.
Exemple
If you make 5 requests in quick succession, all requests will pass but your bucket will now be empty. From then on, you can only send one request every 10 seconds, the time required for a new token to be added to the bucket.
Multiple queries
Sending a request with multiple queries at once only takes one token from the bucket. This can be a useful way to reduce your API calls and avoid being throttled.
Error
If the request gets thrown out due to rate limiting, you will receive this error message:
{
"error" : "Too many requests, please wait"
}