Rate limit on direct_messages/destroy?



This may be a silly question, but . . . The documentation says that direct_messages/destroy is rate limited but does not mention what that limit is.




Yeah the relevant stuff is kinda spread over a few pages:

Assume endpoints not in the chart are 15 calls in a 15 min window: https://dev.twitter.com/rest/public/rate-limiting

direct_messages/destroy is a “write” action, so it’s also limited per user, and could have additional daily limits https://support.twitter.com/articles/15364 but i’ve never tried deleting > 1000 DMs


Write actions are limited by the account limits as @IgorBrigadir mentions - that information is in the user support pages. I believe deletion actions would count inside the 1000/day DM limit per account (and be rate limited inside the usual 15 minute windows).


Thanks, that’s what I thought/was afraid of… lol


FOLLOW-UP QUESTION: When I try to GET DMs, direct_messages.json?count=10&include_entities=false&skip_status=true

I get errors":[{“code”:93,“message”:“This application is not allowed to access or delete your direct messages.”}]

I double checked and the app does have the “Read, Write and Access direct messages” permisson checked off


INTERESTING: I just tested with four other accounts that I manage for people. They were set up the exact same way and I can pull in DMs no problem.

Just my account seems to ignore the permissions setting. ???



Sounds strange. One possible thing that may cause this would be if the app permissions were upgraded after you’d already authenticated your account with the app with “lower” settings. Otherwise I’m not sure what could be going on here.


No idea, I seem to remember they were originally done with DM permissions. Anyway, I created a new app with exactly the same settings and everything works fine with those new tokens

Any idea how many DMs are stored by Twitter? I ran a loop and pulled in 196 before REST returns an empty set (with a http 200), but I see about a dozen or so in my account that never get listed even if I go with a max_id…

I also found an anomaly. Id and id_str don’t match in the Apigee test console but do when used directly. The console seems to round off the last two digits
“id”: 835202450474704900,
“id_str”: “835202450474704901”,
“text”: “Two words… #YouMatter. Change a heart. Change a mind. Change a world. Please share the message https://t.co/NmJlywpjHE”,

dm_id=835202450474704901, sender_screen=’’, date=‘2017-02-24 13:02:59’, dm_text=‘Two words… #YouMatter. Change a heart. Change a mind. Change a world. Please share the message https://t.co/NmJlywpjHE

Yes, we decided to not simply kill DMs. We’ll pull them in to our servers so they can be searched, sorted, categorized, mined or whatever. Also, that way, we’ll have ALL DMs going forward to look at. We’ll store them, then we’ll remove them from the account.