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

# クイックスタート

> このガイドでは、自分が開始した会話内の投稿への返信の非表示・再表示方法を説明します。hide replies を扱う X API v2 スタンダードティアのリファレンス。

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

このガイドでは、自分が開始した会話内の投稿への返信の非表示・再表示方法を説明します。

<Note>
  **前提条件**

  始める前に以下が必要です:

  * 承認済みの App を含む[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * ユーザーアクセストークン(OAuth 1.0a または OAuth 2.0 PKCE)
</Note>

***

## 返信を非表示にする

<Steps>
  <Step title="返信の投稿 ID を見つける" icon="https://mintcdn.com/x-preview/ygI6sSJPehlc0qNT/icons/xds/icon-chat.svg?fit=max&auto=format&n=ygI6sSJPehlc0qNT&q=85&s=9fde7d51b4f18c96d3a38a81d519761f" width="24" height="24" data-path="icons/xds/icon-chat.svg">
    非表示にしたい返信の ID を取得します。認証ユーザーが開始した会話への返信のみ非表示にできます。

    ```
    https://x.com/user/status/1232720193182412800
                              └── これが投稿 ID
    ```
  </Step>

  <Step title="非表示リクエストを送信する" icon="eye-slash">
    <CodeGroup dropdown>
      ```bash cURL theme={null}
      curl -X PUT "https://api.x.com/2/tweets/1232720193182412800/hidden" \
        -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{"hidden": true}'
      ```

      ```python title="Python SDK" lines wrap icon="python" 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("1232720193182412800", hidden=True)
      print(f"Hidden: {response.data.hidden}")
      ```

      ```javascript title="JavaScript SDK" lines wrap icon="square-js" 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("1232720193182412800", {
        hidden: true,
      });
      console.log(`Hidden: ${response.data?.hidden}`);
      ```
    </CodeGroup>
  </Step>

  <Step title="返信が非表示になったことを確認する" icon="check">
    ```json theme={null}
    {
      "data": {
        "hidden": true
      }
    }
    ```

    返信はメインの会話ビューから非表示になりました。ユーザーは「非表示の返信を表示」をクリックすると引き続き閲覧できます。
  </Step>
</Steps>

***

## 返信を再表示にする

非表示にした返信を再び表示するには:

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

  ```python title="Python SDK" lines wrap icon="python" 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("1232720193182412800", hidden=False)
  print(f"Hidden: {response.data.hidden}")
  ```

  ```javascript title="JavaScript SDK" lines wrap icon="square-js" 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("1232720193182412800", {
    hidden: false,
  });
  console.log(`Hidden: ${response.data?.hidden}`);
  ```
</CodeGroup>

**レスポンス:**

```json theme={null}
{
  "data": {
    "hidden": false
  }
}
```

***

## 重要事項

<Note>
  * **自分が開始した**会話への返信のみ非表示にできます
  * 非表示にした返信は「非表示の返信を表示」から引き続き表示できます
  * 返信の作成者は、自分の返信が非表示になっても通知されません
</Note>

***

## 次のステップ

<CardGroup cols={2}>
  <Card title="トピック別に管理" icon="tags" href="/x-api/posts/hide-replies/integrate/manage-replies-by-topic">
    コンテンツに基づいて返信をモデレート
  </Card>

  <Card title="リアルタイムモデレーション" icon="bolt" href="/x-api/posts/hide-replies/integrate/manage-replies-in-realtime">
    返信の到着時にモデレート
  </Card>

  <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/posts/hide-reply" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの完全なドキュメント
  </Card>
</CardGroup>
