CLI
openpanel runs the operations of the API from a terminal: projects, services and their settings, deploys and rollbacks, variables and secrets, domains, servers, project access and API keys. Every command takes --json and then prints the API's own JSON, for scripts and AI agents.
Install
npm install -g https://cdn.openpanel.sh/cli/0.1.0/openpanel-cli-0.1.0.tgzIt needs Node.js 20 or newer. npx -y https://cdn.openpanel.sh/cli/0.1.0/openpanel-cli-0.1.0.tgz <command> runs it without installing.
OpenPanel serves the package itself, one file per version, with its SHA-256 beside it at
cdn.openpanel.sh/cli/0.1.0/SHA256SUMS. It is not on npm's registry: a
package called openpanel-cli there would not be OpenPanel's. To check the file before installing:
curl -fsSLO https://cdn.openpanel.sh/cli/0.1.0/openpanel-cli-0.1.0.tgz
curl -fsSL https://cdn.openpanel.sh/cli/0.1.0/SHA256SUMS | shasum -a 256 -c
npm install -g ./openpanel-cli-0.1.0.tgzSign in
openpanel loginThe CLI shows a code and opens openpanel.sh/cli, where you type the code and choose Sign in the CLI. The CLI then acts as you, in every organization you belong to. On a machine without a browser, such as a server or a CI job, use an API key instead: set it as OPENPANEL_TOKEN. See Sign in.
openpanel whoami shows who the CLI acts as, and openpanel logout signs it out: it ends the CLI's session and forgets its token.
Work in a project
Commands take --project (the project's slug, name or id) and --service (the service's name or id). To leave them out, link a folder once:
openpanel link --project shop --service webThis writes .openpanel.json in the folder. Commands run in that folder, or in any folder below it, use that project and service. See Link and deploy.
Your first deploy
With a server connected, a project and a service from a public image take three commands:
openpanel projects create shop
openpanel services create web --project shop --image nginx:1.27 --port http:80 --public --server my-server
openpanel deploy web --project shop --waitA public service with an HTTP port gets an opnl.app address at once; openpanel domains --project shop shows it. Every command is on the command reference.
Options for every command
| Option | |
|---|---|
--json | Print the API's JSON instead of tables |
-p, --project <project> | The project, by slug, name or id |
-s, --service <service> | The service, by name or id |
--org <slug or id> | Another of your organizations, for this command only |
-y, --yes | Confirm a destructive step without being asked; needed when no one is at a terminal |
--url <address> | Another OpenPanel than https://openpanel.sh |
-h, --help | The usage of the command's group, such as every projects command |
-v, --version | The CLI's version |
openpanel help lists the command groups, and openpanel help <group> shows one group's commands.
Environment
| Variable | |
|---|---|
OPENPANEL_TOKEN | An API key (opk_…) or CLI token (opc_…) to use instead of the saved sign-in |
OPENPANEL_URL | The OpenPanel to talk to; --url wins over it |
OPENPANEL_ORG | The organization to work in, by slug or id; --org wins over it |
OPENPANEL_CONFIG_DIR | Where the sign-in is kept. By default ~/.config/openpanel (or $XDG_CONFIG_HOME/openpanel), and %APPDATA%\openpanel on Windows |
Exit codes
| Code | Meaning |
|---|---|
0 | Done |
1 | Failed. The CLI prints the API's sentence, such as "This API key's scope is deploy; this needs admin." |
2 | Used wrongly: an unknown command or option, a missing argument, or a destructive step with no --yes and no one at a terminal to ask |
With --json, a failure is printed on standard error as {"error":{"message":"…","code":"…","status":403}}.