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

# User Lookup

> User lookup エンドポイントを使うと、1 人または複数のユーザーのプロフィール情報を取得できます。X API v2 スタンダード階層の lookup に関するリファレンスドキュメントです。

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

User lookup エンドポイントを使うと、1 人または複数のユーザーのプロフィール情報を取得できます。ID や username でユーザーをルックアップしたり、現在認証されているユーザーの詳細を取得したりできます。

## 概要

<CardGroup cols={2}>
  <Card title="ID で取得" icon="fingerprint">
    一意の user ID でユーザーをルックアップ
  </Card>

  <Card title="username で取得" icon="at">
    @ハンドルでユーザーをルックアップ
  </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">
    1 リクエストで最大 100 ユーザーを取得
  </Card>

  <Card title="認証済みユーザー" icon="user-check">
    現在のユーザーの詳細を取得
  </Card>
</CardGroup>

***

## エンドポイント

| Method | Endpoint                                                              | Description                  |
| :----- | :-------------------------------------------------------------------- | :--------------------------- |
| GET    | [`/2/users/:id`](/x-api/users/get-user-by-id)                         | ID でユーザーを取得                  |
| GET    | [`/2/users`](/x-api/users/get-users-by-ids)                           | ID でユーザーを取得 (最大 100 件)       |
| GET    | [`/2/users/by/username/:username`](/x-api/users/get-user-by-username) | username でユーザーを取得            |
| GET    | [`/2/users/by`](/x-api/users/get-users-by-usernames)                  | username でユーザーを取得 (最大 100 件) |
| GET    | [`/2/users/me`](/x-api/users/get-my-user)                             | 認証済みユーザーを取得                  |

***

## リクエスト例

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

## レスポンス例

```json title="レスポンス例" lines wrap icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-brackets.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=ed2428e77bab43e57800e1a590e982fa" theme={null}
{
  "data": {
    "id": "2244994945",
    "name": "X Developers",
    "username": "XDevelopers",
    "created_at": "2013-12-14T04:35:55.000Z",
    "description": "The voice of the X developer community",
    "verified": true,
    "public_metrics": {
      "followers_count": 583423,
      "following_count": 2048,
      "tweet_count": 14052,
      "listed_count": 1672
    }
  }
}
```

***

## はじめに

<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="User lookup クイックスタート" 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/lookup/quickstart/user-lookup" width="24" height="24" data-path="icons/xds/icon-rocket.svg">
    ID または username でユーザーをルックアップ
  </Card>

  <Card title="認証済みユーザークイックスタート" icon="https://mintcdn.com/x-preview/SxzTbJaLjs3MidH1/icons/xds/icon-person.svg?fit=max&auto=format&n=SxzTbJaLjs3MidH1&q=85&s=507a4bbcdcf5744bd18781508002e305" href="/x-api/users/lookup/quickstart/authenticated-lookup" width="24" height="24" data-path="icons/xds/icon-person.svg">
    現在のユーザーのプロフィールを取得
  </Card>

  <Card title="連携ガイド" icon="https://mintcdn.com/x-preview/Vn2KEkZaPF9LiPi3/icons/xds/icon-book.svg?fit=max&auto=format&n=Vn2KEkZaPF9LiPi3&q=85&s=22ac564792481d14ae36a941546039c8" href="/x-api/users/lookup/integrate" width="24" height="24" data-path="icons/xds/icon-book.svg">
    主要な概念とベストプラクティス
  </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-user-by-id" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの詳細ドキュメント
  </Card>
</CardGroup>
