Skip to main content
This page provides a complete list of operators available when building a query for the Search API endpoints.

Overview

Operators are used to match on specific Post attributes. There are two types:
  • Standalone operators — Can be used alone or with any other operators
  • Conjunction-required operators — Must be used with at least one standalone operator

Keyword and Phrase Operators

OperatorTypeSummaryExample
keywordStandaloneMatches a keyword within the Post body (tokenized match)pepsi OR cola OR "coca cola"
emojiStandaloneMatches an emoji within the Post body(😃 OR 😡) 😬
"exact phrase"StandaloneMatches the exact phrase within the Post body("X API" OR #v2) -"recent search"

Entity Operators

OperatorTypeSummaryExample
#StandaloneMatches Posts containing a hashtag (exact match)#thankunext #fanart
@StandaloneMatches Posts mentioning a username(@XDevelopers OR @API) -@X
$StandaloneMatches Posts containing a cashtag$twtr OR @XDevelopers -$fb

User Operators

OperatorTypeSummaryExample
from:StandaloneMatches Posts from a specific userfrom:XDevelopers OR from:API
to:StandaloneMatches Posts in reply to a specific userto:XDevelopers OR to:API
retweets_of:StandaloneMatches Retweets of a specific userretweets_of:twitterdev

URL Operators

OperatorTypeSummaryExample
url:StandaloneTokenized match on URL (matches url or expanded_url fields)url:"https://developer.twitter.com"

Context and Entity Operators

OperatorTypeSummaryExample
context:StandaloneMatches Posts with a specific domain/entity paircontext:10.799022225751871488
entity:StandaloneMatches Posts with a specific entity string value (recent search only)entity:"Michael Jordan"
conversation_id:StandaloneMatches Posts in a conversation threadconversation_id:1334987486343299072

List Operator

OperatorTypeSummaryExample
list:StandaloneMatches Posts from members of a specific Listlist:123

Post Reference Operators

OperatorTypeSummaryExample
in_reply_to_tweet_id:StandaloneMatches replies to a specific Postin_reply_to_tweet_id:1539382664746020864
retweets_of_tweet_id:StandaloneMatches Retweets of a specific Postretweets_of_tweet_id:1539382664746020864
quotes_of_tweet_id:StandaloneMatches Quote Tweets of a specific Postquotes_of_tweet_id:1539382664746020864

Location Operators

OperatorTypeSummaryExample
place:StandaloneMatches Posts tagged with a locationplace:"new york city" OR place:seattle
place_country:StandaloneMatches Posts with a country codeplace_country:US OR place_country:MX
point_radius:StandaloneMatches Posts within a radius of a pointpoint_radius:[2.355128 48.861118 16km]
bounding_box:StandaloneMatches Posts within a bounding boxbounding_box:[-105.301758 39.964069 -105.178505 40.09455]

Post Type Operators

OperatorTypeSummaryExample
is:retweetConjunction requiredMatches Retweetsdata @XDevelopers -is:retweet
is:replyConjunction requiredMatches repliesfrom:XDevelopers is:reply
is:quoteConjunction requiredMatches Quote Tweets"sentiment analysis" is:quote
is:verifiedConjunction requiredMatches Posts from verified authors#nowplaying is:verified
-is:nullcastConjunction requiredExcludes promotional Posts (must be negated)"mobile games" -is:nullcast

Content Type Operators

OperatorTypeSummaryExample
has:hashtagsConjunction requiredMatches Posts with hashtagsfrom:XDevelopers -has:hashtags
has:cashtagsConjunction requiredMatches Posts with cashtags#stonks has:cashtags
has:linksConjunction requiredMatches Posts with linksfrom:XDevelopers has:links
has:mentionsConjunction requiredMatches Posts with mentions#nowplaying has:mentions
has:mediaConjunction requiredMatches Posts with media (photo, GIF, video)(kittens OR puppies) has:media
has:imagesConjunction requiredMatches Posts with images#meme has:images
has:video_linkConjunction requiredMatches Posts with native X videos#icebucketchallenge has:video_link
has:geoConjunction requiredMatches Posts with geolocation datarecommend #paris has:geo

Language Operator

OperatorTypeSummaryExample
lang:Conjunction requiredMatches Posts classified as a specific languagerecommend #paris lang:en

Logical Operators

OperatorSummaryExample
ORLogical OR between expressionscat OR dog
Space (AND)Logical AND between expressionscat dog (both required)
()Grouping for complex expressions(cat OR dog) -is:retweet
-Negation/exclusioncat -grumpy

Supported Languages

The lang: operator supports these BCP 47 language codes:
LanguageCodeLanguageCodeLanguageCode
AmharicamGreekelPortuguesept
ArabicarGujaratiguRomanianro
ArmenianhyHebrewiwRussianru
BasqueeuHindihiSerbiansr
BengalibnHungarianhuSimplified Chinesezh-CN
BulgarianbgIndonesianinSlovaksk
CatalancaItalianitSloveniansl
CroatianhrJapanesejaSpanishes
CzechcsKannadaknSwedishsv
DanishdaKoreankoTamilta
DutchnlLatvianlvTelugute
EnglishenLithuanianltThaith
EstonianetMalayalammlTraditional Chinesezh-TW
FinnishfiMarathimrTurkishtr
FrenchfrNorwegiannoUkrainianuk
GermandePersianfaUrduur
GeorgiankaPolishplVietnamesevi

Query limitations

Access levelRecent searchFull-archive search
Self-serve512 characters1,024 characters
Enterprise4,096 characters4,096 characters

Next steps