Rate Limiting of application/rate_limit_status endpoint

restapi
rate-limits

#1

Hello,
I am trying to avoid hitting the rate limit in my application, by requesting the rate limit status of the endpoint I am about to use, before querying it. However application/rate_limit_status endpoint is rate limited itself with a rate limit of 180. The endpoint I am using (users/show:id) is rate limited with 900 requests.

Basically I am getting penalised for trying to avoid hitting the rate limit. Shouldnt the application_rate_limit endpoint either be not rate limited at all, or at least have a much higher rate limit than all the other endpoints?

Thanks for your help,
Kind Regards,
Shadi


#2

If you use the HTTP headers of each response you make then you do not have to call application/rate_limit_status on a regular basis. Every request has three header values that can help you with this. For example, if I call users/show/:id.json and check the headers in the response, I see:

-> "x-rate-limit-limit: 900\r\n"
-> "x-rate-limit-remaining: 898\r\n"
-> "x-rate-limit-reset: 1506936549\r\n"

In this case, I can see that the rate limit for the endpoint is 900 calls in a 15 minute window; I currently have 898 calls left in my quota; and the window resets at Unix epoch time 1506936549 (which is Monday, 2 October 2017 09:29:09 GMT).

That’s a more reliable way of checking the current position of your call quotas.