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

Blocks エンドポイントを使用すると、ユーザーのブロックやブロック解除を行い、認証済みユーザーがブロックしているユーザーのリストを取得できます。

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

<CardGroup cols={2}>
  <Card title="ブロック" icon="ban">
    ユーザーをブロックする
  </Card>

  <Card title="ブロック解除" icon="circle-check">
    ユーザーのブロックを解除する
  </Card>

  <Card title="ブロックしたユーザー" icon="list">
    ブロックしているユーザーのリストを取得する
  </Card>
</CardGroup>

***

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

| Method | Endpoint                                                | 説明            |
| :----- | :------------------------------------------------------ | :------------ |
| GET    | [`/2/users/:id/blocking`](/ja/x-api/users/get-blocking) | ブロック中のユーザーを取得 |
| POST   | [`/2/users/:id/blocking`](/ja/x-api/users/block-dms)    | ユーザーをブロック     |
| DELETE | `/2/users/:source_user_id/blocking/:target_user_id`     | ユーザーのブロックを解除  |

***

<div id="example-get-blocked-users">
  ## 例: ブロックしているユーザーの取得
</div>

```bash theme={null}
curl "https://api.x.com/2/users/123456789/blocking?\
user.fields=username,description" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
```

<div id="example-block-a-user">
  ## 例：ユーザーをブロックする
</div>

```bash theme={null}
curl -X POST "https://api.x.com/2/users/123456789/blocking" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"target_user_id": "9876543210"}'
```

***

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

<Note>
  **前提条件**

  * 承認済みの[開発者アカウント](https://developer.x.com/en/portal/petition/essential/basic-info)
  * 開発者コンソール内の[Project と App](/ja/resources/fundamentals/developer-apps)
  * [OAuth 2.0 PKCE](/ja/resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2) を使用して取得したユーザーアクセス・トークン
</Note>

<CardGroup cols={2}>
  <Card title="クイックスタート" icon="rocket" href="/ja/x-api/users/blocks/quickstart">
    ブロック API の利用を開始する
  </Card>

  <Card title="統合ガイド" icon="book" href="/ja/x-api/users/blocks/integrate">
    主要な概念とベストプラクティス
  </Card>

  <Card title="APIリファレンス" icon="code" href="/ja/x-api/users/blocks-lookup">
    エンドポイントの完全なドキュメント
  </Card>
</CardGroup>
