Rest API - tweet/media rate limit question



Hi all,

I’ve got a question about the rate limits for posting tweets via the REST API - just recently I managed to hit a rate limit of some kind (I don’t know which, as the error didn’t specify it - just a 403 with “Rate limit exceeded”), and I’m wondering if there is some kind of media rate limit I’m not aware of.

I run a simple twitter app on my local machine that, at its most frequent, tweets artwork once every five minutes (text + one image, different each time). As far as I know, the only limit on tweeting is the 2,400 per day limit that’s specified in the Twitter rules and is broken down into semi-hourly 50 per 30 minute intervals, and I’m certain I haven’t even gotten close to exceeding that. My app doesn’t make any other API calls other than posting status updates, so it can’t be hitting any other limit.

My app uses Twitter4j for posting to Twitter, and as far as I’m aware POST methods do not have rate limits in themselves, so I’m not sure what I am missing here. Sorry if I’ve overlooked something obvious :frowning:

(Edit - I didn’t attach the log message because like a muppet I accidentally truncated it, so I’m mostly just looking to see if I missed some obvious API or tweet limit.)




Questions here:

  • “so far as I’m aware POST method do not have rate limits” - they do, but these are account limits.
  • you mention media endpoints - can you be more specific about what you’re aiming to do here?
  • have you read the automation rules? There are potentially BotMaker rules which could limit the behaviour of your app.


Hi Andy,

What I meant was, in terms of POST limits, they are not API-specific limits but associated with the Twitter account in question, and I’m not aware that this is something that varies from account to account (I assumed it is a set number per account, as I haven’t seen anything that suggests a deviation from this.)

The code I’m using (with use of Twitter4j) to upload a tweet looks like this:

    try {
        UploadedMedia media = twitter.uploadMedia(new File(fileName));
        mediaID = media.getMediaId();
        StatusUpdate update = new StatusUpdate(tweetText);
        update.setMediaIds(new long[]{mediaID});
        Status status = twitter.updateStatus(update);"Status update successful! ID = " + status.getId() + " & text = " + status.getText());
    } catch (Exception e) {
        LOGGER.error("Failure submitting to Twitter!", e);
        return false;

uploadMedia makes a call to POST media/upload in the Media API, i.e. the simpler single-upload endpoint, then updateStatus makes a call to POST statuses/update.

I have read the automation rules, but I can’t find anything in there that I am violating - let me try to explain more clearly what my app is trying to do:

I add artworks to a local MySQL database, and my app then tweets these in a specific way: A string containing the title of the work, the artist’s name or twitter handle, and the link to their webpage in which it was published, plus the image of the artwork itself as a media upload. The URL is the specific link to that artwork, so I post almost no duplicate links. It tweets these automatically based on a random timeframe; between every 30-120 minutes for 12 hours of the day, and between every 5-10 minutes during the other 12 hours.

As such, my application only posts status updates (no GET calls, nothing else), and it has only one copy running on my local machine, updating one Twitter account (@antsstyle).

I didn’t even know BotMaker existed before you pointed that out, though I can’t seem to find much info on how it determines what to act upon or why it would give me a rate limit error…

EDIT: There is only one idea I can think of - with a lot of the tweets I manually add hashtags to be added to the end of the tweet status string before scheduling them, so it’s potentially possible that I have unwittingly scheduled a tweet or two to be automatically tweeted that fell afoul of the “no automated tweets with trending topics” rule at the time that they were tweeted, though it seems odd I would not have received a more specific reason for the write restriction if that was the case.