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

# 使用状況

> API の使用状況を監視し、ポストの利用量を追跡します

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

Usage エンドポイントでは、消費した投稿数を含む API の利用状況を監視できます。利用状況をプログラムから追跡して、コストを管理し、利用上限内に収まるようにできます。

<div id="overview">
  ## 概要
</div>

<CardGroup cols={2}>
  <Card title="投稿の利用状況" icon="chart-simple">
    消費された投稿数を追跡します
  </Card>

  <Card title="日別の内訳" icon="calendar-days">
    日ごとの利用状況を表示します
  </Card>

  <Card title="App レベル" icon="gauge">
    App 全体の利用状況を監視します
  </Card>
</CardGroup>

***

<div id="endpoint">
  ## エンドポイント
</div>

| Method | Endpoint                                       | Description       |
| :----- | :--------------------------------------------- | :---------------- |
| GET    | [`/2/usage/tweets`](/ja/x-api/usage/get-usage) | ポストの利用状況データを取得します |

***

<div id="response-data">
  ## レスポンスデータ
</div>

レスポンスには、日別のポスト消費数が含まれます。

```json theme={null}
{
  "data": {
    "daily_project_usage": [
      {
        "date": "2024-01-15",
        "usage": [
          {
            "app_id": "12345678",
            "tweets_consumed": 15420
          }
        ]
      }
    ],
    "project_id": "1234567890",
    "project_cap": 10000000
  }
}
```

<div id="fields">
  ### フィールド
</div>

| Field                 | Description      |
| :-------------------- | :--------------- |
| `daily_project_usage` | 1日ごとの利用データの配列    |
| `date`                | YYYY-MM-DD 形式の日付 |
| `app_id`              | お使いの App の ID    |
| `tweets_consumed`     | その日に消費されたツイート数   |
| `project_cap`         | 月間ポスト数の上限        |

***

<div id="example-request">
  ## リクエストの例
</div>

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

***

<div id="use-cases">
  ## ユースケース
</div>

* **コスト監視** — プラン上限に対する利用状況を追跡
* **アラート** — 上限に近づいたときのアラートを設定
* **最適化** — 利用量の多いエンドポイントを特定
* **レポーティング** — 利用レポートを生成

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

***

<div id="getting-started">
  ## はじめに
</div>

<Note>
  **前提条件**

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

<CardGroup cols={2}>
  <Card title="APIリファレンス" icon="code" href="/ja/x-api/usage/post-usage">
    エンドポイントに関する詳細ドキュメント
  </Card>

  <Card title="開発者コンソール" icon="gauge" href="https://developer.x.com/en/portal/dashboard">
    ダッシュボードで使用状況を確認できます
  </Card>
</CardGroup>
