Skip to main content

CLI Authentication

The CLI authenticates with the same API key as the REST API. Create one under Settings → API Keys in the Perspective app (Admins only — see API Keys). The key's permissions (crm:read, crm:write, metrics:read) decide which commands work.

Store your API key​

perspective auth login

At a terminal, the CLI prompts for the key without echoing it. In a script, pipe it in instead, so it doesn't end up in your shell history:

printf %s "$PERSPECTIVE_API_KEY" | perspective auth login

The CLI validates the key with one read request before storing it.

Check and clear the key​

perspective auth status # whether a key is configured and where it comes from; no network calls
perspective auth logout # delete the stored key

auth status never prints the key in full; it is masked.

CI and automation​

Skip the stored file and pass the key through the environment:

export PERSPECTIVE_API_KEY=…

Precedence, highest first: the --api-key flag, the PERSPECTIVE_API_KEY environment variable, the stored key.

Where the key is stored​

~/.config/perspective/credentials.json (or $XDG_CONFIG_HOME/perspective/, or $PERSPECTIVE_CONFIG_DIR), readable only by your user (mode 0600). Treat it like a password.