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

# ステップバイステップガイド

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

<div id="how-to-get-access-to-the-ads-api">
  ## Ads API へのアクセス方法
</div>

1. [開発者アカウント](https://developer.x.com/en/apply-for-access)に登録します。
2. [開発者 App](https://developer.x.com/app)を作成し、トークンを安全に保管します。
3. [ads.x.com/help](https://ads.x.com/help) にアクセスし、各開発者 App ごとに Ads API へのアクセスを申請します。

<Note>**注:** すでに X Developer Platform 上で開発を行っており、開発者アカウントをお持ちの場合は、手順 3 から始めてください。</Note>

<div id="step-one-signup-for-a-developer-account">
  ### ステップ1：開発者アカウントに登録する
</div>

X の API プロダクトにリクエストを送信するには、まず開発者アカウントに登録する必要があります。開発者コンソールで App と Developer App を作成します。これにより、API へのすべてのリクエストの認証に使用する認証情報一式が発行されます。

<Button href="https://developer.x.com/en/apply-for-access">
  開発者アカウントに登録する
</Button>

<div id="step-two-save-your-apps-key-and-tokens-and-keep-them-secure">
  ### ステップ 2: App のキーとトークンを保存し、安全に保管する
</div>

開発者コンソール上の App では、API Keys（Consumer Keys とも呼ばれます）のセットが提供されます。さらに、ご自身の X 個人アカウントに代わってリクエストを送信するために使用できる Access Tokens のセット、および OAuth 2.0 ベアラートークンを必要とするエンドポイントの認証に使用できるベアラートークンも生成できます。これらのキーとトークンは再生成しない限り有効期限が切れないため、環境変数として保存するか、安全なパスワードマネージャーで管理することを推奨します。

また、App の詳細ページの URL に表示されている App ID も控えておいてください。次のステップで Ads API へのアクセスを申請する際に役立ちます。

<Note>
  **注:** キーとトークンは開発者コンソール上で一度しか表示されないため、生成したらすぐにこれらの認証情報をパスワード管理システムに保存することが重要です。

  キーやトークンを紛失したり忘れたりした場合は、それらを再生成する必要があります。再生成すると新しいキーとトークンが作成され、古いものは無効になります。これは、以前の認証情報を使用して設定していたすべての連携について、認証情報の更新が必要になることを意味します。

  当社の[認証に関するベストプラクティス](https://developer.x.com/en/docs/authentication/guides/authentication-best-practices)について、詳しくはこちらをご覧ください。
</Note>

<div id="step-three-apply-for-access-to-the-ads-api">
  ### ステップ3：Ads API へのアクセスを申請する
</div>

この時点で、すでに [X API への Basic access](https://developer.x.com/en/docs/twitter-api/v1) はありますが、X Ads API の機能にはまだアクセスできません。次に、Ads API へのアクセスを申請し、承認を受ける必要があります。[ads.x.com/help](https://ads.x.com/help) にアクセスして、各開発者 App ごとに Ads API へのアクセス申請を行ってください。

<div id="access-tiers">
  ### アクセスレベル
</div>

申請プロセスでは、必要なアクセスレベルを指定する必要があります。詳しくは、[App レベルおよび広告アカウントレベルの権限](https://developer.x.com/en/docs/twitter-ads-api/obtaining-ads-account-access#levels-of-access)をご覧ください。

<div id="conversion-only">
  #### コンバージョンのみ
</div>

Mobile および Web のコンバージョン用エンドポイントへの読み書きアクセス権。

<div id="standard-access">
  #### 標準アクセス
</div>

Analytics、Campaign Management、Creatives、Custom Audiences、Conversion エンドポイントに対する読み取りおよび書き込みアクセス。

<Note>**注意:** App が Ads API へのアクセス承認を受けた後、正しく[認証された Ads API リクエスト](https://developer.x.com/en/docs/twitter-ads-api/making-authenticated-requests)を行うためには、[ユーザーアクセストークンを再生成](https://developer.x.com/resources/fundamentals/authentication/obtaining-user-access-tokens)する必要があります。</Note>

<Note>**注意:** 2023 年 7 月以前にアクセスをリクエストした Ads API 開発者は、アクセスレベルや権限が異なる場合があり、OAuth トークンが最大 5 個に制限されている可能性があります。追加のエンドポイントへのアクセスや既存アプリケーションのトークン上限を解除する方法については、[アクセスの拡張](https://developer.x.com/en/docs/twitter-ads-api/increasing-access)に関するガイドを参照してください。</Note>

<div id="make-your-first-request">
  ## 最初のリクエストを送信する
</div>

Ads API へのアクセスをテストするには、[GET accounts](https://developer.x.com/en/docs/twitter-ads-api/campaign-management/api-reference/accounts) エンドポイントにリクエストを送信します。このエンドポイントは、現在認可されているユーザーがアクセスできる広告アカウントを返します。このリクエストで取得した広告アカウントの id を、後続の API リクエストで使用して、特定の広告アカウントのデータを読み書きします。コマンドラインで [Twurl](https://developer.x.com/en/docs/tutorials/using-twurl) を使用する場合、リクエストは次のようになります。

**リクエスト例**

```bash theme={null}
twurl -H ads-api.x.com "/11/accounts"
```

**レスポンス例**

```json theme={null}
{
  "request": {
    "params": {}
  },
  "data": [
   {
    "name": "Furni",
    "business_name": null,
    "timezone": "America/Los_Angeles",
    "timezone_switch_at": "2016-04-06T07:00:00Z",
    "id": "18ce54ayf0z",
    "created_at": "2016-04-07T14:40:15Z",
    "salt": "b88939e5cabbca720159cb3659d73c06",
    "updated_at": "2017-02-08T08:49:53Z",
    "business_id": null,
    "approval_status": "ACCEPTED",
    "deleted": false
     }
   ]
}
```

<div id="up-next">
  ## 次のステップ . . .
</div>

* [Ads API ドキュメント](https://developer.x.com/en/docs/twitter-ads-api)で、[バージョニング](https://developer.x.com/en/docs/twitter-ads-api/versioning)や[階層構造](https://developer.x.com/en/docs/twitter-ads-api/hierarchy-terminology)などの基本事項に一通り目を通しましょう。
* Ads API との連携に役立つ、さまざまな[Ads API ツールとライブラリ](https://developer.x.com/en/docs/twitter-ads-api/tools-and-libraries)を確認しましょう。
* [Ads API アクセスレベルを引き上げる](https://developer.x.com/en/docs/twitter-ads-api/increasing-access)ための手順を把握しておきましょう。
* 利用可能な[サポートリソース](https://developer.x.com/en/support/twitter-ads-api)を把握しておきましょう。
* API の変更、サービス障害、X のプロモーションプロダクトに対する改善の最新情報を得るために、[@API](https://x.com/API) をフォローしましょう。
