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

Follows エンドポイントを使用すると、ユーザーをフォロー／フォロー解除したり、任意のユーザーのフォロワーおよびフォロー中ユーザーのリストを取得したりできます。

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

<CardGroup cols={2}>
  <Card title="フォロー" icon="user-plus">
    認証済みユーザーに代わって他のユーザーをフォローします
  </Card>

  <Card title="フォロー解除" icon="user-minus">
    他のユーザーのフォローを解除します
  </Card>

  <Card title="フォロワー" icon="users">
    ユーザーのフォロワーを取得します
  </Card>

  <Card title="フォロー中" icon="user-group">
    ユーザーがフォローしているアカウントを取得します
  </Card>
</CardGroup>

***

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

<div id="follows-lookup">
  ### フォロー関係の取得
</div>

| Method | Endpoint                                                  | Description           |
| :----- | :-------------------------------------------------------- | :-------------------- |
| GET    | [`/2/users/:id/followers`](/ja/x-api/users/get-followers) | ユーザーのフォロワーを取得         |
| GET    | [`/2/users/:id/following`](/ja/x-api/users/get-following) | ユーザーがフォローしているアカウントを取得 |

<div id="manage-follows">
  ### フォローを管理
</div>

| Method | Endpoint                                                                              | Description    |
| :----- | :------------------------------------------------------------------------------------ | :------------- |
| POST   | [`/2/users/:id/following`](/ja/x-api/users/follow-user)                               | ユーザーをフォローする    |
| DELETE | [`/2/users/:source_user_id/following/:target_user_id`](/ja/x-api/users/unfollow-user) | ユーザーのフォローを解除する |

***

<div id="example-get-followers">
  ## 例: フォロワーの取得
</div>

```bash theme={null}
curl "https://api.x.com/2/users/2244994945/followers?\
user.fields=username,verified,public_metrics" \
  -H "Authorization: Bearer $BEARER_TOKEN"
```

<div id="example-follow-a-user">
  ## 例: ユーザーをフォローする
</div>

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

***

<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="クイックスタート" icon="rocket" href="/ja/x-api/users/follows/quickstart">
    フォロー機能の利用を開始する
  </Card>

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

  <Card title="サンプルコード" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    動作するコード例
  </Card>
</CardGroup>
