> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Posts

> The Search Posts endpoints let you find Posts matching specific criteria using powerful query. Reference for the X API v2 standard tier covering search.

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

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:

<CardGroup cols={2}>
  <Card title="Recent Search" icon="clock">
    Search Posts from the **last 7 days**. Available to all developers.
  </Card>

  <Card title="Full-Archive Search" icon="vault">
    Search the **complete archive** back to 2006. Available to pay-per-use and Enterprise customers.
  </Card>
</CardGroup>

***

## 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`](/x-api/posts/search-recent-posts) | Search Posts from last 7 days | All developers          |
| GET    | [`/2/tweets/search/all`](/x-api/posts/search-all-posts)       | 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
```

<AccordionGroup>
  <Accordion title="Keyword operators">
    | 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     |
  </Accordion>

  <Accordion title="User operators">
    | 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 |
  </Accordion>

  <Accordion title="Content operators">
    | 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 |
  </Accordion>

  <Accordion title="Filter operators">
    | 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 |
  </Accordion>
</AccordionGroup>

<Card title="Full operator reference" icon="list-check" href="/x-api/posts/search/integrate/operators">
  See all available operators and their access requirements
</Card>

***

## 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)

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/x-api/posts/search/quickstart/recent-search">
    Make your first recent search request
  </Card>

  <Card title="API Reference" icon="code" href="/x-api/posts/search-recent-posts">
    Full endpoint documentation
  </Card>
</CardGroup>

***

## Full-Archive Search

Search the **complete Post archive** dating back to March 2006.

<Note>
  Full-archive search is available to pay-per-use and Enterprise customers.
</Note>

### 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)

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/x-api/posts/search/quickstart/full-archive-search">
    Make your first full-archive search request
  </Card>

  <Card title="API Reference" icon="code" href="/x-api/posts/search-all-posts">
    Full endpoint documentation
  </Card>
</CardGroup>

***

## Getting started

<Note>
  **Prerequisites**

  * An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * A [Project and App](/resources/fundamentals/developer-apps) in the Developer Console
  * Your App's [keys and tokens](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="Build a query" icon="magnifying-glass" href="/x-api/posts/search/integrate/build-a-query">
    Learn query syntax and operators
  </Card>

  <Card title="Pagination" icon="arrow-right" href="/x-api/posts/search/integrate/paginate">
    Navigate through large result sets
  </Card>

  <Card title="Integration guide" icon="book" href="/x-api/posts/search/integrate/overview">
    Key concepts and best practices
  </Card>

  <Card title="Sample code" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    Working code examples
  </Card>
</CardGroup>
