Hi there, I am using standard api now. I heard that its limited to 30 search api requests per minute. Thats ok, but I also saw that there is a 250 request limit per month, but can purchase premium which has packages starting from 500 requests and more, is that real ? 250 requests, 500 requests per month ? thats insanely low!

Those are correct limits you’re reading. Two things to understand:

  • premium offers both 30 day and full archive search; these are not available in the free standard search API, which has a ~7 day window.
  • the premium APIs also offer both a more complete archive to access, and much richer query operators, so you may find it easier to extract the Tweets that match the research or queries you are interested in more easily.

We’ve heard your comments and community questions about limits and access to data. We are willing to hear more as we work on the new API (Currently called Twitter Developer Labs). See https://twitterdevfeedback.uservoice.com to add to those conversations.

Thanks for your reply. 250, 500 requests per month is really disappointing. How can we make an app and use twitter api, if standard api, only 250 requests per month, which equals to nearly 8 requests per day ?!

I am developing an app and its almost finished. It uses map and searches and finds people by their latest tweet who are near your location;

And when clicked, it will open link profile details, last tweet and link to twitter profile.

Now only 8 search api requests per day allowed, so how can it be ? :frowning:

We definitely don’t want to disappoint you! Again, I will point out the differences here:

  • you’re currently using the standard search API, which is about 10 years old, and has limited coverage. It will only search back around 7 days. That may work for you, and we’re not taking it away right now (although our new Recent Search API has been released now in Twitter Developer Labs, and this will eventually replace the v1.1 search API you are using now)
  • in premium, paid or sandbox (free), you get access to richer operators, more Tweets per search call, and either up to 30 day, or full history search. At the moment there’s no premium search API for 7 day / “recent” search.

The purpose of premium API search is not to increase your rate limits. That’s not what you would be paying for. If you’re asking for more API calls to the standard search endpoint, that’s not what premium is going to offer you. We hope that you can build your app on the existing standard rate limits (remember, you have both per-user and per-app rate limits in the current standard API; but also be aware that we are rebuilding the whole API platform and that this may change in the future).

Finally, I’ll just mention that for geo search, very few Tweets have geo location added (this is an opt-in feature for users), so this may return limited results in many cases.

Can you explain what you would like to achieve, and how the API could work best for you? That will help us to explain to our engineering and product teams! :slight_smile:

1 Like

Hi Andy,

I appreciate your detailed and helpful post. Well, everything works for me now without any problems. I dont need any more functions, or search back more older tweets. I am only using search tweets api.

I just worry that, if I publish my app on store and many people start to use, app might be stop working because of rate limiting. I need your help, thanks!

Unfortunately there’s no way around that - the rate limits are the same for all developers. You’ll need to code that into your app to manage how often you call the API, or communicate to users. Good luck!

Some of the app functions you describe don’t even need tweet search - the latest tweet is embedded in a user object, so an endpoint like https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup will give you 1 latest tweet for each user id (provided that you have a list of screen names or ids from somewhere else, such as a friends list, or a pre cached set for a given location you can serve multiple people, eg: https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-search )

Caching calls per location and query and sharing the results to multiple users of your app would be much more efficient - your server side will call twitter and cache results, and your app will call your server.

You can make some calls on the device, but the majority of calls you can save and serve to many users over and over, meaning you only really need to make a few requests to Twitter - but this does mean you need your own backend server for your app.

2 Likes

@IgorBrigadir
Cache for what ? It fetches latest tweets based on people who are nearby. I use Twitter api search, it just searches with geocode, lat long values of user and finds people who are tweeted recently. Yes, I dont make another api call when fetching user data, its already included in the Tweet search results.

@andypiper
I was going to advertise in some large media companies, and it would even benefit to Twitter, because when they see people, they will see and go to their Twitter profile as well. Whoever I showed my app said that its a very nice and it would be very popular if I publish, however I cant because Twitter just gives me 250 requests, which means 8 requests per day. I dont know why does a big company like Twitter just gives 250 requests per month ?! That sucks.

I’m confused. You stated you are using the standard search API, but now you seem to be saying you’re using the (sandbox / free) premium search API - can you be more clear about what you’re using? Where are you reading that there’s a 250 request/month limit for search?

@andypiper I get my app approved and using the credientals, like;

require_once('TwitterAPIExchange.php');
 
$settings = array(
    'oauth_access_token' => "7688313963411619XXXXXXXXXXXXX",
    'oauth_access_token_secret' => "EJgvvhbJfCaYXyNhXXXXXXXXXXXXX",
    'consumer_key' => "H4Dawzw6XXXXXXXXXXXXX",
    'consumer_secret' => "ti5sIXXXXXXXXXXXXX"
);

I have read the rate limit of Twitter page and saw the limits such as;

10 requests per second
30 requests per minute
And there is also monthly request limit of 250, but this can be lifted as 500 and 1000 and more if premium api

I hope that last one is incorrect, or other meaning because that is very low rate.

The standard search API is rate limited at 180 requests every 15 minutes with user Auth or 450 requests every 15 minutes with app Auth, the monthly limits you refer to are on the premium search products.

@Andypiper Oh thats great then!
So am I using app oauth ? then 450 requests for 15 minutes is enough for me. Sorry to confuse you.

I cannot answer your question about what you are using. Your PHP snippet suggests you have user tokens which would mean 180/15 mins. I don’t see your code or understand how it works so that’s all I can tell you. Again: I’ll repeat that geo Search typically returns very few replies because very few Twitter users set their Tweets to include location data. It’s in the region of 1-2% of Tweets and there is simply no way around that, it is down to user choice. If your app is working for you, I’m excited - but do be aware of this volume for search.

@andypiper I just dont understand if Im using user token or app token.
I am just using credientals of what Twitter provided me from my app. I dont ask any user for permission etc.

require_once('TwitterAPIExchange.php');
 
$settings = array(
    'oauth_access_token' => "7688313963411619XXXXXXXXXXXXX",
    'oauth_access_token_secret' => "EJgvvhbJfCaYXyNhXXXXXXXXXXXXX",
    'consumer_key' => "H4Dawzw6XXXXXXXXXXXXX",
    'consumer_secret' => "ti5sIXXXXXXXXXXXXX"
);

$lat = "41.0082";
$long = "28.9784";

if (!$_REQUEST[km]) {
$km = "50";
}

$url = "https://api.twitter.com/1.1/search/tweets.json";
$requestMethod = "GET";
$searchfield = "?q=-filter:retweets&geocode=".$lat.",".$long.",".$km."km";
$getfield = $searchfield . "&count=100&result_type=recent";
$twitter = new TwitterAPIExchange($settings);
$string = json_decode($twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest(),true);

Cache for what ?

I mean any request you make to Twitter, cache it for a while - so if you search for “London”, and get a response, you won’t make a new search until some time has elapsed and your rate limit has reset for example - to ensure that you don’t run out of calls.

I just dont understand if Im using user token or app token.

You are using User Auth, because you have “Access Tokens” - for app only auth, you will be using “Bearer Tokens”

The library you’re using, TwitterAPIExchange does not support App only (Bearer) Auth it seems, but there is a pull request for it here if you want to use that https://github.com/J7mbo/twitter-api-php/pull/281/files

Or give https://github.com/abraham/twitteroauth a try! Have a look at the returned headers from Twitter, they will contain Rate Limit info - you can monitor your usage with those headers.

1 Like

@IgorBrigadir I really appreciate your help. That pull code samples for TwitterApiExchange looks messy, do you know how to use that on search tweets ? I am suprised that, unlike others, Twitter has none of any code samples!

edit: oh, seems that this is what I need, simple and clean tweets search with app auth!

1 Like

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