> ## 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="comparing-x-apis-hide-replies-endpoints">
  ## X API の返信非表示エンドポイントの比較
</div>

v2 の返信非表示エンドポイントは、Labs の返信非表示エンドポイントに置き換えるものです。Labs 版のこのエンドポイントを使用しているコードやアプリ、ツールがあり、新しい X API v2 エンドポイントへの移行を検討している場合は、このガイドをご参照ください。

新しい X API v2 (返信非表示エンドポイントを含む) を使用するには、[新しい開発者コンソールにオプトイン](https://developer.x.com/en/portal/opt-in)し、[Project](/ja/resources/fundamentals/developer-apps) を作成し、その Project に App を追加する必要があります。その App に関連付けられている認証情報を使用して、返信非表示エンドポイントへのリクエストを行うことができます。Labs v2 の返信非表示エンドポイントに登録しているのと同じ App を追加すれば、ユーザーの認証状態を維持できます。

次の表は、Labs と新しい X API v2 エンドポイントの違いを示しています。

| **説明**                                                                                                                                   | **Labs v2**                            | **X API v2**                           |
| :--------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------- | :------------------------------------- |
| ホストドメイン                                                                                                                                  | [https://api.x.com](https://api.x.com) | [https://api.x.com](https://api.x.com) |
| エンドポイントパス                                                                                                                                | /labs/2/tweets/:id/hidden              | /2/tweets/:id/hidden                   |
| 認証方式                                                                                                                                     | OAuth 1.0a User context                | OAuth 1.0a User context                |
| サポートされる HTTP メソッド                                                                                                                        | PUT                                    | PUT                                    |
| デフォルトのレート制限                                                                                                                              | 15 分あたり 10 リクエスト (すべての認証済みユーザーで共有)     | 15 分あたり 50 リクエスト (認証済みユーザーごと)          |
| 返信を非表示にできる                                                                                                                               | ✔︎                                     | ✔︎                                     |
| 以前に非表示にした返信を再表示できる                                                                                                                       | ✔︎                                     | ✔︎                                     |
| 返信の非表示／再表示を複数回行える                                                                                                                        | ✔︎                                     | ✔︎                                     |
| [project](/ja/resources/fundamentals/developer-apps) に関連付けられた [developer App](/ja/resources/fundamentals/developer-apps) の認証情報を使用する必要がある |                                        | ✔                                      |

***

<div id="code-examples">
  ## コード例
</div>

<div id="hide-a-reply-v2">
  ### 返信を非表示にする (v2)
</div>

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl -X PUT "https://api.x.com/2/tweets/1234567890/hidden" \
    -H "Authorization: OAuth ..." \
    -H "Content-Type: application/json" \
    -d '{"hidden": true}'
  ```

  ```python Python theme={null}
  # OAuth 1.0a のユーザーコンテキストによる認証が必要です
  import requests
  from requests_oauthlib import OAuth1

  auth = OAuth1(
      "API_KEY", "API_SECRET",
      "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET"
  )

  url = "https://api.x.com/2/tweets/1234567890/hidden"
  response = requests.put(url, auth=auth, json={"hidden": True})
  print(response.json())
  ```

  ```python Python SDK theme={null}
  from xdk import Client
  from xdk.oauth1_auth import OAuth1

  oauth1 = OAuth1(
      api_key="YOUR_API_KEY",
      api_secret="YOUR_API_SECRET",
      access_token="YOUR_ACCESS_TOKEN",
      access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
  )

  client = Client(auth=oauth1)

  # 返信を非表示にする
  response = client.posts.hide_reply("1234567890", hidden=True)
  print(f"Hidden: {response.data.hidden}")
  ```

  ```javascript JavaScript SDK theme={null}
  import { Client, OAuth1 } from "@xdevplatform/xdk";

  const oauth1 = new OAuth1({
    apiKey: "YOUR_API_KEY",
    apiSecret: "YOUR_API_SECRET",
    accessToken: "YOUR_ACCESS_TOKEN",
    accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
  });

  const client = new Client({ oauth1 });

  // 返信を非表示にする
  const response = await client.posts.hideReply("1234567890", { hidden: true });
  console.log(`Hidden: ${response.data?.hidden}`);
  ```
</CodeGroup>

**その他の移行リソース**

[X API 移行ハブ](/ja/x-api/migrate/overview)
