Monitoring the rate limit headers that come back on end-point GET direct_messages/events/list and trying to time my requests to minimize the delay time to the next event while staying within the limits. I have done my very best to eliminate my own errors here and I think I have. The situation is that I get the following back on GET direct_messages/events/list

11:18:12 PM	$cwbot: [News Tweets] /direct: lim = 900 rem = 810 rst @ 23:19:32 

using the returned headers x-rate-limit-limit:, x-rate-limit-remaining:, and x-rate-limit-reset:, respectively. I have polled 90 times (900 - 810) in 14 minutes (23:19 - 23:18 = 1 minute from next 15 minute reset interval). I should still have 810 end-point requests left. However just less than one minute later I get the rate limit exceeded response to that endpoint:

11:19:17 PM	$cwbot: [News Tweets] TwitterAPIException: [blahblah] The remote server returned an error: (429) Too Many Requests. 

My direct-message endpoint requests are mixed in with requests for GET statuses / home_timeline, but I am tracking the three rate-limit parameters on that end-point separately, in other words, each end-point has its own “last received” rate limit parameters from the above headers on the return from that endpoint. I have looked very carefully to see that I am not mixing things up (like the wrong reset time ha ha).

So… my question is "How is it possible that I got the 429 error when it looks like to me that I still have 810 requests left and it’s only 82 seconds away from the reset time?

I have a related problem. On a 19:12:30 GET statuses / home_timeline request I got x-rate-limit-reset: of 19:13:14 yet when I sent the next request at 19:13:18 (four seconds after the reset time), I got the 429 response.

Is there a “buffer” or possibly some “slop” in the timing and calculations at the server end. For now I’ll not cut it so close.

Well I did a GET direct_messages/events/list only test. As soon as I reached a x-rate-limit-remaining: value of 810, the next attempt to GET direct_messages/events/list results in a 420 rate limit exceeded. No other activity in my app, no other users. This is testing with an app that I have not yet released.

At present I will subtract 810 from the limit and remaining numbers and use those as the “real thing”. Well, at least until someone can explain what’s actually going on.

Counting up to the 429 error, you only get 15 GET direct_messages/events/list per 15 minute period. THat’s what actually happens. The documentation and the numbers coming back from the endpoints are wrong.

1 Like

Thanks so much for reaching out here. This is something we are actively investigating internally. Thanks for sharing your experiences with us.

1 Like

Hi all,

We’re seeing this across a few different endpoints too, unfortunately - doesn’t appear to be just DMs.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.