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

> ## Agent Instructions
> These docs describe the Ancha CLI, npm package @ancha-labs/cli version 0.1.4, and the hosted workspace at app.ancha.io. Coding agents should start at https://docs.ancha.io/coding-agents. Run the CLI as `ancha` after `npm install -g @ancha-labs/cli`, or as `npx -y @ancha-labs/cli@0.1.4` without installing. Pass --json for machine-readable output, or set ANCHA_JSON=1. Every command ends with a `next:` line naming the next command. Exit codes: 0 pass, 1 a check failed or a comparison regressed, 2 usage, config or authentication error, 3 infrastructure error, 4 unimplemented endpoint with --strict.

# ancha whoami

> Show which workspace or local server commands use, where that choice came from, where ancha run puts its worlds, and whether an API key is available. Never prints a key.

`ancha whoami` says where the next command's worlds will run and why. It follows the same order as every other command: `--server-url`, then `server.url` in `ancha.yaml`, then `ANCHA_SERVER_URL`, then the workspace saved by `ancha login`, else a server on this computer. See [CLI overview](https://docs.ancha.io/cli/overview.md#which-server-a-command-uses).

```bash theme={null}
ancha whoami [options]
```

| Option | Description |
| - | - |
| `--verify` | Also ask the server whether it accepts the key (AUTH\_INVALID, exit 2, when it does not) |

## Example

```bash theme={null}
ancha whoami
```

```text Output theme={null}
Workspace: https://app.ancha.io/t/<workspace> (from ancha login)
Signed in as you@company.com
API key: saved by ancha login
ancha run: worlds on this computer; --upload sends the results to this workspace, --on cloud runs there
```

A saved login names the workspace without moving the worlds there. When `--server-url`, `server.url` or `ANCHA_SERVER_URL` names the server, the last line reads `ancha run: worlds in this workspace`.

Without a workspace:

```text Output theme={null}
Workspace: local (no server configured). Worlds run in a server this CLI starts.
next: ancha login
```

`--verify` sends one request to the server. When the key is accepted, the text ends with `The server accepted the key.`; when it is not, the command fails with `AUTH_INVALID` and exit `2`. A server that cannot be reached fails with `SERVER_UNREACHABLE` and exit `3`. There is nothing to verify for a local server.

## JSON output

| Field | Meaning |
| - | - |
| `workspace` | The world server's URL, or `local:<project path>`. |
| `serverUrl` | The server, or `null` for a local one. |
| `source` | Where the choice came from: `flag` (`--server-url`), `config` (`server.url`), `env` (`ANCHA_SERVER_URL`), `login` (saved by `ancha login`) or `local`. |
| `email` | The email of the saved login, when there is one. |
| `worlds` | Where `ancha run` puts its worlds: `local`, or the server URL. |
| `apiKey` | `"saved"` for a key from `ancha login`, `"ANCHA_API_KEY"` for one from the environment, or `null`. Never the key itself. |
| `verified` | `true` when `--verify` was passed and the server accepted the key. |
| `credentials` | The path of the credentials file. |

## Exit codes

`0`. `2` for an invalid server URL, or with `--verify` a key the server rejects. `3` with `--verify` when the server cannot be reached.


## Related topics

- [Login and API keys](https://docs.ancha.io/cloud/login-and-api-keys.md)
- [ancha login](https://docs.ancha.io/cli/login.md)
- [Troubleshooting](https://docs.ancha.io/troubleshooting.md)
- [CLI overview](https://docs.ancha.io/cli/overview.md)
- [For coding agents](https://docs.ancha.io/coding-agents.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.