Is rate limiting per bucket or per method?


#1

From what I understand from documentation, each method has its own rate limit. So for example, if one REST method has 15 requests per 15 minutes, then I can do 15 requests per 15 minutes. But what if I do also requests to other method during this time? As I see, it seems that there is only one 15 requests bucket so both methods count toward the same 15 requests limit? And not that I can do 15 requests for one method and 15 requests to other method?

I am asking this because I am hitting rate limit and I am sure that I am not doing more than 15 requests per 15 minutes, per method. But I am doing multiple methods in parallel.

The other possibility would be that I am not aligned with window. Does each user has its own window or is window restarted globally?

Thanks


#2

It’s 15/180 requests per endpoint per 15 minutes per user per app, i.e. it drills down to the particular user of the app, and for that specific endpoint.

For example, statuses/user_timeline allows 180 requests per 15 minutes, and statuses/mentions_timeline allows 15 requests per 15 minutes; if you have 10 users, each of those 10 users can max out the limit for each individual endpoint over a 15 minute period. If you’re hitting a rate limit, you’ll be hitting the one for that specific endpoint, use of others won’t affect it.

The 15 minute window is not global, that too is per user and on an endpoint-specific basis; that is, they don’t all reset at, say, quarter/half past/to the hour. If you start to use statuses/user_timeline at 12:00, it will reset the limit for that endpoint at 12:15, while if you start to use statuses/mentions_timeline at 12:05, it will reset the limit for that endpoint at 12:20. If an endpoint has not been used for at least 15 minutes, i.e. it still has its full allocation of requests remaining, the reset time will always be 15 minutes from the current time.

Hope that helps.


#3

Thanks for the reply. I also assumed so. So I am doing followers/ids and friends/ids and users/lookup calls. And for one user, I can do 180 users/lookup per 15 minutes without a problem and I am not hitting any limit and my rate limiting code seems to work. But when I do followers/ids and friends/ids at the same time, I am hitting rate limit. It seems like they would be counted towards the same bucket. So I am talking for one user. And yes, I do have 15 requests per 15 minutes for those two methods.

OK, I just wanted to be sure. I will debug further on my side.


#4

I just ran a test, and I didn’t get any rate limit errors, could run them one after the other and they all worked, so it does seem like something on your end rather than an issue with the API itself.


#5

Hm, thanks. It is strange. I don’t find any bug. But thanks.