Retrieve search results by keyword
Returns array of tweets provided by Twitter search page. Typically Twitter returns ~20 results per page. You can request additional search results by sending another request to the same endpoint using cursor parameter.
Endpoint
Endpoint parameters
query (Required)
A UTF-8, URL-encoded search query, including any operators supported by Twitter website search
from:elonmusk doge
cursor (Optional)
Cursor value obtained from next_cursor response property
DAACCgACGC12FhmAJxAKAAMYLXYWGX_Y8AgABAAAAAILAAUAAADoRW1QQzZ3QUFBZlEvZ0d...
type (Optional)
Search type (Latest for recent tweets or Top for popular tweets)
Default: Latest
Top
Using search operators
This endpoint supports all search operators supported by Twitter. Search operators must be included as part of query
parameter and not as separate endpoint parameters.
Some frequently used search operators:
from:USERNAME
will return all tweets and replies made by userfrom:USERNAME filter:replies
will return only replies, but not tweetsfrom:USERNAME -filter:replies
will return only tweets, but not repliessince_time:TIMESTAMP
anduntil_time:TIMESTAMP
will return tweets and comments posted after or before the provided UNIX timestampsince_id:TWEET_ID
andmax_id:TWEET_ID
will return tweets with ID higher or lower than the provided TWEET_IDconversation_id:TWEET_ID
will return all comments posted in response to TWEET_ID
For a more detailed overview of Twitter search operators refer to the following page: https://github.com/igorbrigadir/twitter-advanced-search
Known Limitations
Twitter removes tweets flagged as spam, or all tweets from all shadow-banned users. Request to retrieve tweets or comments made by a shadow-banned user (i.e. from:USERNAME
) will always return 0 tweets, but the user's timeline is still available through User tweets and replies endpoint.
Retrieving large datasets
While Twitter returns a limited number of results when using "Latest" search filter, it is possible to cycle through a larger dataset using max_id:
and since_id:
search operators.
When retrieving Latest search results, Twitter provides the response with tweets sorted by ID in descending order. If you need to retrieve more posts - simply make another request with the same query adding max_id:[lowest ID from current dataset].
Using this approach it is possible to extract the entire timeline from the moment an account was registered.
Response codes
HTTP 200 OK - succeeded
HTTP 402 Payment Required - not enough credits to perform this request
HTTP 404 Not Found - requested tweet does not exist
HTTP 422 Unprocessable Content - validation failed (e.g. one of the required parameters was not provided)
HTTP 500 Internal Server Error - other error, typically means that SocialData API failed to obtain the requested information and you should try again later
Rate limits
By default each user has a limit of 120 requests per minute shared across all endpoints. Please reach out to support@socialdata.tools if you need to raise your rate limit.
Example request
Example response
Last updated