Skip to main content

CLI Authentication

The CLI supports two authentication methods.

Device Code Login (Interactive)

Best for personal use on your workstation:
nexspace login-device
This opens a browser where you log in and approve the CLI. Tokens are stored in ~/.config/nexspace/credentials.json.

API Key (Headless)

Best for CI/CD, scripts, and automation:
# Set via environment variable
export NEXSPACE_API_KEY=nex_live_YOUR_KEY

# Or pass inline
nexspace facilities list --api-key nex_live_YOUR_KEY
The CLI checks for credentials in this order:
  1. --api-key flag
  2. NEXSPACE_API_KEY environment variable
  3. Saved OAuth tokens from login-device

Verify Authentication

nexspace whoami
Prints the authenticated user and org.

Logout

nexspace logout
Removes stored tokens from ~/.config/nexspace/credentials.json.