> ## Documentation Index
> Fetch the complete documentation index at: https://developers.clay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# whoami

> Print the authenticated user and their workspace as JSON.

Print the user and workspace associated with the saved API key. Useful for confirming auth is set up before an agent or human interacts with Clay.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
clay whoami
```

## Output

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "user": {
    "id": "12345",
    "name": "Ada Lovelace"
  },
  "workspace": {
    "id": "ws_abc123"
  }
}
```

| Field          | Type           | Description                                     |
| -------------- | -------------- | ----------------------------------------------- |
| `user.id`      | string         | Clay user id of the API key owner.              |
| `user.name`    | string \| null | Display name of the user, or `null` if not set. |
| `workspace.id` | string         | Workspace the API key is scoped to.             |

## Errors

| Code                   | Exit | Notes                                                                                                                     |
| ---------------------- | ---- | ------------------------------------------------------------------------------------------------------------------------- |
| `auth_missing_api_key` | 3    | No API key configured. Run `clay login` to set one. Universal code, listed here because `whoami` is the first auth check. |
| `auth_invalid`         | 3    | The configured API key was rejected by Clay. `whoami` is the canonical check.                                             |

See the [quickstart](/cli/quickstart) for universal error codes that apply to every command.

## Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
clay whoami
clay whoami | jq -r '.user.id'
clay whoami | jq -r '.workspace.id'
clay whoami >/dev/null && echo "authenticated" || echo "not authenticated"
```
