Search API \ Search tweets on Twitter
Search API Resources
Resource/URI | GET |
---|---|
Twitter · Search tweets
/search/twitter/tweets.json
|
Search Tweets |
Workflow
Request: the code to send to the API
Send an API request to this endpoint in order to search for Tweets matching a specified query:
GET
/search/twitter/tweets.json
The following URL parameters are available for this endpoint:
URL Parameter | Description |
---|---|
* search_textstring
|
Free-form text to match. Can be text or username (ie. @oneall). |
num_tweetsinteger
|
Indicates how many tweets should be included in the resultset.
The valid range is between 1 an 200.
Default: 50 |
until_tweet_idinteger
|
If specified, only tweets having an id less than this value are returned. To paginate
the resultset, simply read the first page, note the id of the last entry and then make another request by
using it's value for until_tweet_id .Example: 1060488451450195969 |
after_tweet_idinteger
|
If specified, only tweets having an id greater than this value are returned. Example: 1060488451450195969 |
result_typestring
|
If specified, return a type of results which can be "mixed", "recent" or "popular". By default, the results type is "mixed." |
languagestring
|
If specified, return only tweets of specified language. Must be an ISO 639-1 code Example: fr |
Result: the code returned by the API
Response Example
{ "response": { "request": { "date": "Thu, 03 Jan 2019 11:35:33 0100", "resource": "/search/twitter/tweets.json?search_text=OneAll", "status": { "flag": "success", "code": 200, "info": "Your request has been processed successfully" } }, "result": { "data": { "count": 2, "entries": [ { "id": 975676099354071040, "url": "https://twitter.com/OneAll/status/975676099354071040", "date": "Mon, 19 Mar 2018 11:11:23 +0100", "text": "@OneAll Hi, Discord is available on MyBB for OneAll. You can download it on our GitHub repo here : https://t.co/8NIILcigSJ", "type": "reply", "num_retweets": 0, "num_favorites": 1, "links": [ { "url": "https://twitter.com/i/web/status/975676099354071040", "url_short": "https://t.co/8NIILcigSJ" } ], "place": { "id": "61490a94f1b5dde4", "url": "https://api.twitter.com/1.1/geo/id/61490a94f1b5dde4.json", "place_type": "city", "name": "Abreu e Lima", "full_name": "Abreu e Lima, Brasil", "country_code": "BR", "country": "Brazil" } }, { "id": 941650483214798848, "url": "https://twitter.com/OneAll/status/941650483214798848", "date": "Fri, 15 Dec 2017 13:45:44 +0100", "text": "RT Do you use OneAll (@OneAll) and recommend 👍 them? You can do it here 👉 https://t.co/1AcxlFkGlp 🚀", "type": "retweet", "num_retweets": 123, "num_favorites": 4, "links": [ { "url": "https://twitter.com/i/web/status/941650483214798848", "url_short": "https://t.co/1AcxlFkGlp" } ] } ] } } } }