# getUserByUsername

**Identifier:** `x_getUserByUsername`

**Provider:** [X (formerly Twitter)](https://kirha.com/providers/x.md)

Get X user profile by username/handle. Returns userId for use with getUserPosts.

## Run it with the CLI

```bash
kirha tools run x_getUserByUsername \
  --input '{
    "username": "kirha_ai or @kirha_ai"
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "x_getUserByUsername",
  "input": {
    "username": "kirha_ai or @kirha_ai"
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "username": {
      "description": "e.g., kirha_ai or @kirha_ai",
      "type": "string"
    }
  },
  "required": [
    "username"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "createdAt": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "followers": {
      "type": "number"
    },
    "following": {
      "type": "number"
    },
    "isVerified": {
      "type": "boolean"
    },
    "likeCount": {
      "type": "number"
    },
    "listedCount": {
      "type": "number"
    },
    "location": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "pinnedPostId": {
      "description": "Use with getPostById",
      "type": "string"
    },
    "postCount": {
      "type": "number"
    },
    "url": {
      "type": "string"
    },
    "userId": {
      "description": "Use with getUserPosts",
      "type": "string"
    },
    "username": {
      "type": "string"
    },
    "verifiedType": {
      "type": "string"
    }
  },
  "required": [
    "context",
    "userId",
    "name",
    "username",
    "isVerified",
    "followers",
    "following",
    "postCount",
    "likeCount",
    "listedCount"
  ],
  "type": "object"
}
```

## Related tools

Other X (formerly Twitter) tools that this tool refers to, or that refer to it.

- [`getUserPosts`](https://kirha.com/providers/x/getUserPosts.md)
- [`getPostById`](https://kirha.com/providers/x/getPostById.md)

-----

[All X (formerly Twitter) tools](https://kirha.com/providers/x.md) · [< Back to tools list](https://kirha.com/tools.md)