Skip to content
Skip to Content

Sign in

Sign the CLI in through your browser with a one-time code, or with an API key on a server or in CI.

The CLI signs in two ways:

HowIt acts asUse it
Through the browseropenpanel login, then you approve a code in the consoleYou, with your access, in every organization you belong toOn your own computer
With an API keyOPENPANEL_TOKEN, or openpanel login --with-tokenThe person who made the key, capped by the key's scope, in the key's organizationOn a server, in CI, for an AI agent

openpanel whoami shows which one is in use, who you are and the organization commands work in.

Through the browser

Ask for a code

openpanel login

The CLI prints a code such as RDML-MNGN and opens https://openpanel.sh/cli in your browser. On a machine where no browser opens, add --no-browser and open the address yourself, on any device.

Type the code

Sign in to the console if you are not, then type the code from your terminal and choose Continue. The link never carries the code: you type it, so a link someone else sends you cannot sign their terminal in as you.

The CLI starts in the organization that is active in the console. To start it in another one, switch organization at the top of the console first.

Check and approve

The page asks Sign in the CLI as you? and shows what asked: the CLI and the computer it runs on, the code, the address it asked from, and when the code expires. If the address is not the one your browser uses, the page says so. Approve only a code you asked for yourself, just now.

Choose Sign in the CLI. The terminal continues within seconds and prints Signed in as [email protected] in Your organization. Choose It wasn't me to refuse; the terminal then stops with "The sign-in was refused in the browser."

A code lasts 10 minutes and works once. Run openpanel login again for a new one. Approving or refusing a code is written to the organization's audit log.

The CLI's session

The CLI gets a session of its own, the same kind your browser has. It acts as you, with your access, and works in every organization you belong to:

  • openpanel orgs lists them, and openpanel orgs switch <slug> changes the one commands work in.
  • --org <slug> picks another one for a single command.

The session is listed with your others in the console, under Account settings, Sign-in and security, Where you are signed in. It ends when:

  • you run openpanel logout;
  • you sign it out there;
  • you change or reset your password;
  • it goes unused for 30 days. Each day you use it, it is kept for another 30 days.

With an API key

On a server, in CI or for an AI agent, use an API key instead of a person's session. Set it in the environment, and every command uses it:

export OPENPANEL_TOKEN=opk_…
openpanel whoami

OPENPANEL_TOKEN wins over a saved sign-in. To save the key instead, pipe it into login --with-token, which keeps it out of your shell's history:

printf %s "$OPENPANEL_TOKEN" | openpanel login --with-token

The CLI checks the key with OpenPanel before it saves it.

A key acts as the person who made it, never with more than their access, capped by its scope (view, deploy or admin) and, if it was made so, limited to some projects. It works only in the organization it was made in.

Make a key

API keys are made by a person, never by another key. Sign in through the browser first, then:

openpanel keys create --name "CI" --scope deploy --project shop

The key is printed once; store it right away. --project limits the key to that project (repeat it for more), and --expires 2027-06-30 makes it stop working on that date. openpanel keys lists your keys and openpanel keys revoke <id> revokes one. The console has the same under Organization settings, API keys.

Where the sign-in is kept

openpanel login saves the token, the OpenPanel address and the organization in config.json in:

SystemFolder
macOS and Linux~/.config/openpanel, or $XDG_CONFIG_HOME/openpanel when that is set
Windows%APPDATA%\openpanel

Only you can read the file. OPENPANEL_CONFIG_DIR names another folder.

Sign out

openpanel logout

This ends the CLI's session at once and deletes the saved token. With a saved API key, it deletes the key from the file; the key itself keeps working until it is revoked. logout does not touch OPENPANEL_TOKEN.

Another OpenPanel

To use the CLI with an OpenPanel at another address, sign in with --url:

openpanel login --url https://openpanel.example.com

The address is saved with the sign-in. OPENPANEL_URL or --url on a single command overrides it.

What can go wrong

MessageWhat it means
"You are not signed in. Run openpanel login, or set OPENPANEL_TOKEN to an API key."No saved sign-in and no OPENPANEL_TOKEN.
"The code expired. Run openpanel login again."Nobody approved the code within 10 minutes.
"The sign-in was refused in the browser."Someone chose It wasn't me.
"Too many sign-in codes from this address. Try again in an hour."More than 20 codes were asked for from one address in an hour.
"Pipe an API key (opk_…) into openpanel login --with-token."Standard input did not hold a key.
"API keys are made and revoked by a person: in the console under Organization settings, API keys, or with the CLI after openpanel login."A keys command ran with an API key. Run openpanel login and try again.
"This API key belongs to another organization."--org or OPENPANEL_ORG names another organization than the key's.