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

> X API v2 の User search エンドポイントで X ユーザーをキーワード検索し、名前、ハンドル、bio 内の語句、その他の公開プロフィールフィールドやメタデータからアカウントを見つけます。

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 Search エンドポイントでは、キーワードでユーザーを検索できます。名前、username、bio 内の内容でユーザーを見つけられます。

## 概要

<CardGroup cols={2}>
  <Card title="キーワード検索" icon="https://mintcdn.com/x-preview/cfyQtgCdwk8p69aa/icons/xds/icon-search.svg?fit=max&auto=format&n=cfyQtgCdwk8p69aa&q=85&s=8c11ad89387b7c09ced1553d5c232834" width="24" height="24" data-path="icons/xds/icon-search.svg">
    名前、username、bio で検索
  </Card>

  <Card title="ユーザーを発見" icon="user-plus">
    関連するアカウントを見つける
  </Card>
</CardGroup>

***

## エンドポイント

| Method | Endpoint                                       | Description |
| :----- | :--------------------------------------------- | :---------- |
| GET    | [`/2/users/search`](/x-api/users/search-users) | ユーザーを検索     |

***

## リクエスト例

```bash theme={null}
curl "https://api.x.com/2/users/search?\
query=python%20developer&\
user.fields=description,verified,public_metrics" \
  -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": "1234567890",
      "name": "Python Developer",
      "username": "pythondev",
      "description": "Building cool things with Python",
      "verified": false,
      "public_metrics": {
        "followers_count": 5000,
        "following_count": 200,
        "tweet_count": 1500
      }
    }
  ],
  "meta": {
    "result_count": 1
  }
}
```

***

## はじめに

<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/SxzTbJaLjs3MidH1/icons/xds/icon-person.svg?fit=max&auto=format&n=SxzTbJaLjs3MidH1&q=85&s=507a4bbcdcf5744bd18781508002e305" href="/x-api/users/lookup/introduction" width="24" height="24" data-path="icons/xds/icon-person.svg">
    ID または username でユーザーを検索
  </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/user-search" width="24" height="24" data-path="icons/xds/icon-code.svg">
    エンドポイントの詳細ドキュメント
  </Card>
</CardGroup>
