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

# Account

> Log in, log out, and inspect the active CLI account context

The CLI uses an API key for authenticated commands. You can save it once with `youka login`, or provide it through `YOUKA_API_KEY` in CI and other non-interactive environments.

`youka login` verifies the key against the API before saving it, then caches the resolved account email in `~/.youka/config.json` for diagnostics.

## `login`

Save an API key to `~/.youka/config.json`.

```bash theme={null}
youka login [token]
```

<ParamField path="token" type="string">
  The API key copied from the Youka dashboard. If omitted, the CLI prompts for
  it on an interactive terminal.
</ParamField>

### Examples

<CodeGroup>
  ```bash token theme={null}
  youka login yk_live_abcd1234
  ```

  ```bash with-api theme={null}
  youka login yk_live_abcd1234 --api https://staging-api.youka.test --json
  ```
</CodeGroup>

<Tip>In CI, prefer `YOUKA_API_KEY` instead of writing a config file.</Tip>

## `logout`

Remove the saved API key from `~/.youka/config.json`.

```bash theme={null}
youka logout
youka logout --json
```

## `whoami`

Inspect the resolved key source, API URL, and account identity.

```bash theme={null}
youka whoami
youka whoami --json
```

Example response:

```json theme={null}
{
  "ok": true,
  "data": {
    "authenticated": true,
    "tokenPresent": true,
    "authStatus": "verified",
    "identitySource": "live",
    "keySource": "config",
    "apiUrl": "https://api.youka.io/api/v1",
    "apiUrlSource": "default",
    "email": "user@example.com",
    "userId": "user_123",
    "apiKeyId": "key_123",
    "org": null,
    "configPath": "/Users/you/.youka/config.json",
    "apiKeyPreview": "yk_l...1234"
  }
}
```

### Resolution order

| Field   | Order                                                                         |
| ------- | ----------------------------------------------------------------------------- |
| API key | `YOUKA_API_KEY`, then `~/.youka/config.json`                                  |
| API URL | `--api`, then `YOUKA_API_BASE_URL`, then `~/.youka/config.json`, then default |

When a saved config key is active, `whoami` verifies identity with the API and falls back to the cached account email only if the live lookup is unavailable. It does not use cached config identity for `YOUKA_API_KEY` tokens.

## What's next

* [Global options](/en/cli/global-options) - flags shared by every command
* [Projects](/en/cli/projects) - create and process karaoke projects
