Skip to main content
The Search Posts endpoints let you find Posts matching specific criteria using powerful query operators. Search for keywords, hashtags, mentions, URLs, and more.

Overview

X offers two search endpoints with different time ranges and access requirements:

Recent Search

Search Posts from the last 7 days. Available to all developers.

Full-Archive Search

Search the complete archive back to 2006. Available to pay-per-use and Enterprise customers.

Use cases

  • Brand monitoring — Track mentions of your brand or products
  • Trend analysis — Analyze conversations around topics or events
  • Research — Gather data for academic or market research
  • Real-time listening — Build applications that react to new Posts

Endpoints

MethodEndpointDescriptionAccess
GET/2/tweets/search/recentSearch Posts from last 7 daysAll developers
GET/2/tweets/search/allSearch complete Post archivePay-per-use, Enterprise

Query operators

Build queries using operators that match on Post attributes:
(AI OR "artificial intelligence") lang:en -is:retweet has:links
OperatorExampleDescription
KeywordpythonMatch Posts containing the word
Phrase"machine learning"Match exact phrase
Hashtag#AIMatch Posts with hashtag
Mention@XDevelopersMatch Posts mentioning user
OperatorExampleDescription
from:from:elonmuskPosts by a user
to:to:XDevelopersReplies to a user
retweets_of:retweets_of:XRetweets of a user’s Posts
OperatorExampleDescription
has:imagescat has:imagesPosts with images
has:videoshas:videosPosts with videos
has:linkshas:linksPosts with links
has:mentionshas:mentionsPosts with mentions
url:url:github.comPosts with specific URL
OperatorExampleDescription
lang:lang:enPosts in a language
-is:retweet-is:retweetExclude retweets
-is:reply-is:replyExclude replies
is:verifiedis:verifiedPosts by verified users

Full operator reference

See all available operators and their access requirements

Search Posts from the last 7 days. Available to all developers.

Features

  • Up to 100 Posts per request
  • Pagination for large result sets
  • All core query operators
  • 512-character query length (4,096 for Enterprise)

Search the complete Post archive dating back to March 2006.
Full-archive search is available to pay-per-use and Enterprise customers.

Features

  • Up to 500 Posts per request
  • Access to complete Post history
  • All query operators available
  • 1,024-character query length (4,096 for Enterprise)

Getting started

Prerequisites