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

# Authenticate

> Log in with a browser, use API credentials in CI or from an agent, switch between accounts, and log out.

Pick one: a browser login for your laptop, or API credentials in environment variables for CI and coding agents. Both end up as a named **profile** you can switch between.

## Log in with a browser

Connect the CLI to your Plivo account with a browser-based login flow. The CLI opens the Plivo Console in your default browser; you sign in there and approve access. Your password never touches the CLI.

After approval, the CLI stores a profile in `~/.plivo/config.toml` and keeps the auth token in your operating system's secure credential store (Keychain on macOS, Credential Manager on Windows, Secret Service on Linux).

Use [`plivo auth list`](/docs/cli/authenticate#switch-between-accounts) to see saved profiles and `plivo auth use` to switch between them. To remove a profile and its stored token, use [`plivo logout`](/docs/cli/authenticate#log-out).

<Note>
  Running in CI, a container, or an AI coding agent where a browser can't open? Skip `plivo login` entirely and [set credentials as environment variables](/docs/cli/authenticate#use-api-credentials-ci-and-agents).
</Note>

**Command:** `plivo login`

**Flags**

* `-n, --name <profile>`: name to save the profile under (default `default`).
* `--no-verify`: skip the validation request to `GET /Account/` after login (offline or mock use only).

**Examples**

```bash theme={null}
plivo login
plivo login --name staging
```

## Use API credentials (CI and agents)

For CI pipelines, containers, and AI coding agents, skip the browser login and pass your Auth ID and Auth Token as environment variables. Every command reads them automatically; environment variables take precedence over the active profile.

```bash theme={null}
export PLIVO_AUTH_ID=<auth_id>
export PLIVO_AUTH_TOKEN=<auth_token>
plivo auth whoami
```

Find your Auth ID and Auth Token on the [Console overview](https://console.plivo.com/dashboard/). Never commit them; load them from a secrets manager or a local `.env` file that is not checked in.

<Warning>
  Anyone with these two values can act as your account. Prefer a [subaccount](/docs/cli/apis/account#subaccounts) with the minimum products enabled for automated use.
</Warning>

Useful companions in scripts:

```bash theme={null}
export PLIVO_FEEDBACK_PROMPT=0    # never show the "rate the CLI?" prompt
export CI=1                       # disables all TTY-only interactions
export PLIVO_CLI_TELEMETRY=0      # see Telemetry
```

## Switch between accounts

A profile is a saved set of credentials. Most people have one; if you work across several Plivo accounts or subaccounts, save one profile per account and switch between them.

**Command:** `plivo auth <subcommand>`

#### `plivo auth list`

List saved profiles and show which one is active.

#### `plivo auth use <name>`

Make a saved profile the active one for subsequent commands.

#### `plivo auth whoami`

Show the account behind the credentials the CLI would use right now: including whether they came from a profile or from environment variables (`"meta": {"source": "env"}`).

```bash theme={null}
plivo auth whoami -o json
```

#### `plivo auth remove <name>`

Delete a profile and its stored token.

**Per-command override**

Any command accepts `--profile <name>` to run once under a different profile without switching:

```bash theme={null}
plivo --profile staging numbers list
```

<Note>
  Credential precedence is: `--profile` flag → `PLIVO_AUTH_ID` / `PLIVO_AUTH_TOKEN` environment variables → the active profile.
</Note>

## Log out

Remove a saved profile and delete its auth token from the operating system's credential store.

**Command:** `plivo logout [profile]`

**Flags**

* `[profile]`: the profile to log out (default: the active profile).

**Examples**

```bash theme={null}
plivo logout
plivo logout staging
```
