CLI authentication
The Operately CLI supports four ways to log in. All methods save credentials to a local profile so subsequent commands are authenticated automatically.
After logging in with any method, verify the session:
operately auth whoamiTo check the current profile and base URL:
operately auth statusTo remove the saved token from a profile:
operately auth logoutRun the login command and follow the prompts:
operately auth loginThe CLI will ask which method you want to use. The four options are:
- API token — You provide a pre-created API token. Create a token in Operately first.
- Email and password — You provide your email address and password.
- Email verification code — You provide your email address; the CLI sends a one-time code to it and prompts you to enter it.
- Google — The CLI opens a browser window for Google sign-in and waits for you to complete it.
Skip interactive steps with flags#
Section titled “Skip interactive steps with flags#”If you prefer, you can pass options as flags to avoid being prompted. The --method flag selects the login method directly:
# API token — pass the token directly and skip all promptsoperately auth login --token <your-token>
# Email and password — pass credentials as flags
# Email code — pass email as a flag; the code prompt still appears
# Google — opens the browser; the browser confirmation step cannot be skippedoperately auth login --method googleThe two interactive steps that can never be avoided are the browser confirmation for Google OAuth and entering the email verification code — both require a human action to complete.
Use another base URL#
Section titled “Use another base URL#”If you are connecting to a self-hosted or staging environment, pass --base-url when you log in:
operately auth login --token <token> --base-url https://operately.example.comIf you do not set a base URL, the CLI defaults to:
https://app.operately.comProfiles#
Section titled “Profiles#”You can keep separate profiles for different environments:
# Productionoperately auth login --token op_live_xxx
# Stagingoperately auth login --token op_staging_xxx --profile staging --base-url https://staging.operately.com
# Local developmentoperately auth login --token op_local_xxx --profile local --base-url http://localhost:4000Use a profile on any command:
operately auth whoami --profile stagingoperately people get_me --profile localSaved profiles are stored in:
~/.operately/config.jsonEnvironment variables#
Section titled “Environment variables#”For scripts and CI, you can provide credentials through environment variables:
export OPERATELY_API_TOKEN=op_live_xxxexport OPERATELY_BASE_URL=https://app.operately.comexport OPERATELY_PROFILE=defaultResolution order#
Section titled “Resolution order#”When the CLI resolves authentication settings, it uses this order:
- Command flags
- Environment variables
- Saved profile values
That means command-line overrides such as --token, --base-url, and --profile always win.
Next step#
Section titled “Next step#”Once authentication is working, learn how to discover and run commands.