> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-mintlify-24fef6d1.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-24fef6d1/HazjhzcnQyryvfGR/icons/xds/icon-rocket.svg?fit=max&auto=format&n=HazjhzcnQyryvfGR&q=85&s=d0f5cef99b2c696bbfb49fa10afdd62f" 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-24fef6d1/Rr7J7_M_U1YKwpT1/icons/xds/icon-code.svg?fit=max&auto=format&n=Rr7J7_M_U1YKwpT1&q=85&s=91f901377ed7f56087005ca8f2202ae3" 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-24fef6d1/HazjhzcnQyryvfGR/icons/xds/icon-rocket.svg?fit=max&auto=format&n=HazjhzcnQyryvfGR&q=85&s=d0f5cef99b2c696bbfb49fa10afdd62f" 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-24fef6d1/Rr7J7_M_U1YKwpT1/icons/xds/icon-code.svg?fit=max&auto=format&n=Rr7J7_M_U1YKwpT1&q=85&s=91f901377ed7f56087005ca8f2202ae3" 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-24fef6d1/Y9anV6Yuzgh5cdxI/icons/xds/icon-search.svg?fit=max&auto=format&n=Y9anV6Yuzgh5cdxI&q=85&s=390162fcdf84bf652d239618065e59df" 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-24fef6d1/r5kq0chEtxapqq3m/icons/xds/icon-arrow-right.svg?fit=max&auto=format&n=r5kq0chEtxapqq3m&q=85&s=01a7ecb4e4e2881e3c0000aa212ad814" 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-24fef6d1/r5kq0chEtxapqq3m/icons/xds/icon-book.svg?fit=max&auto=format&n=r5kq0chEtxapqq3m&q=85&s=9159c974d1dbc9f6988e28466c342ea4" 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>
