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

# 使用状況

> Usage エンドポイントを使用すると、消費した Post 数などの API 使用状況を監視できます。X API v2 standard tier の usage に関するリファレンスです。

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

Usage エンドポイントを使用すると、消費した Post 数などの API 使用状況を監視できます。使用状況をプログラム的に追跡することで、コストを管理し、制限内に収めることができます。

<Note>
  従量課金プランには、月間 200 万 Post 読み取りの上限が設定されています。より大量の利用が必要な場合は、[Enterprise プラン](/forms/enterprise-api-interest)を検討してください。
</Note>

## 概要

<CardGroup cols={2}>
  <Card title="Post 使用状況" icon="chart-simple">
    消費した Post を追跡
  </Card>

  <Card title="日次内訳" icon="calendar-days">
    日単位で使用状況を表示
  </Card>

  <Card title="アプリレベル" icon="gauge">
    アプリ全体の使用状況を監視
  </Card>
</CardGroup>

***

## エンドポイント

| Method | Endpoint                                    | 説明              |
| :----- | :------------------------------------------ | :-------------- |
| GET    | [`/2/usage/tweets`](/x-api/usage/get-usage) | Post 使用状況データを取得 |

***

## レスポンスデータ

レスポンスには日次の Post 消費数が含まれます:

```json title="レスポンス例" lines wrap icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-brackets.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=ed2428e77bab43e57800e1a590e982fa" theme={null}
{
  "data": {
    "daily_project_usage": [
      {
        "date": "2024-01-15",
        "usage": [
          {
            "app_id": "12345678",
            "tweets_consumed": 15420
          }
        ]
      }
    ],
    "project_id": "1234567890",
    "project_cap": 10000000
  }
}
```

### フィールド

| Field                 | 説明               |
| :-------------------- | :--------------- |
| `daily_project_usage` | 日次使用状況データの配列     |
| `date`                | YYYY-MM-DD 形式の日付 |
| `app_id`              | アプリの ID          |
| `tweets_consumed`     | その日に消費した Post 数  |
| `project_cap`         | 月間 Post 上限       |

***

## リクエスト例

```bash theme={null}
curl "https://api.x.com/2/usage/tweets" \
  -H "Authorization: Bearer $BEARER_TOKEN"
```

***

## ユースケース

* **コスト監視** — 予算に対して消費量を追跡
* **アラート** — 上限に近づいたときにアラートを設定
* **最適化** — 消費量の多いエンドポイントを特定
* **レポート** — 使用状況レポートを生成

<Tip>
  リソースは 24 時間の UTC ウィンドウ内で重複排除されるため、1 日に同じリソースを複数回リクエストしても課金は 1 回のみとしてカウントされます。[料金について詳しく見る →](/x-api/getting-started/pricing)
</Tip>

***

## はじめに

<Note>
  **前提条件**

  * 承認済みの[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * Developer Console の[プロジェクトとアプリ](/resources/fundamentals/developer-apps)
  * アプリの [Bearer Token](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <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/usage/post-usage" width="24" height="24" data-path="icons/xds/icon-code.svg">
    完全なエンドポイントドキュメント
  </Card>

  <Card title="Developer Console" icon="gauge" href="https://developer.x.com/en/portal/dashboard">
    ダッシュボードで使用状況を表示
  </Card>
</CardGroup>
