Rules and filtering: Enterprise
Getting started with enterprise rules and queries
Products utilizing enterprise operators deliver social data to you based on filtering rules you set up. Rules are made up of one or more ‘clauses’, where a clause is a keyword, exact phrase, or one of the many enterprise operators. Before beginning to build rules with enterprise operators, be sure to review the syntax described below, look through the list of available operators, and understand the restrictions around building rules. You should also be sure to understand the nuances of how rules are evaluated logically, in the “Order of operations” section.
Multiple clauses can be combined with both “and” and “or” logic.
Please note: “And” logic is specified with a space between clauses, while or logic is specified with an upper-case OR
.
Each rule can be up to 2,048 characters long with no limits on the number of positive clauses (things you want to match or filter on) and negative clauses (things you want to exclude and not match on).
Building rules and queries
Keyword match
Keyword matches are similar to queries in a search interface. For example, the following enterprise operator rule would match activities with the term “social” in the text body.
social
ANDing terms with white space
Adding another keyword is the same as adding another requirement for finding matches. For example, this rule would only match activities where both “social” and “media” were present in the text, in either order – having a space between terms operates as boolean AND logic. If you include an explicit AND in your rule, it will rejected by the rules endpoint.
social media
ORing terms with upper-case OR
Many situations actually call for boolean OR logic, however. This is easily accomplished as well. Note that the OR operator must be upper-case and a lower-case ‘or’ will be treated as a regular keyword.
social OR data
Negating terms
Still other scenarios might call for excluding results with certain keywords (a boolean NOT logic). For instance, activities with ‘happy’, but excluding any with ‘birthday’ in the text.
social -personality
Grouping with parentheses
These types of logic can be combined using grouping with parentheses, and expanded to much more complex queries.
(social OR data) (academic OR research) -personality -information -university
This is just the beginning though – while the above examples rely simply on tokenized matching for keywords, enterprise products also offer operators to perform different types of matching on the text.
Exact match
"social media research"
Substring match
contains:info
Proximity match
"social media research"~3
Further, other operators allow you to filter on unique aspects of social data, besides just the text.
The user who is posting a Post
from:XDeveloeprs
Geo-tagged Tweets within 10 miles of Pearl St. in Boulder, CO, United States
point_radius:[-105.27346517 40.01924738 10.0mi]
Putting it all together
These can be combined with text filters using the same types of logic described above.
(social OR data) (academic OR research OR "social media research") point_radius:[-105.27346517 40.01924738 10.0mi] lang:en -personality -information -university
Boolean Syntax
The examples in the previous section, utilized various types of boolean logic and grouping. See the table below for additional detail regarding the syntax and requirements for each.
Logic type | Operator syntax | Description |
AND | social data | Whitespace between two operators results in AND logic between them Matches activities containing both keywords (“social”, “data”). Do not use AND explicitly in your rule. Only use whitespace. An explicit AND will be treated like a regular keyword. |
OR | social OR data | To OR together two operators, insert an all-caps OR, enclosed in whitespace between them Matches activities with EITHER keyword (“social” OR “data”) Note that if you combine OR and AND functionality in a single rule, you should understand the order of operations described in our “Order of operations” section, and consider grouping non-negated operators together using parentheses as described below to ensure your rule behaves as expected. You must use upper-case “OR” in your rule. Lower-case ‘or’ will be treated as a regular keyword. |
NOT | social data -apple -android -phone | Insert a - character immediately in front of the operator or group of operators. The example rule shown matches activities containing keyword “social”, but excludes those which contain the keyword “data.” Negated ORs are not allowed where the rule would request “everything in the firehose except the negation.” For example, apple OR -ipad is invalid because it would match all activities except those mentioning “ipad”. |
Grouping | (social OR data) -XDeveloeprs -api | Parentheses around multiple operators create a functional “group”. Groups can be connected to clauses in the same manner as an individual clause via whitespace (AND) or ORs. However, note that it is a best practice to not group together negations by applying the negating - to the entire group. Instead, you should negate each individual operator, stringing them together via whitespace (AND). For example, instead of using -(iphone OR imac OR macbook), use the following: -iphone -imac -macbook Grouping is especially important where a single rule combines AND and OR functionality, due to the order of operations used to evaluate the rule. See below for more details. |
Please note: that operators may be either positive or negative.
Positive Operators define what you want to include in the results. E.g. the has:hashtags
operator says “I want activities containing hashtags.”
Negative Operators define what you want to exclude from the results, and are created by using the Boolean NOT logic described above. For example, -has:hashtags
says “Exclude any activities containing hashtagss, even if they otherwise match my rule.”
Premum operator products have no restriction on the number of positive and negative clauses, subject to a maximum length of 2,048 characters.
Order of Operations
When combining AND and OR functionality in a single rule, the following order of operations will dictate how your rule is evaluated.
- Operators connected by AND logic are combined first
- Then, operators connected with OR logic are applied
Example:
apple OR iphone ipad
would be evaluated asapple OR (iphone ipad)
ipad iphone OR android
would be evaluated as(iphone ipad) OR android
To eliminate uncertainty and ensure that your rules are evaluated as intended, group terms together with parentheses where appropriate. For example:
(apple OR iphone) ipad
iphone (ipad OR android)
Punctuation, Diacritics, and Case Sensitivity
If you specify a keyword or hashtag rule with character accents or diacritics for enterprise operators, it will match Post text honoring the diacritics (hashtags or keywords). Rule with a keyword Diacr**í**tica
or hashtag #cumplea**ñ**os
will match “Diacrítica” or “#cumpleaños” but not “Diacritica” or “#cumpleanos” without the tilde í or eñe.
Characters with accents or diacritics are treated the same as normal characters and are not treated as word boundaries. For example, a rule of cumpleaños would only match activities containing the word cumpleaños and would not match activities containing cumplea, cumplean, or os.
All operators are evaluated in a case-insensitive manner. For example, the rule Cat
will match all of the following: “cat”, “CAT”, “Cat”.
PowerTrack rule tags
As described on our “Matching rules” page, each rule may be created with a tag. These tags have no effect on filtering, but can be used to create logical groupings of rules within your app. Each rule may have only one tag, with a maximum of 255 characters. Tags are included with the JSON formatted rule at the time of creation via the API, as described on our “Matching rules” page.
Putting Rules in JSON Format
In order to add or delete a rule from a stream via the API, the rules must utilize JSON format. Essentially, this requires putting each rule into the following structure:
{"value":"insert_rule_here"}
Rules with double-quotes
If the rule contains double-quote characters (“
) associated with exact-match or other operators, they must be escaped using a backslash to distinguish them from the structure of the JSON format.
"social data" @XDevelopers
The JSON formatted rule would be:
{"value":"\"social data\" @XDevelopers"}
Rules with double-quote string literals
To include a double-quote character as a string literal within an exact-match, it must be double-escaped. For example, for a rule matching on the exact phrase “Toys “R” Us”, including the double-quotes around “R”, the plain-text representation of this would look like the following:
"Toys \"R\" Us"
Translating this to JSON format, you should use the following structure:
{"value":"\"Toys \\\"R\\\" Us\""}
Rules with Tags
To include an optional tag with your rule, as described above, simply include an additional tag
field with the rule value.
{"value":"\"social data\" @XDevelopers","tag":"RULE-TAG-01"}
Formatting for API Requests
When adding or deleting rules from the stream via the API, multiple JSON formatted rules should be comma delimited, and wrapped in a JSON “rules” array, as shown below:
{"rules":[{"value":"from:XDevelopers"},{"value":"\social data\" @XDevelopers","tag":"RULE-TAG-01"}]}
Operators that match Quote Tweets
When using the PowerTrack API and Historical PowerTrack API, the operators below will match on content from both the original Post that was quoted and the new Quote Tweet.
However, if you are using the Search API, these operators will only match the contents of the Quote Tweet, and will not match on any content from the original Post that was quoted.
Keywords
Phrases
Proximity
#hashtags
@mentions
$cashtags
url:
url_contains:
has:links
has:mentions
has:hashtags
has:media
has:symbols
is:quote
is:reply
Enterprise operators
Below are the operators available with PowerTrack and Historical PowerTrack. A subset of these are available with the 30-Day and Full-Archive search APIs. See this table for a product-by-product list of available operators.
Operator | Description |
---|---|
keyword | Matches a keyword within the text body or URL of a Post. Keywords must start with either a digit (0-9) or any non-punctuation character. Keyword matching is tokenized, meaning the keyword is matched against tokenized text of the Post body. For strings with punctuation (e.g., “coca-cola”), use a quoted “exact phrase match”. Example: (social OR pizza OR wildfire) -planet |
emoji | Matches an emoji within the body of a Post, using tokenized matching based on punctuation, symbol/emoji, and separator characters. If an emoji has a variant, use quotes for exact matches. Example: (🍕 OR 💜 OR 🐢) -🤖 |
”exact phrase match” | Matches an exact phrase within the body of a Post. Punctuation is treated as whitespace. Example: ("social media" OR "developer.x.com" OR "wildfire911" OR "coca-cola") -"planet earth" |
# | Matches any Post with the specified hashtag. This is an exact match, meaning #2016 will match posts with #2016 but not #2016election .Example: (#social OR #pizza OR #2016election) -#planet |
@ | Matches any Post mentioning the specified username. Example: (@XDevelopers OR @api OR @twittereng) -@jack |
”keyword1 keyword2”~N | Proximity operator that matches a Post where keywords are within N tokens of each other. Keywords in reverse order can be no more than N-2 tokens apart. N cannot be greater than 6. Example: "social media"~5 OR "API"~3 |
contains: | Substring match for Posts with the specified substring in the body, regardless of tokenization. Use double quotes for substrings with whitespace or punctuation. Example: (contains:social OR contains:"wikipedia.com") -contains:"buy now" |
from: | Matches any Post from a specific user by X numeric Account ID or username (excluding @ ).Example: (from:2244994945 OR from:api OR from:twittereng) -from:jack |
to: | Matches any Post replying to a specific user by X numeric Account ID or username (excluding @ ).Example: (to:2244994945 OR to:api OR to:twittereng) -to:jack |
url: | Performs a tokenized (keyword/phrase) match on expanded URLs of a post. Example: @XDevelopers url:"developer.x.com" |
url_title: | Performs a keyword/phrase match on the expanded URL HTML title metadata. Available only with PowerTrack and Historical PowerTrack. |
url_description: | Performs a keyword/phrase match on the expanded page description metadata. Available only with PowerTrack and Historical PowerTrack. |
url_contains: | Matches Posts with URLs containing the specified phrase or keyword. Enclose search terms with punctuation in quotes. Example: (url_contains:"developer.x.com" OR url_contains:wildfire) -url_contains:reddit |
bio: | Matches a keyword or phrase within the user bio of a Post. This is a tokenized match within the ‘description’ field within the User object. Example: (bio:engineer OR bio:"wordpress.com" OR bio:🚀) -bio:troll Note: Only available with PowerTrack and Historical PowerTrack. |
bio_name: | Matches a keyword within the user bio name of a Post. This is a tokenized match within a user’s “name” field in the User object. Note: Only available with PowerTrack and Historical PowerTrack. |
bio_location: | Matches Posts where the User object’s location contains the specified keyword or phrase. This operator performs a tokenized match, similar to the normal keyword rules on the message body. This location is part of the User object, and is the account’s ‘home’ location. Note: Only available with PowerTrack and Historical PowerTrack. |
statuses_count: | Matches Posts when the author has posted a number of statuses within the given range. If a single number is specified, any number equal to or higher will match. A range can be specified to match any number in the range (e.g., statuses_count:1000..10000 ).Example: to:api statuses_count:10 Note: Only available with PowerTrack and Historical PowerTrack. |
followers_count: | Matches Posts when the author has a followers count within the given range. If a single number is specified, any number equal to or higher will match. A range can be specified to match any number in the range (e.g., followers_count:1000..10000 ).Note: Only available with PowerTrack and Historical PowerTrack. |
friends_count: | Matches Posts when the author has a friends count (the number of users they follow) within the given range. If a single number is specified, any number equal to or higher will match. A range can be specified to match any number in the range (e.g., friends_count:1000..10000 ).Note: Only available with PowerTrack and Historical PowerTrack. |
listed_count: | Matches Posts when the author has been listed within X a certain number of times within the given range. If a single number is specified, any number equal to or higher will match. A range can be specified to match any number in the range (e.g., listed_count:10..100 ).Note: Only available with PowerTrack and Historical PowerTrack. |
$ | Matches any Post that contains the specified ‘cashtag’ entity. Example: ($TWTR OR $TSLA OR $BRK.A) -$F Note: The cashtag operator relies on X’s ‘symbols’ entity extraction to match cashtags, rather than extracting it from the body itself. |
retweets_of: | Matches Posts that are Retweets of a specified user. Accepts both usernames and numeric X Account IDs (NOT Post status IDs). Example: (retweets_of:2244994945 OR retweets_of:api OR retweets_of:twittereng) -retweets_of:jack |
retweets_of_status_id: | Deliver only explicit Retweets of the specified Post. Use the ID of an original Post and not a Retweet. Example: retweets_of_status_id:1293593516040269825 Note: Only available with PowerTrack and Historical PowerTrack. |
in_reply_to_status_id: | Deliver only explicit replies to the specified Post. Example: in_reply_to_status_id:1293593516040269825 Note: Only available with PowerTrack and Historical PowerTrack. |
sample: | Returns a random sample of Posts that match a rule. The sample percentage must be an integer between 1 and 100. The operator reduces the scope to X%, then the rule/filter is applied to that sampled subset. Example: #happybirthday sample:5 "happy birthday"~5 sample:80 Note: Only available with PowerTrack and Historical PowerTrack. |
source: | Matches any Post generated by the specified source application. The value can be the application name or the application’s URL. Example: #happybirthday source:"X for iPhone" "This is a test X from my TestingApp" source:MyTestAppName Note: The source operator searches on the Post source attribute and cannot be used alone. |
lang: | Matches Posts classified by X as being in a particular language. Posts are currently classified as only one language, so matching multiple languages yields no results. Not recommended to use alone. |
The list below represents the current supported languages and their corresponding BCP 47 language indentifier:
Amharic: am | German: de | Malayalam: ml | Slovak: sk |
Arabic: ar | Greek: el | Maldivian: dv | Slovenian: sl |
Armenian: hy | Gujarati: gu | Marathi: mr | Sorani Kurdish: ckb |
Basque: eu | Haitian Creole: ht | Nepali: ne | Spanish: es |
Bengali: bn | Hebrew: iw | Norwegian: no | Swedish: sv |
Bosnian: bs | Hindi: hi | Oriya: or | Tagalog: tl |
Bulgarian: bg | Latinized Hindi: hi-Latn | Panjabi: pa | Tamil: ta |
Burmese: my | Hungarian: hu | Pashto: ps | Telugu: te |
Croatian: hr | Icelandic: is | Persian: fa | Thai: th |
Catalan: ca | Indonesian: in | Polish: pl | Tibetan: bo |
Czech: cs | Italian: it | Portuguese: pt | Traditional Chinese: zh-TW |
Danish: da | Japanese: ja | Romanian: ro | Turkish: tr |
Dutch: nl | Kannada: kn | Russian: ru | Ukrainian: uk |
English: en | Khmer: km | Serbian: sr | Urdu: ur |
Estonian: et | Korean: ko | Simplified Chinese: zh-CN | Uyghur: ug |
Finnish: fi | Lao: lo | Sindhi: sd | Vietnamese: vi |
French: fr | Latvian: lv | Sinhala: si | Welsh: cy |
Georgian: ka | Lithuanian: lt |
Example:
(@XDevelopers OR to:XDevelopers) lang:es
Note: The language operator matches on the specific Post language determined by X and set as the lang Post attribute. See HERE for more information on X Entities JSON attributes. If no language classification can be made for a Post, the Post lang will be set as ‘und’ (for undefined).
Operator | Description |
---|---|
place | Matches Posts tagged with the specified location or X place ID. Multi-word place names should be enclosed in quotes. Example: (place:London OR place:"Great Britain") -place:USA place:fd70c22040963ac7 Note: See the GET geo/search public API endpoint for how to obtain X place IDs. Note: Will not match on Retweets or Quote Tweets, as Retweet places are attached to the original Post. |
place_country | Matches Posts where the country code associated with a tagged place/location matches the given ISO alpha-2 character code. Example: place_country:GB OR place_country:AU OR place_country:CA Note: Will not match on Retweets or Quote Tweets, as Retweet places are attached to the original Post. Valid ISO codes: ISO 3166-1 alpha-2. |
point_radius:[lon lat radius] | Matches against the Exact Location (x,y) of the Post or a “Place” geo polygon within the defined radius. * Radius: < 25mi * Supported units: mi, km * Longitude: ±180 * Latitude: ±90 Coordinates are in decimal degrees. Arguments are bracketed, space-delimited. Example: point_radius:[-105.27346517 40.01924738 0.5mi] Example: point_radius:[2.355128 48.861118 16km] Note: Will not match on Retweets or Quote Tweets. |
bounding_box:[west_long south_lat east_long north_lat] | Matches against Exact Location or a “Place” geo polygon fully contained in a bounding box. Arguments are bracketed, space-delimited. Coordinates: decimal degrees (±180 long, ±90 lat). Width and height must be < 25mi. Example: bounding_box:[-105.301758 39.964069 -105.178505 40.09455] Note: Will not match on Retweets or Quote Tweets. |
profile_country | Matches Posts where the author’s profile geo country code matches a given ISO-3166-1-alpha-2 two-letter code. |
profile_region | Matches on the “region” field from the author’s profile geo enrichment, an exact full string match. Use double quotes for substrings containing whitespace or punctuation. Example: profile_region:"New York" |
profile_locality | Matches on the “locality” field from the author’s profile geo enrichment, an exact full string match. Use double quotes for substrings containing whitespace or punctuation. Example: profile_locality:"San Francisco" |
profile_subregion | Matches on the “subRegion” field from the author’s profile geo enrichment, including specific counties or metro areas. An exact full string match. Example: profile_subregion:"Santa Clara County" |
has:geo | Matches Posts with Post-specific geo location data from X, including “geo” lat-long or “Place” location data with a display name and geo polygon. Note: With Search API, must be combined with non- is: or has: operators. |
has:profile_geo | Matches Posts with any Profile Geo metadata, regardless of value. Available alias: has:derived_user_geo .Note: With Search API, must be combined with non- is: or has: operators. |
has:links | Matches Posts with a link or referenced media in the “text” object of the payload, including media and Quote Tweets. Note: With Search API, must be combined with non- is: or has: operators. |
is:retweet | Delivers only explicit retweets. Can be negated to exclude retweets and deliver only original content. This operator looks only for true Retweets and not Quoted Tweets. Note: With Search API, must be combined with non- is: or has: operators. |
is:reply | Delivers only explicit replies. Can be negated to exclude replies. PowerTrack matches replies to original Posts, replies in quoted Posts, and replies in Retweets. Search API matches only replies to original Posts. Example: @XDevelopers -is:reply |
is:quote | Delivers only Quote Tweets or Posts that reference another Post. Can be negated to exclude Quote Tweets. Example: @XDevelopers is:quote |
is:verified | Delivers only Posts from “verified” authors. Can be negated to exclude Posts from verified authors. Example: @XDevelopers is:verified |
has:mentions | Matches Posts mentioning another X user. Note: With Search API, must be combined with non- is: or has: operators. |
has:hashtags | Matches Posts containing a hashtag. Note: With Search API, must be combined with non- is: or has: operators. |
has:media | Matches Posts containing a media url classified by X (e.g., pic.x.com). Available alias: has:media_link .Note: With Search API, must be combined with non- is: or has: operators. |
has:images | Matches Posts containing a media url (e.g., pic.x.com). Note: With Search API, must be combined with non- is: or has: operators. |
has:videos | Matches Posts containing native X videos uploaded to X. Available alias: has:video_link .This operator does not match videos from YouTube, Periscope, or other video hosting sites. Note: With Search API, must be combined with non- is: or has: operators. |
has:symbols | Matches Posts containing a cashtag symbol (e.g., $TWTR). Note: With Search API, must be combined with non- is: or has: operators. |
Operators by product
Rules and filtering: Enterprise
All enterprise operators are available with PowerTrack and Historical PowerTrack APIs. However, only a subset of operators are available to the enterprise Search APIs, as noted on this page.
The dark blue tags note which operators are available to different enterprise products:
PowerTrack Search
Operator | Product | Description | Matches on payload element |
---|---|---|---|
”exact phrase match” | PowerTrack Search | Matches an exact phrase within the body of a Post. Components that can translate into a search operators will be treated as words. In other words: * "#hashtag" will match hashtag but not #hashtag (use the hashtag operator without quotes to match on actual hashtags) * "$TWTR" will match the word TWTR but not the cashtag $TWTR (use the cashtag operator without quotes to match on actual cashtags)Note: in 30 Day Search and Full Archive Search (Enterprise and Premium), punctuation is not tokenized and is instead treated as whitespace. | text |
@ | PowerTrack Search | Matches any Post that mentions the given username. The value can be either the username (excluding the @ character) or the user’s numeric ID or (obtained for example via the GET users/lookup endpoint). | entities.user_mentions |
# | PowerTrack Search | Matches any Post with the given hashtag. This operator performs an exact match. For example meaning the rule #1989 will match Posts containing the exact hashtag #1989 , but not those with the hashtag #TaylorSwift1989 .Note: this operator relies on X’s entity extraction to match hashtags, rather than extracting the hashtag from the body itself. For more details on JSON attributes from entities, refer to X Entities. | entities.hashtags |
$ | PowerTrack Search | Matches any Post that contains the specified cashtag (where the leading character of the token is $ ).**Note: **this operator relies on X’s entity extraction to match links, rather than extracting the link from the body itself. For more details on JSON attributes from entities, refer to X Entities. | entities.symbols |
bio: | PowerTrack | Available alias: user_bio: Matches a keyword (using tokenized match) or a phrase within the user bio of a Post. Use double quotes to match a phrase. In other words: * bio:software engineer will match Posts with the keyword engineer from users with the word software in their bio* bio:"software engineer" will match any Post posted by users with the phrase software engineer in their bio | user``.description |
bio_location: | PowerTrack | Available alias: user_bio_location: Matches Posts where the User object’s location contains the specified keyword (using tokenized match) or phrase. This location is a non-normalized, user-generated, free-form string, and is different from a Post’s location (when available). | user.location |
bio_name: | PowerTrack | Matches Posts where the User object’s name contains the specified keyword (using tokenized match) or phrase. | user.name |
bounding_box: | PowerTrack Search | Available alias: geo_bounding_box: Matches against the exact location (long, lat) of the Post (when present), and against a geo polygon (where the Place is fully contained within the defined region). * west_long south_lat represent the southwest corner of the bounding box where west-long is the longitude of that point, and south_lat is the latitude. * east_long and north_lat represent the northeast corner of the bounding box, where east_long is the longitude of that point, and north_lat is the latitude. * Width and height of the bounding box must be less than 25mi * Longitude is in the range of ±180 * Latitude is in the range of ±90 * All coordinates are in decimal degrees. * Rule arguments are contained within brackets, space delimited. Note: operators matching on place (Post geo) will only include matches from original Posts. Retweets do not contain any place data. | place (original Posts only) |
contains: | PowerTrack | Substring match for Posts that have the given substring in the body, regardless of tokenization. In other words, this does a pure substring match and does not consider word boundaries. Use double quotes to match substrings that contain whitespace or punctuation. | text |
<emoji> | PowerTrack Search | Matches an emoji within the body of a Post. This is a tokenized match, so your emoji will be matched against the tokenized text of the Post body. Tokenization is based on punctuation, symbol/emoji, and separator Unicode basic plane characters. For example, a Post with the text “I like 🍕” would be split into the following tokens: I, like, 🍕. These tokens would then be compared to the emoji used in your rule. Note: if an emoji has a variant, you must use double quotes to add to a rule. | text |
followers_count: | PowerTrack | Matches Posts when the author has a followers count within the given range. * A single number (e.g. followers_count:42 ) will match any number equal to or greater than the value specified.* A range (e.g. followers_count:42..1337 ) will match any number in the given range. | user.followers_count |
friends_count: | PowerTrack | Available alias: following_count: Matches Posts when the author has a friends count (the number of users they follow) that falls within the given range. * A single number (e.g. followers_count:42 ) will match any number equal to or greater than the value specified.* A range (e.g. followers_count:42..1337 ) will match any number in the given range. | user.friends_count |
from: | PowerTrack Search | Matches any Post from a specific user. The value can be either the username (excluding the @ character) or the user’s numeric ID or (obtained for example via the GET users/lookup endpoint). | user.id , user.id_str (if using User ID)user.screen_name (if using username) |
has:geo | PowerTrack Search | Matches Posts that have Post-specific geolocation data provided from X. This can be either “geo” lat-long coordinate, or a “location” in the form of a X Place, with the corresponding display name, geo polygon, and other fields. Cannot be used as a standalone operator. Note: operators matching on place (Post geo) will only include matches from original posts. Retweets do not contain any place data. | place (original Tweets only) |
has:hashtags | PowerTrack Search | Matches Posts that contain at least one hashtag. Cannot be used as a standalone operator. | entities.hashtags |
has:images | PowerTrack Search | Matches Posts that contain at least one classified image URL. Cannot be used as a standalone operator. | entities.media |
has:lang | PowerTrack | Matches Posts that have been classified by X as being of a particular language. If a Post has not been classified, the operator will not match. Each Post is currently only classified as being of one language, so AND’ing together multiple languages will yield no results. Cannot be used as a standalone operator. | lang when value is not und |
has:links | PowerTrack Search | This operator matches Posts which contain links in the Post body. Cannot be used as a standalone operator. Note: this operator relies on X’s entity extraction to match links, rather than extracting the link from the body itself. For more details on JSON attributes from entities, refer to X Entities. | entities.urls |
has:media | PowerTrack Search | Available alias: has:media_link Matches Posts that contain at least one classified media URL. Cannot be used as a standalone operator. | entities.media |
has:mentions | PowerTrack Search | Matches Posts that mention another X user. Cannot be used as a standalone operator. | entities.user_mentions |
has:profile_geo | PowerTrack Search | Available alias: has:derived_user_geo Matches Posts that have any Profile Geo metadata, regardless of the actual value. Cannot be used as a standalone operator. | user.location |
has:symbols | PowerTrack Enterprise | Matches Posts that contain a cashtag symbol (e.g. $TWTR ).Cannot be used as a standalone operator. | entities.symbols |
has:videos | PowerTrack Search | Available alias: has:video_link Matches Posts that contain at least one classified media URL. Cannot be used as a standalone operator. | entities.media |
in_reply_to_status_id: | PowerTrack | Available alias: in_reply_to_tweet_id: Deliver only explicit replies to the specified Post. | id , id_str of the target Post |
is:quote | PowerTrack | Deliver explicit Quote Tweets that match a rule. It can also be negated ( -is:quote ) to exclude Quote Tweets that match a rule from delivery.Cannot be used as a standalone operator. | is_quote_status (if true ) |
is:reply | PowerTrack Search | Deliver only replies that match a rule. It can also be negated ( -is:reply ) to exclude delivery of replies that match the specified rule.With PowerTrack, this operator matches on: * Replies to an original Post * Replies in quoted Posts * Replies in Retweets When used with the Search API, this operator matches on replies to an original Post, but excludes replies in quoted Tweets and replies in Retweets. You can use this operators in conjunction with is:retweet and is:quote to only deliver replies to original Posts.Cannot be used as a standalone operator with the Search API. Note: with Premium, this operator is not available in Sandbox dev environments. | Reply elements, e.g. in_reply_to_status_id |
is:retweet | PowerTrack Search | Deliver only explicit Retweets that match a rule. It can also be negated ( -is:retweet ) to exclude Retweets that match a rule from delivery and only original content is delivered.This operator looks only for true Retweets (i.e. Retweets posted using the Retweet button). Quoted Tweets and modified Posts which do not use X’s Retweet functionality will not be matched by this operator. Cannot be used as a standalone operator. | Retweet elements, e.g. retweeted_status |
is:verified | PowerTrack Search | Deliver only Posts where the author is verified by X. It can also be negated to exclude Posts where the author is verified. Cannot be used as a standalone operator. | user.verified |
keyword | PowerTrack Search | Matches a keyword within the body of a Post. This is a tokenized match, meaning that your keyword string will be matched against the tokenized text of the Post body. Tokenization is based on punctuation, symbol/emoji, and separator Unicode basic plane characters. For example, a Post with the text “I like coca-cola” would be split into the following tokens: I , like , coca , cola . These tokens would then be compared to the keyword string used in your rule. To match strings containing punctuation (e.g. coca-cola), symbol, or separator characters, you must use an exact phrase match operator. | text |
lang: | PowerTrack Search | Matches Posts that have been classified by X as being of a particular language (if, and only if, the post has been classified). Each Post will be classified with only one language, so AND’ing together multiple languages will yield no results. **Note: **if no language classification can be made the provided result is und (for undefined).This operator will only match against supported languages. Providing any other value (including und ) will result in the operator being ignored (in other words, Posts will not be filtered by this operator). The list below represents the currently supported languages and their corresponding BCP 47 language identifier:am Amharichu Hungarianpt Portuguesear Arabicis Icelandicro Romanianhy Armenianin Indonesianru Russianbn Bengaliit Italiansr Serbianbg Bulgarianja Japanesesd Sindhimy Burmesekn Kannadasi Sinhalazh Chinesekm Khmersk Slovakcs Czechko Koreansl Slovenianda Danishlo Laockb Sorani Kurdishnl Dutchlv Latvianes Spanishen Englishlt Lithuaniansv Swedishet Estonianml Malayalamtl Tagalogfi Finnishdv Maldivianta Tamilfr Frenchmr Marathite Teluguka Georgianne Nepalith Thaide Germanno Norwegianbo Tibetanel Greekor Oriyatr Turkishgu Gujaratipa Panjabiuk Ukrainianht Haitianps Pashtour Urduiw Hebrewfa Persianug Uyghurhi Hindipl Polishvi Vietnamesecy Welsh | lang when value is not und |
listed_count: | PowerTrack | Available alias: user_in_lists_count: Matches Posts when the author has been listed on X a number of times falls within the given range. * A single number (e.g. listed_count:42 ) will match any number equal to or greater than the value specified.* A range (e.g. listed_count:42..1337 ) will match any number in the given range. | user.listed_count |
place_country: | PowerTrack Search | Matches Posts where the country code associated with a tagged place/location matches the given ISO alpha-2 character code. Note: operators matching on place (Post geo) will only include matches from original Posts. Retweets do not contain any place data. | place (original Posts only) |
place: | PowerTrack Search | Matches Posts tagged with specified location or X place ID. Multi-word place names should be enclosed in quotes (e.g. place:"San Francisco" )Note: operators matching on place (Post geo) will only include matches from original posts. Retweets do not contain any place data. | place (original Posts only) |
point_radius: | PowerTrack Search | Note: operators matching on place (Post geo) will only include matches from original posts. Retweets do not contain any place data. | place (original posts only) |
profile_bounding_box:[west_long south_lat east_long north_lat] | PowerTrack | Matches against the user’s exact Location (long, lat) in the Profile Geo enrichment where the Place is fully contained within the defined region. * west_long south_lat represent the southwest corner of the bounding box where west-long is the longitude of that point, and south_lat is the latitude. * east_long and north_lat represent the northeast corner of the bounding box, where east_long is the longitude of that point, and north_lat is the latitude. * Width and height of the bounding box must be less than 25mi * Longitude is in the range of ±180 * Latitude is in the range of ±90 * All coordinates are in decimal degrees. * Rule arguments are contained within brackets, space delimited. Note: operators matching on place (Post geo) will only include matches from original posts. Retweets do not contain any place data. | user.derived.locations.geo.coordinates |
profile_country: | PowerTrack Search | Exact match on the country code from the Profile Geo enrichment. Uses a normalized set of two-letter country codes, based on ISO-3166-1-alpha-2 specification. To be concise, this operator is provided in lieu of an operator for the country field from the address object. Note: operators matching on place (Post geo) will only include matches from original posts. Retweets do not contain any place data. | user.derived.locations.country_code |
profile_locality: | PowerTrack Search | Exact match on the Locality field from the Profile Geo enrichment. This is an exact full string match. It is not necessary to escape characters with a backslash. For example, if matching something with a slash, use one/two .Use double quotes to match substrings that contain whitespace or punctuation, e.g. profile_locality:"Lower East Side" . | user.derived.locations.locality |
profile_point_radius:[lon lat radius] | PowerTrack | Matches against the Exact Location (x,y) of the user’s Profile Geo enrichment. * Units of radius supported are miles (mi) and kilometers (km). * Radius must be less than 25mi. * Longitude is in the range of ±180 * Latitude is in the range of ±90 * All coordinates are in decimal degrees. * Rule arguments are contained within brackets, space delimited. Note: operators matching on place (Post geo) will only include matches from original posts. Retweets do not contain any place data. | user.derived.locations.geo |
profile_region: | PowerTrack Search | Exact match on the Region field from the Profile Geo enrichment. This is an exact full string match. It is not necessary to escape characters with a backslash. For example, if matching something with a slash, use one/two .Use double quotes to match substrings that contain whitespace or punctuation, e.g. profile_locality:"New York" . | user.derived.locations.region |
profile_subregion: | PowerTrack | Exact match on the Subregion field from the Profile Geo enrichment. This is an exact full string match. It is not necessary to escape characters with a backslash. For example, if matching something with a slash, use one/two .Use double quotes to match substrings that contain whitespace or punctuation, e.g. profile_locality:"Kings County" . | user.derived.locations.sub_region |
”keyword1 keyword2”~N | PowerTrack Search | Commonly referred to as a proximity operator, this matches a Post where the keywords are no more than N tokens from each other. If the keywords are in the opposite order, they can not be more than N-2 tokens from each other. Can have any number of keywords in quotes. N cannot be greater than 6. | text |
retweets_of_status_id: | PowerTrack | Available alias: retweets_of_tweet_id: Deliver only explicit Retweets of the specified original Post. | retweeted_status.id , retweeted_status.id_str |
retweets_of: | PowerTrack Search | Available alias: retweets_of_user: Matches any Post that are Retweets of the given user. The value can be either the username (excluding the @ character) or the user’s numeric ID or (obtained for example via the GET users/lookup endpoint). | retweeted_status.id (if present) |
sample: | PowerTrack | Returns a random percent sample of Posts that match a rule rather than the entire set of Posts. The percent value must be represented by an integer between 1 and 100. This operator applies to the entire rule and requires all OR’d terms to be grouped. Note: the sample operator first reduces the scope of the firehose to X%, then the rule/filter is applied to that sampled subset. If you are using, for example, sample:10 , each Post has a 10% chance of being in the sample. Note: the sampling is deterministic, and you will get the same data sample in realtime as you would if you pulled the data historically. | |
source: | PowerTrack | Matches any Post generated by the given source application. The value must be either the name of the application or the application’s URL. Cannot be used as a standalone operator. | source |
statuses_count: | PowerTrack | Available alias: tweets_count: Matches Posts when the author has posted a number of statuses that falls within the given range. * A single number (e.g. statuses_count:42 ) will match any number equal to or greater than the value specified.* A range (e.g. statuses_count:42..1337 ) will match any number in the given range. | user``.statuses_count |
to: | PowerTrack Search | Matches any Post that is in reply to a particular user. The value can be either the username (excluding the @ character) or the user’s numeric ID or (obtained for example via the GET users/lookup endpoint). | text |
url: | PowerTrack Search | Performs a tokenized match on the expanded URLs of a Post. Tokens and phrases containing punctuation or special characters should be double-quoted (e.g. url:"/developer" ).While generally not recommended, the operator can also match on a specific protocol, enclosed in double-quotes (e.g. url:"https://developer.twitter.com" ). | entities.urls.expanded_url |
url_contains: | PowerTrack | Performs a keyword/phrase match on the (new) expanded URL title metadata enrichment. | entities.urls.expanded_url |
url_description: | PowerTrack | Available alias: within_url_description: Performs a keyword/phrase match on the (new) expanded page description metadata enrichment. | entities.urls.unwound.description |
url_title: | PowerTrack | Available alias: within_url_title: Performs a keyword/phrase match on the (new) expanded URL title metadata enrichment. | entities.urls.title |