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

# X API

> Xの投稿、ユーザー、スペースなどへのプログラムによるアクセス

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 X API を使うと、X 上の公開された会話にプログラムからアクセスできます。投稿を読み取り、コンテンツを投稿し、ユーザーを管理し、トレンドを分析できます。これらすべてを、柔軟な従量課金制料金を備えたモダンな REST エンドポイント経由で実現できます。

<CardGroup cols={3}>
  <Card title="はじめに" icon="rocket" href="/ja/x-api/getting-started/make-your-first-request">
    数分で App を作成し、最初のリクエストを送信しましょう。
  </Card>

  <Card title="APIリファレンス" icon="code" href="/ja/x-api/posts/create-post">
    利用可能なすべてのエンドポイントを確認できます。
  </Card>

  <Card title="SDK" icon="cube" href="/ja/xdks/overview">
    公式の Python および TypeScript ライブラリです。
  </Card>
</CardGroup>

***

<div id="what-you-can-build">
  ## 構築できるもの
</div>

<CardGroup cols={3}>
  <Card title="投稿" icon="message" href="/ja/x-api/posts/lookup/introduction">
    投稿を検索、取得、投稿します。タイムラインやスレッド、引用ポストにアクセスできます。
  </Card>

  <Card title="ユーザー" icon="user" href="/ja/x-api/users/lookup/introduction">
    ユーザーを検索し、フォロー、ブロック、ミュートを管理します。
  </Card>

  <Card title="スペース" icon="microphone" href="/ja/x-api/spaces/lookup/introduction">
    ライブ音声の会話とその参加者を見つけます。
  </Card>

  <Card title="ダイレクトメッセージ" icon="envelope" href="/ja/x-api/direct-messages/lookup/introduction">
    プライベートメッセージを送受信します。
  </Card>

  <Card title="リスト" icon="list" href="/ja/x-api/lists/list-lookup/introduction">
    アカウントの厳選リストを作成・管理します。
  </Card>

  <Card title="トレンド" icon="arrow-trend-up" href="/ja/x-api/trends/trends-by-woeid/introduction">
    地域ごとのトレンドトピックにアクセスします。
  </Card>
</CardGroup>

***

<div id="pricing">
  ## 料金
</div>

X API は **従量課金制** を採用しています。サブスクリプション契約や月額上限はなく、利用した分だけお支払いいただきます。

<CardGroup cols={2}>
  <Card title="柔軟なスケーリング" icon="chart-line">
    小規模から始めて成長させられます。コストは実際の利用量に応じてスケールします。
  </Card>

  <Card title="契約不要" icon="unlock">
    契約や最低利用金額は不要です。いつでも利用を停止できます。
  </Card>

  <Card title="リアルタイムトラッキング" icon="gauge-high">
    開発者コンソールで利用状況とコストをリアルタイムに確認できます。
  </Card>

  <Card title="クレジット制" icon="coins">
    事前にクレジットを購入し、API の利用に応じて消費されます。
  </Card>
</CardGroup>

<div className="mt-6 flex gap-4">
  <Button href="/ja/x-api/getting-started/pricing">料金の詳細</Button>
  <Button href="https://console.x.com">クレジットを購入</Button>
</div>

***

<div id="key-features">
  ## 主な機能
</div>

<Tabs>
  <Tab title="データアクセス">
    ### リッチなデータオブジェクト

    投稿、ユーザー、メディアなどについて、詳細で構造化されたデータにアクセスできます。

    * **投稿**: テキスト全文、メトリクス、エンティティ、アノテーション、会話スレッド
    * **ユーザー**: プロフィール、フォロワー数、認証状況
    * **メディア**: メタデータ付き画像、動画、GIF
    * **投票**: 選択肢および投票数

    [fields](/ja/x-api/fundamentals/fields) と [expansions](/ja/x-api/fundamentals/expansions) を使ってレスポンスをカスタマイズし、必要なデータだけを取得できます。
  </Tab>

  <Tab title="リアルタイムストリーミング">
    ### フィルタ済みストリーム

    投稿が公開され次第、リアルタイムで受信します。最大 1,000 個のフィルタリングルールを定義して、一致する投稿のみを受け取ることができます。

    ```bash theme={null}
    # ルールを追加
    curl -X POST "https://api.x.com/2/tweets/search/stream/rules" \
      -H "Authorization: Bearer $TOKEN" \
      -d '{"add": [{"value": "from:xdevelopers"}]}'

    # ストリームへ接続
    curl "https://api.x.com/2/tweets/search/stream" \
      -H "Authorization: Bearer $TOKEN"
    ```

    [フィルタ済みストリームの詳細 →](/ja/x-api/posts/filtered-stream/introduction)
  </Tab>

  <Tab title="検索と分析">
    ### 全アーカイブ検索

    2006 年までさかのぼる公開投稿の履歴全体を検索できます。ユーザー、キーワード、日付などのオペレーターを使ってクエリを構築できます。

    ```bash theme={null}
    curl "https://api.x.com/2/tweets/search/all?query=AI%20lang:en" \
      -H "Authorization: Bearer $TOKEN"
    ```

    ### メトリクス

    インプレッション、いいね、リポスト、返信、動画再生数などのエンゲージメントメトリクスにアクセスできます。

    [検索の詳細 →](/ja/x-api/posts/search/introduction)
  </Tab>
</Tabs>

***

<div id="api-versions">
  ## API バージョン
</div>

| バージョン          | ステータス | 説明                          |
| :------------- | :---- | :-------------------------- |
| **v2**         | 現行    | モダンなエンドポイント、柔軟な料金体系、すべての新機能 |
| **Enterprise** | 利用可能  | 専任サポート付きの大規模アクセス            |

<Tip>
  新しいプロジェクトには **X API v2** を使用してください。新機能や改善はすべてこのバージョンで提供されます。
</Tip>

***

<div id="quick-start">
  ## クイックスタート
</div>

<Steps>
  <Step title="開発者アカウントを作成する">
    [console.x.com](https://console.x.com) にサインアップして、App を作成します。
  </Step>

  <Step title="認証情報を取得する">
    App-only リクエスト用のベアラートークンを生成します。
  </Step>

  <Step title="リクエストを送信する">
    ユーザー情報を取得してみましょう:

    ```bash theme={null}
    curl "https://api.x.com/2/users/by/username/xdevelopers" \
      -H "Authorization: Bearer $BEARER_TOKEN"
    ```
  </Step>
</Steps>

<Button href="/ja/x-api/getting-started/make-your-first-request">クイックスタートガイドの全文</Button>

***

<div id="tools-libraries">
  ## ツールとライブラリ
</div>

<CardGroup cols={3}>
  <Card title="Python SDK" icon="python" href="/ja/xdks/python/overview">
    非同期処理対応の公式 Python ライブラリ。
  </Card>

  <Card title="TypeScript SDK" icon="js" href="/ja/xdks/typescript/overview">
    公式 TypeScript/JavaScript ライブラリ。
  </Card>

  <Card title="Postman" icon="server" href="https://app.getpostman.com/run-collection/9956214-784efcda-ed4c-4491-a4c0-a26470a67400">
    インタラクティブな API エクスプローラー。
  </Card>
</CardGroup>

[すべてのツールとライブラリを表示 →](/ja/x-api/tools-and-libraries/overview)

***

<div id="support">
  ## サポート
</div>

<CardGroup cols={2}>
  <Card title="開発者フォーラム" icon="comments" href="https://devcommunity.x.com">
    コミュニティやXチームからヘルプを得られます。
  </Card>

  <Card title="サポートハブ" icon="circle-question" href="https://developer.x.com/en/support/twitter-api.html">
    FAQやトラブルシューティングガイドを提供しています。
  </Card>
</CardGroup>
