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

Likes エンドポイントを使用すると、投稿へのいいねやいいねの取り消しを行い、どのユーザーが特定のポストにいいねしたかを確認し、ユーザーがいいねした投稿を取得できます。

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

<CardGroup cols={2}>
  <Card title="ポストにいいねする" icon="heart">
    ユーザーに代わってポストにいいねする
  </Card>

  <Card title="ポストのいいねを取り消す" icon="heart-crack">
    ポストへのいいねを取り消す
  </Card>

  <Card title="いいねしたユーザー" icon="users">
    ポストにいいねしたユーザーを確認する
  </Card>

  <Card title="いいねしたポスト" icon="list-heart">
    ユーザーがいいねしたポストを取得する
  </Card>
</CardGroup>

***

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

<div id="likes-lookup">
  ### いいねの取得
</div>

| Method | Endpoint                                                         | Description        |
| :----- | :--------------------------------------------------------------- | :----------------- |
| GET    | [`/2/tweets/:id/liking_users`](/ja/x-api/posts/get-liking-users) | ポストに「いいね」したユーザーを取得 |
| GET    | [`/2/users/:id/liked_tweets`](/ja/x-api/users/get-liked-posts)   | ユーザーが「いいね」した投稿を取得  |

<div id="manage-likes">
  ### いいねを管理する
</div>

| Method | Endpoint                                                      | Description    |
| :----- | :------------------------------------------------------------ | :------------- |
| POST   | [`/2/users/:id/likes`](/ja/x-api/users/like-post)             | ポストを「いいね」する    |
| DELETE | [`/2/users/:id/likes/:tweet_id`](/ja/x-api/users/unlike-post) | ポストの「いいね」を取り消す |

***

<div id="important-notes">
  ## 重要な注意事項
</div>

<Note>
  Liking users エンドポイントでは、実際の「いいね」数に関係なく、全期間を通じて 1 件のポストあたり最大 **100 ユーザー** までしか返されません。
</Note>

***

<div id="example-get-liking-users">
  ## 例: いいねしたユーザーの取得
</div>

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

<div id="example-like-a-post">
  ## 例：ポストをいいねする
</div>

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

***

<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="heart" href="/ja/x-api/posts/likes/quickstart/likes-lookup">
    ポストのいいねを取得する
  </Card>

  <Card title="管理クイックスタート" icon="plus" href="/ja/x-api/posts/likes/quickstart/manage-likes">
    投稿へのいいね／いいね解除を行う
  </Card>

  <Card title="APIリファレンス" icon="code" href="/ja/x-api/posts/liking-users-of-a-post">
    エンドポイントの完全なリファレンス
  </Card>

  <Card title="サンプルコード" icon="github" href="https://github.com/xdevplatform/Twitter-API-v2-sample-code">
    実行可能なコード例
  </Card>
</CardGroup>
