Basic X (Twitter) Search
Search tweets using only X(Twitter) Search.
The Basic X (Twitter) Search API allows users to search for relevant links or tweets based on X (Twitter) search queries without leveraging AI-powered models. This API analyze links from X (Twitter) posts that match the given prompt.
Using the X (Twitter) Posts Search API
The following examples demonstrate how to interact with the Basic X (Twitter) Search API using multiple coding platform.
Request Sample
The below code snippet script:
-
Interacts with the Datura AI Twitter API https://apis.datura.ai/twitter to retrieve tweets related to the keyword “Bittensor” within a specified date range.
-
The code then sends a POST request with a structured JSON payload containing search parameters such as language (English), sorting order (Top), and engagement filters (minimum likes, replies, and retweets set to zero).
-
The request also specifies that the results should exclude tweets containing images, videos, or quotes and should not be limited to blue-verified accounts.
-
The API request is authenticated via an authorization key, and upon execution, the script prints the HTTP response status code along with the JSON-formatted search results.
Parameters
Required
-
url
: The endpoint for the Basic X (Twitter) Search API. -
payload
/body
: A JSON string or dictionary containing:query
: Search query. For syntax, check https://github.com/igorbrigadir/twitter-advanced-search, e.g., “Bittensor”.
Optional
sort
: Sort by Top or Latest, e.g., “Top”.start_date
: Start date in UTC (YYYY-MM-DD format), e.g., “2025-01-01”.end_date
: End date in UTC (YYYY-MM-DD format), e.g., “2025-01-01”.lang
: Language code (e.g., en, es, fr), e.g., “en”.verified
: Filter for verified users, e.g., “true”.blue_verified
: Filter for blue checkmark verified users e.g., “true”.is_quote
: Include only tweets with quotes e.g., “true”.is_video
: Include only tweets with videos e.g., “true”.is_image
: Include only tweets with images e.g., “true”.min_retweets
: Minimum number of retweets, e.g., 0.min_replies
: Minimum number of replies, e.g., 0.min_likes
: Minimum number of likes, e.g., 0.
Response Sample
Based on the above code, here is how the response is retrieve as JSON. Each coding language has its own way of retrieving data from the below JSON.
Test API
To experiment with the Basic X (Twitter) Search API and see it in action, visit the Basic X (Twitter) Search API.
X (Twitter) Search Operators Guide
X (Twitter) search operators allow users to refine their searches on Web, Mobile, and TweetDeck.
Search Operators
Here are the primary operations that can be used over tweets, users, engagement, media, and more.
Tweet Content
keyword1 keyword2 - Tweets containing both words (AND logic). keyword1 OR keyword2 – Tweets containing either word. “exact phrase” – Matches the complete phrase. +word – Forces inclusion of the word. -word – Excludes the word. #hashtag – Searches for tweets with a specific hashtag. $TWTR – Searches for stock symbols (cashtags). url:example.com – Finds tweets linking to a specific domain. lang:en – Filters tweets by language.
User-Based Filters
from:user – Tweets from a specific user. to:user – Replies to a specific user. @user – Mentions of a specific user. filter:verified – Tweets from verified users.
Geolocation Filters
near:city – Tweets geotagged to a location. within:10km – Restricts results to a radius from the specified location. geocode:lat,long,radius – Searches within a specific latitude and longitude.
Date & Time Filters
since:YYYY-MM-DD – Tweets from a specified date onward. until:YYYY-MM-DD – Tweets before a specified date. since_time:timestamp – Tweets after a UNIX timestamp. until_time:timestamp – Tweets before a UNIX timestamp.
Tweet Type Filters
filter:retweets – Shows retweets. filter:replies – Shows only replies. filter:quote – Shows quote tweets. conversation_id:tweet_id – Finds tweets within a specific thread.
Engagement Filters
min_retweets:10 – Tweets with at least 10 retweets. min_faves:50 – Tweets with at least 50 likes. min_replies:5 – Tweets with at least 5 replies. min_retweets:100 – Tweets with a maximum of 100 retweets.
Media Filters
filter:media – Tweets with any media. filter:images – Tweets with images. filter:videos – Tweets with videos. filter:native_video – Tweets with X (Twitter)-hosted videos. filter:spaces – Tweets from X (TwitterX ( Spaces.
Additional Filters
filter:links – Tweets containing links. filter:mentions – Tweets with mentions. filter:news – Tweets linking to news articles. filter:safe – Excludes NSFW content.
App-Specific Filters
source:client_name – Tweets from a specific app (e.g., TweetDeck). card_name:summary_large_image – Tweets containing large summary cards. card_name:player – Tweets with embedded players.
Matching Behavior
By default, X (Twitter) displays “Top” results, prioritizing tweets with engagement. Keyword searches match tweet text, usernames, screen names, and URLs.