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

> Search Posts エンドポイントを使用して、強力なクエリ演算子で特定の条件に一致する投稿を検索できます。search を扱う X API v2 スタンダードティアのリファレンス。

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>;
};

Search Posts エンドポイントを使用して、強力なクエリ演算子で特定の条件に一致する投稿を検索できます。キーワード、ハッシュタグ、メンション、URL などで検索できます。

## 概要

X は異なる期間とアクセス要件を持つ 2 種類の search エンドポイントを提供します:

<CardGroup cols={2}>
  <Card title="Recent Search" icon="clock">
    **直近 7 日間**の投稿を検索。すべての開発者が利用可能。
  </Card>

  <Card title="Full-Archive Search" icon="vault">
    2006 年までさかのぼる**完全アーカイブ**を検索。従量課金と Enterprise のお客様が利用可能。
  </Card>
</CardGroup>

***

## ユースケース

* **ブランドモニタリング** — 自身のブランドや製品のメンションを追跡
* **トレンド分析** — トピックやイベントに関する会話を分析
* **リサーチ** — 学術または市場調査用データを収集
* **リアルタイムリスニング** — 新規投稿に反応するアプリケーションを構築

***

## エンドポイント

| Method | Endpoint                                                      | Description   | Access          |
| :----- | :------------------------------------------------------------ | :------------ | :-------------- |
| GET    | [`/2/tweets/search/recent`](/x-api/posts/search-recent-posts) | 直近 7 日間の投稿を検索 | すべての開発者         |
| GET    | [`/2/tweets/search/all`](/x-api/posts/search-all-posts)       | 投稿の完全アーカイブを検索 | 従量課金、Enterprise |

***

## クエリ演算子

投稿属性に一致する演算子を使ってクエリを構築します:

```
(AI OR "artificial intelligence") lang:en -is:retweet has:links
```

<AccordionGroup>
  <Accordion title="キーワード演算子">
    | Operator | Example              | Description        |
    | :------- | :------------------- | :----------------- |
    | Keyword  | `python`             | その語を含む投稿にマッチ       |
    | Phrase   | `"machine learning"` | 完全一致フレーズにマッチ       |
    | Hashtag  | `#AI`                | ハッシュタグを含む投稿にマッチ    |
    | Mention  | `@XDevelopers`       | ユーザーをメンションする投稿にマッチ |
  </Accordion>

  <Accordion title="ユーザー演算子">
    | Operator       | Example          | Description      |
    | :------------- | :--------------- | :--------------- |
    | `from:`        | `from:elonmusk`  | ユーザーの投稿          |
    | `to:`          | `to:XDevelopers` | ユーザーへの返信         |
    | `retweets_of:` | `retweets_of:X`  | ユーザーの投稿の Retweet |
  </Accordion>

  <Accordion title="コンテンツ演算子">
    | Operator       | Example          | Description  |
    | :------------- | :--------------- | :----------- |
    | `has:images`   | `cat has:images` | 画像を含む投稿      |
    | `has:videos`   | `has:videos`     | 動画を含む投稿      |
    | `has:links`    | `has:links`      | リンクを含む投稿     |
    | `has:mentions` | `has:mentions`   | メンションを含む投稿   |
    | `url:`         | `url:github.com` | 特定 URL を含む投稿 |
  </Accordion>

  <Accordion title="フィルター演算子">
    | Operator      | Example       | Description |
    | :------------ | :------------ | :---------- |
    | `lang:`       | `lang:en`     | ある言語の投稿     |
    | `-is:retweet` | `-is:retweet` | retweet を除外 |
    | `-is:reply`   | `-is:reply`   | 返信を除外       |
    | `is:verified` | `is:verified` | 認証ユーザーの投稿   |
  </Accordion>
</AccordionGroup>

<Card title="完全な演算子リファレンス" icon="list-check" href="/x-api/posts/search/integrate/operators">
  利用可能なすべての演算子とアクセス要件を確認
</Card>

***

## Recent Search

**直近 7 日間**の投稿を検索。すべての開発者が利用可能。

### 特徴

* リクエストあたり最大 100 投稿
* 大規模結果セット用のページネーション
* すべての core クエリ演算子
* 512 文字のクエリ長(Enterprise は 4,096 文字)

<CardGroup cols={2}>
  <Card title="クイックスタート" icon="https://mintcdn.com/x-preview/oR-aRNyj1BKPJtxM/icons/xds/icon-rocket.svg?fit=max&auto=format&n=oR-aRNyj1BKPJtxM&q=85&s=b978d7a9225de31709efbbed5b84e92d" href="/x-api/posts/search/quickstart/recent-search" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    最初の recent search リクエストを行う
  </Card>

  <Card title="API リファレンス" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-code.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=488e23401b19225b89acc0136d242219" href="/x-api/posts/search-recent-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの完全なドキュメント
  </Card>
</CardGroup>

***

## Full-Archive Search

2006 年 3 月までさかのぼる**投稿の完全アーカイブ**を検索します。

<Note>
  Full-archive search は従量課金と Enterprise のお客様が利用できます。
</Note>

### 特徴

* リクエストあたり最大 500 投稿
* 完全な投稿履歴へのアクセス
* すべてのクエリ演算子が利用可能
* 1,024 文字のクエリ長(Enterprise は 4,096 文字)

<CardGroup cols={2}>
  <Card title="クイックスタート" icon="https://mintcdn.com/x-preview/oR-aRNyj1BKPJtxM/icons/xds/icon-rocket.svg?fit=max&auto=format&n=oR-aRNyj1BKPJtxM&q=85&s=b978d7a9225de31709efbbed5b84e92d" href="/x-api/posts/search/quickstart/full-archive-search" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    最初の full-archive search リクエストを行う
  </Card>

  <Card title="API リファレンス" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-code.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=488e23401b19225b89acc0136d242219" href="/x-api/posts/search-all-posts" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの完全なドキュメント
  </Card>
</CardGroup>

***

## はじめる

<Note>
  **前提条件**

  * 承認済みの[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * 開発者コンソール内の [Project と App](/resources/fundamentals/developer-apps)
  * App の[キーとトークン](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="クエリを組み立てる" icon="https://mintcdn.com/x-preview/cfyQtgCdwk8p69aa/icons/xds/icon-search.svg?fit=max&auto=format&n=cfyQtgCdwk8p69aa&q=85&s=8c11ad89387b7c09ced1553d5c232834" href="/x-api/posts/search/integrate/build-a-query" width="24" height="24" data-path="icons/xds/icon-search.svg">
    クエリ構文と演算子を学ぶ
  </Card>

  <Card title="ページネーション" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-arrow-right.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=88e933002782dbdeb204043cedef033e" href="/x-api/posts/search/integrate/paginate" width="24" height="24" data-path="icons/xds/icon-arrow-right.svg">
    大規模な結果セットを移動
  </Card>

  <Card title="統合ガイド" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-book.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=22ac564792481d14ae36a941546039c8" href="/x-api/posts/search/integrate/overview" width="24" height="24" data-path="icons/xds/icon-book.svg">
    主要な概念とベストプラクティス
  </Card>

  <Card title="サンプルコード" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    動作するコード例
  </Card>
</CardGroup>
