Skip to main content
The search endpoints accept a single query with a GET request and return a set of historical Posts that match the query. Queries are made up of operators that match on a variety of Post attributes.

Query limitations

Your queries will be limited depending on which access level you are using:
Access levelRecent searchFull-archive search
Self-serve512 characters1,024 characters
Enterprise4,096 characters4,096 characters

Operator availability

While most operators are available to any developer, some are reserved for certain access levels:
  • Core operators: Available when using any Project
  • Advanced operators: Available when using a Project with certain access levels
See the complete list of operators for availability details.

Operator types: standalone and conjunction-required

Standalone operators can be used alone or together with any other operators (including those that require conjunction). For example, this query works because #hashtag is a standalone operator:
Conjunction-required operators cannot be used by themselves in a query; they can only be used when at least one standalone operator is included. This is because using these operators alone would match an extremely high volume of Posts. For example, the following queries are not supported since they contain only conjunction-required operators:
If we add a standalone operator, such as the phrase "X data", the query works properly:

Boolean operators and grouping

String together multiple operators using these tools:
OperatorDescriptionExample
AND (space)Posts must match both conditionssnow day #NoSchool matches Posts with “snow” AND “day” AND #NoSchool
ORPosts must match either conditiongrumpy OR cat OR #meme matches Posts with “grumpy” OR “cat” OR #meme
NOT (dash)Exclude Posts matching this conditioncat #meme -grumpy matches Posts with “cat” and #meme but NOT “grumpy”
Grouping (parentheses)Group operators together(grumpy cat) OR (#meme has:images) matches either group
A note on negations
  • The operator -is:nullcast must always be negated
  • Negated operators cannot be used alone
  • Do not negate grouped operators. Instead of skiing -(snow OR day OR noschool), use skiing -snow -day -noschool

Order of operations

When combining AND and OR:
  1. Operators connected by AND logic are combined first
  2. Then, operators connected with OR logic are applied
Examples:
QueryEvaluated as
apple OR iphone ipadapple OR (iphone ipad)
ipad iphone OR android(iphone ipad) OR android
To eliminate uncertainty, use parentheses:

Punctuation, diacritics, and case sensitivity

Diacritics: Search queries with accents or diacritics match Posts both with and without the accents. For example, Diacrítica matches both Diacrítica and Diacritica. Case sensitivity: All operators are case-insensitive. The query cat matches cat, CAT, and Cat.
Filtered stream behaves differentlyWhen building filtered stream rules, keywords with accents only match Posts that also include the accent. For example, Diacrítica only matches Diacrítica, not Diacritica.

Quote Tweet matching

When using Search Posts, operators match on the Quote Tweet’s content but not on the content from the original Post that was quoted.
Filtered stream behaves differently—it matches on both the Quote Tweet and the original Post’s content.

Specificity and efficiency

Using broad operators like a single keyword or hashtag is not recommended—it will match a massive volume of Posts and quickly consume your usage limits.
Tips for building effective queries:
  1. Start specific, then broaden — Create targeted queries that return relevant results
  2. Use multiple operators — Combine operators to narrow results
  3. Watch your character count — The entire query string counts toward the limit
Example progression:

Iteratively building a query

Step 1: Start with a basic query

Step 2: Test and narrow based on results

We noticed Posts in many languages. Add a language filter:
We’re getting birthday wishes. Exclude them and Retweets:

Step 3: Broaden for better coverage

We want to capture more sentiment. Add related keywords:
Holiday Posts are appearing. Exclude them:

Adding a query to your request

Use the query parameter and HTTP encode your query:

Query examples

Tracking a natural disaster

Match Posts from weather agencies about Hurricane Harvey: Query:
Full request URL:

Sentiment analysis for #nowplaying

Positive sentiment:
Negative sentiment:

Using Post annotations

Find Japanese Posts about pets (not cats) with images using the context: operator: First, use Post lookup with tweet.fields=context_annotations to identify domain.entity IDs:
  • Cats: domain 66, entity 852262932607926273
  • Pets: domain 65, entity 852262932607926273
Query:

Tools

Query Builder Tool

Build and test your queries interactively

Next steps

Operators reference

Complete list of available operators

Search quickstart

Make your first search request

Integration guide

Full integration documentation