query field of the Search Tweets endpoint and on x.com. A few are marked UI only: those depend on a signed-in account (your follows, your location, your network) and do not work through the API.
Note: For a complete guide with copy-paste recipes, production code examples (Python and JavaScript with pagination), and a side-by-side comparison against the official X API v2 operator set, see the Twitter Search Operators Complete Cheat Sheet on the blog.
Syntax basics
- Spaces between terms act as implicit AND
ORmust be uppercase- Use a leading dash (
-) to exclude a term, phrase, or operator - Group expressions with parentheses
- Wrap exact phrases in double quotes
cat OR black dog is evaluated as cat OR (black dog). Use parentheses to eliminate ambiguity.
Free Visual Query Builder
If you don’t want to assemble operator strings by hand, use the Sorsa Search Builder. It is a free, no-login tool with a graphical interface where you toggle filters and preview the generated query string before integrating it into your code.1. Keyword and Boolean Logic
Plurals match their singulars and vice versa. Operators match against tweet body, the author’s display name, screen name, and expanded URLs inside the tweet.
2. User and Account Filters
3. Engagement Gating
Counts become approximate for very large values (1,000+).
4. Media and Content Type
Media filters
Tweet type filters
Special content filters
5. Date, Time, and Snowflake IDs
Snowflake ID conversion. Every tweet ID encodes its creation timestamp:
6. Geographical Filters
Only an estimated 1-2% of tweets carry precise geolocation data. If a tweet does not have coordinates, the API falls back to reverse-geocoding the user’s profile location.
7. Language and Source
Language
Standard ISO 639-1 codes (lang:en, lang:es, lang:fr, lang:de, lang:ja, lang:ru, etc.) plus the following X-specific codes:
Source (posting client)
Common values:
Twitter_for_iPhone, Twitter_for_Android, Twitter_Web_App, TweetDeck, twitter_ads.
8. Card and URL Operators
card_name: typically only matches tweets from the last 7-8 days.
Building queries
A practical construction order that scales:- Group core keywords:
(bitcoin OR ethereum OR $BTC) - Add content constraints:
lang:en,filter:images,-filter:replies - Set engagement thresholds:
min_faves:50,min_retweets:10 - Exclude noise:
-from:spambot,-scam,-filter:retweets - Add time bounds:
since:2026-01-01 until:2026-03-01
Known limitations
- Operator cap: roughly 22-23 operators maximum per query.
- Geo coverage is thin: only 1-2% of tweets have precise location data.
card_name:is time-limited to the past 7-8 days.- Private and suspended accounts are excluded from search results.
- Language detection is imperfect for short tweets, code, or emoji-heavy posts.
- Not all tweets are indexed. Tweets flagged for platform violations may be excluded.
- Auto-correction happens silently in some cases. Use
+wordor"word"to force exact matching. - URL matching works for domains and subdomains but is unreliable for long URL paths.
Source
This reference draws on the maintained twitter-advanced-search repository by Igor Brigadir, the industry-standard source on undocumented X search behavior.Next Steps
- Search Tweets - complete guide to the
/search-tweetsendpoint. - Track Mentions - strategies for tracking @mentions of any account.
- Pagination - paginating through large result sets.
- Search Builder - free visual query builder.
- Full Cheat Sheet on the Blog - recipes, code examples, and X API v2 comparison.