> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-mintlify-b4f5bfb1.mintlify.site/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">
    <a href={href}>
      <button className="x-btn">
        <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="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/CJEW78ZoFC_WB4AV/icons/xds/icon-rocket.svg?fit=max&auto=format&n=CJEW78ZoFC_WB4AV&q=85&s=c4d643f2a562a30abeccca3349337f50" href="/x-api/posts/search/quickstart/recent-search" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    Make your first recent search request
  </Card>

  <Card title="API Reference" icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/NEh9mjpH7RaTDEed/icons/xds/icon-code.svg?fit=max&auto=format&n=NEh9mjpH7RaTDEed&q=85&s=07116236bb3000cffffbf6c9bac6d47e" href="/x-api/posts/search-recent-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    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="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/CJEW78ZoFC_WB4AV/icons/xds/icon-rocket.svg?fit=max&auto=format&n=CJEW78ZoFC_WB4AV&q=85&s=c4d643f2a562a30abeccca3349337f50" href="/x-api/posts/search/quickstart/full-archive-search" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    Make your first full-archive search request
  </Card>

  <Card title="API Reference" icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/NEh9mjpH7RaTDEed/icons/xds/icon-code.svg?fit=max&auto=format&n=NEh9mjpH7RaTDEed&q=85&s=07116236bb3000cffffbf6c9bac6d47e" href="/x-api/posts/search-all-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    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="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/Y4pnhTTwR7PxYSWw/icons/xds/icon-search.svg?fit=max&auto=format&n=Y4pnhTTwR7PxYSWw&q=85&s=34acaf7217390e86b285fcf3114b1cee" href="/x-api/posts/search/integrate/build-a-query" width="24" height="24" data-path="icons/xds/icon-search.svg">
    Learn query syntax and operators
  </Card>

  <Card title="Pagination" icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/E43Ep5Gv29gM6HJ6/icons/xds/icon-arrow-right.svg?fit=max&auto=format&n=E43Ep5Gv29gM6HJ6&q=85&s=ab95fcf5215877b9c525148bc0e3542c" href="/x-api/posts/search/integrate/paginate" width="24" height="24" data-path="icons/xds/icon-arrow-right.svg">
    Navigate through large result sets
  </Card>

  <Card title="Integration guide" icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/E43Ep5Gv29gM6HJ6/icons/xds/icon-book.svg?fit=max&auto=format&n=E43Ep5Gv29gM6HJ6&q=85&s=58d2163a527af71742b049fc4dc92669" href="/x-api/posts/search/integrate/overview" width="24" height="24" data-path="icons/xds/icon-book.svg">
    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>
