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

# Follows

> Follows エンドポイントを使うと、ユーザーのフォロー・フォロー解除、フォロワーやフォロー中のリスト取得ができます。X API v2 スタンダード階層の follows に関するリファレンスドキュメントです。

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

Follows エンドポイントを使うと、ユーザーのフォロー・フォロー解除、任意のユーザーのフォロワーやフォロー中の一覧の取得ができます。

## 概要

<CardGroup cols={2}>
  <Card title="フォロー" icon="user-plus">
    認証済みユーザーの代理でユーザーをフォロー
  </Card>

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

  <Card title="フォロワー" icon="https://mintcdn.com/x-preview/SxzTbJaLjs3MidH1/icons/xds/icon-people.svg?fit=max&auto=format&n=SxzTbJaLjs3MidH1&q=85&s=9d5f3f82edcd2a4070364193436e7980" width="24" height="24" data-path="icons/xds/icon-people.svg">
    ユーザーのフォロワーを取得
  </Card>

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

***

## エンドポイント

### Follows lookup

| Method | Endpoint                                               | Description   |
| :----- | :----------------------------------------------------- | :------------ |
| GET    | [`/2/users/:id/followers`](/x-api/users/get-followers) | ユーザーのフォロワーを取得 |
| GET    | [`/2/users/:id/following`](/x-api/users/get-following) | ユーザーのフォロー中を取得 |

### Manage follows

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

***

## 例: フォロワーを取得

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

## 例: ユーザーをフォロー

```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"}'
```

***

## はじめに

<Note>
  **前提条件**

  * 承認済みの [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * Developer Console 内の [Project と App](/resources/fundamentals/developer-apps)
  * App の[キーとトークン](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="クイックスタート" icon="https://mintcdn.com/x-preview/oR-aRNyj1BKPJtxM/icons/xds/icon-rocket.svg?fit=max&auto=format&n=oR-aRNyj1BKPJtxM&q=85&s=b978d7a9225de31709efbbed5b84e92d" href="/x-api/users/follows/quickstart" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    follows を使い始める
  </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/users/get-followers" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの詳細ドキュメント
  </Card>

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