- Accounts and users
- Direct Messages
- Publisher tools
- Twitter for Websites
- Developer utilities
- API reference index
How to build a query
The best way to build a query and test if it’s valid and will return matched Tweets is to first try it at twitter.com/search. As you get a satisfactory result set, the URL loaded in the browser will contain the proper query syntax that can be reused in the API endpoint. Here’s an example:
- We want to search for Tweets referencing @twitterapi account. First, we run the search on twitter.com/search
- Check and copy the URL loaded. In this case, we got: https://twitter.com/search?q=%40twitterapi
- Replace https://twitter.com/search with https://api.twitter.com/1.1/search/tweets.json and you will get: https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi
- Run a Twurl command to execute the search.
Please note that the API requires that the request is authenticated (check Authentication & Authorization documentation for more details on this). Also note that the search results at twitter.com may return historical results, while the Search API usually only serves Tweets from the past week.