> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-mintlify-b4f5bfb1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# User Search

> Search X users by keyword with the X API v2 User search endpoint to find accounts by name, handle, bio terms, and other public profile fields and metadata.

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

The User Search endpoint lets you search for users by keyword. Find users by name, username, or content in their bio.

## Overview

<CardGroup cols={2}>
  <Card title="Keyword search" icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/Y4pnhTTwR7PxYSWw/icons/xds/icon-search.svg?fit=max&auto=format&n=Y4pnhTTwR7PxYSWw&q=85&s=34acaf7217390e86b285fcf3114b1cee" width="24" height="24" data-path="icons/xds/icon-search.svg">
    Search by name, username, or bio
  </Card>

  <Card title="Discover users" icon="user-plus">
    Find relevant accounts
  </Card>
</CardGroup>

***

## Endpoint

| Method | Endpoint                                       | Description      |
| :----- | :--------------------------------------------- | :--------------- |
| GET    | [`/2/users/search`](/x-api/users/search-users) | Search for users |

***

## Example request

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

## Example response

```json title="Example response" lines wrap icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/E43Ep5Gv29gM6HJ6/icons/xds/icon-brackets.svg?fit=max&auto=format&n=E43Ep5Gv29gM6HJ6&q=85&s=e49413e02c3658182f7b9e2cb5663b95" 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
  }
}
```

***

## Getting started

<Note>
  **Prerequisites**

  * An approved [developer account](https://developer.x.com/en/portal/petition/essential/basic-info)
  * A [Project and App](/resources/fundamentals/developer-apps) in the Developer Console
  * Your App's [keys and tokens](/resources/fundamentals/authentication)
</Note>

<CardGroup cols={2}>
  <Card title="User lookup" icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/VFX2XSyPqtT4SVsH/icons/xds/icon-person.svg?fit=max&auto=format&n=VFX2XSyPqtT4SVsH&q=85&s=d0d289815cdfc8e3c20af259d2f04c46" href="/x-api/users/lookup/introduction" width="24" height="24" data-path="icons/xds/icon-person.svg">
    Look up users by ID or username
  </Card>

  <Card title="API Reference" icon="https://mintcdn.com/x-preview-mintlify-b4f5bfb1/NEh9mjpH7RaTDEed/icons/xds/icon-code.svg?fit=max&auto=format&n=NEh9mjpH7RaTDEed&q=85&s=07116236bb3000cffffbf6c9bac6d47e" href="/x-api/users/user-search" width="24" height="24" data-path="icons/xds/icon-code.svg">
    Full endpoint documentation
  </Card>
</CardGroup>
