Skip to content

Latest commit

 

History

History
180 lines (140 loc) · 6.35 KB

File metadata and controls

180 lines (140 loc) · 6.35 KB
title Search Posts
sidebarTitle Introduction
description Search recent Posts or the full X archive using query operators for keywords, hashtags, users, geo, language, and engagement thresholds.
keywords
search tweets
search posts
recent search
full archive search
tweet search
search API
search queries
search operators
historical search

import { Button } from '/snippets/button.mdx';

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:

Search Posts from the **last 7 days**. Available to all developers. 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

Method Endpoint Description Access
GET /2/tweets/search/recent Search Posts from last 7 days All developers
GET /2/tweets/search/all Search complete Post archive Pay-per-use, Enterprise

Query operators

Build queries using operators that match on Post attributes:

(AI OR "artificial intelligence") lang:en -is:retweet has:links
| Operator | Example | Description | |:---------|:--------|:------------| | Keyword | `python` | Match Posts containing the word | | Phrase | `"machine learning"` | Match exact phrase | | Hashtag | `#AI` | Match Posts with hashtag | | Mention | `@XDevelopers` | Match Posts mentioning user | | Operator | Example | Description | |:---------|:--------|:------------| | `from:` | `from:elonmusk` | Posts by a user | | `to:` | `to:XDevelopers` | Replies to a user | | `retweets_of:` | `retweets_of:X` | Retweets of a user's Posts | | Operator | Example | Description | |:---------|:--------|:------------| | `has:images` | `cat has:images` | Posts with images | | `has:videos` | `has:videos` | Posts with videos | | `has:links` | `has:links` | Posts with links | | `has:mentions` | `has:mentions` | Posts with mentions | | `url:` | `url:github.com` | Posts with specific URL | | Operator | Example | Description | |:---------|:--------|:------------| | `lang:` | `lang:en` | Posts in a language | | `-is:retweet` | `-is:retweet` | Exclude retweets | | `-is:reply` | `-is:reply` | Exclude replies | | `is:verified` | `is:verified` | Posts by verified users | | Operator | Example | Description | |:---------|:--------|:------------| | `min_likes:` | `coffee min_likes:100` | Posts with at least N likes | | `min_replies:` | `from:XDevelopers min_replies:10` | Posts with at least N replies | | `min_reposts:` | `#launch min_reposts:50` | Posts with at least N reposts | As of May 4, 2026, the keyword-based search endpoints (`/2/tweets/search/recent`, `/2/tweets/search/all`, `/2/tweets/counts/recent`, `/2/tweets/counts/all`) run on the new X core platform search index. Retweets are no longer returned in keyword-based search results — use the `retweets_of:` operator, `GET /2/tweets/:id/retweets`, or the [Filtered Stream](/x-api/posts/filtered-stream/introduction) (unchanged) if you need retweet coverage. See all available operators and their access requirements

Recent Search

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)
Make your first recent search request Full endpoint documentation

Full-Archive Search

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)
Make your first full-archive search request Full endpoint documentation

Getting started

**Prerequisites** Learn query syntax and operators Navigate through large result sets Key concepts and best practices Working code examples