Can't destroy statuses or retweets


Hello. I’m trying to delete a status, using Python and the TwitterAPI package. Once authenticated, I have no problem tweeting via the API or destroying favorites. However, when I try to delete a tweet or unretweet a tweet, I get 404 errors. I can successfully do all these things through the gui web interface.

My code:

from TwitterAPI import TwitterAPI
r = api.request(‘statuses/destroy/:id’, { ‘id’: tweet_id })
’{“errors”:[{“message”:“Sorry, that page does not exist”,“code”:34}]}’

( tweet_id above is an int populated elsewhere. Yes, it’s the value I’m expecting. )

I see in older threads this issue has happened before, but I have not seen a satisfactory reason it happens or what I can do.

Do you know why I can’t destroy tweets or unretweet tweets via the API?



I’ve not checked this in the TwitterAPI library, but is the api.request call automatically appending the .json to the endpoint? i.e. it would be /1.1/statuses/destroy/:id.json if I was using twurl to do this.


Great point! Thanks. A casually read through the code on GitHub says “maybe.”


Based on the examples on GitHub you need to do the following:

r = api.request('statuses/destroy/:%d' % tweet_id)

Your request is likely generating a URL with a literal :id in it which is not a valid status ID.