# Command reference

Source: https://openpanel.sh/docs/cli/commands

Every command of the openpanel CLI, grouped by what it works on.

Each command is one or a few calls to the [API](/docs/api), and takes the [options every command has](/docs/cli#options-for-every-command): `--json`, `--project`, `--service`, `--org`, `--url` and `--yes`. With `--json`, a command prints the API's JSON; a list prints every item of every page as one array.

A project is named by its slug, its name or its id; a service by its name or its id; a server by its name, its address or its id. In a [linked folder](/docs/cli/deploy), `--project` and `--service` can be left out.

## Account and organization [#account-and-organization]

| Command | What it does |
|---|---|
| `openpanel login [--with-token] [--no-browser] [--url https://openpanel.sh]` | Sign in through the browser with a one-time code, or with an API key from standard input. See [Sign in](/docs/cli/sign-in). |
| `openpanel logout` | Sign out: ends this CLI's session and forgets its token. |
| `openpanel whoami` | Who you are signed in as, your role, the organization commands work in, and whether you use a CLI session or an API key. |
| `openpanel orgs` | Your organizations; `*` marks the one commands work in. |
| `openpanel orgs switch <slug\|id>` | Work in another of your organizations from now on. |
| `openpanel members` | The organization's members and their roles. |
| `openpanel audit [--project p] [--action service.update] [--limit 50]` | The [audit log](/docs/monitoring/audit-log), newest first. Owner and admins only. `--action` takes an action such as `service.update`, or a kind of resource such as `service` for all of its actions. |

## Projects [#projects]

| Command | What it does |
|---|---|
| `openpanel projects` | The projects you can see, with your access to each. |
| `openpanel projects create <name> [--private]` | Make a project with its production environment. You get admin access to it. With `--private`, only the people given access and the organization's owner see it. |
| `openpanel projects get [project]` | One project with its environments. |
| `openpanel projects rename <project> <new name>` | Rename a project. |
| `openpanel projects visibility <project> <organization\|private>` | Show a project to the whole organization, or only to people given access. See [Private projects](/docs/members/private-projects). |
| `openpanel projects access <project>` | Who can reach a project: each member's role, and their own access to this project if they have one. |
| `openpanel projects access <project> <member email\|id> <none\|view\|deploy\|admin\|role>` | Set one member's access to this project. `role` takes their own access away, so their organization role decides again. See [Per-project access](/docs/members/per-project-access). |
| `openpanel projects delete <project> [--yes]` | Delete a project with all its services, volumes, variables, deployments and domains. |
| `openpanel environments [--project p]` | A project's environments: production and any beside it. |
| `openpanel environments create <name> [--project p]` | Add an environment beside production, such as `staging`. Project admins only. |
| `openpanel environments delete <name> [--project p] [--yes]` | Delete an environment with its own variables. Production cannot be deleted, nor an environment that still has services. |
| `openpanel link --project <project> [--service <service>]` | Link this folder to a project, and to a service, so commands run here need no `--project` or `--service`. |

## Services [#services]

| Command | What it does |
|---|---|
| `openpanel services [--project p]` | A project's services. |
| `openpanel services create <name> …` | Make a service from a Docker image or a Git repository, with the settings below. |
| `openpanel services get [service] [--project p]` | A service's settings. |
| `openpanel services update [service] …` | Change a service's settings. They take effect at the next deploy. |
| `openpanel services delete <service> [--yes]` | Delete a service with its volumes, variables, deployments and domains. |
| `openpanel volumes add <mount path> [--size 10] [--service s]` | Give a service persistent storage, created at the next deploy. A service with a volume runs as one instance. |
| `openpanel volumes remove <volume id> [--yes]` | Remove a volume. Its data is deleted at the next deploy. |
| `openpanel git` | The Git accounts connected in the console, with the ids `--git-account` takes. |

### Service settings [#service-settings]

`services create` and `services update` take these settings. `services update` changes only the settings you pass.

| Setting | What it sets |
|---|---|
| `--image nginx:1.27` | Run a published image. Without a registry in the name, it comes from Docker Hub; without a tag, `latest`. |
| `--repo owner/app --git-account <id>` | Build from a repository in one of the organization's [Git accounts](/docs/git). |
| `--branch main` | The branch to build. Default `main`. |
| `--path apps/web` | The folder in the repository to build, for a monorepo. Default: the repository's root. |
| `--dockerfile docker/Dockerfile` | Build with this Dockerfile. Without it, the build is detected. Git only. |
| `--start "<command>"` | The start command, run with `/bin/sh -c`. `--start ""` goes back to the image's own. |
| `--public` | Reach it at an opnl.app address and your own domains. |
| `--private` | Reach it only on your private network. |
| `--no-address` | Reach it from no address at all. This is the default for a new service. |
| `--port http:3000` | A port it listens on: `http:3000`, `tcp:5432` or `udp:27015`. Repeat for several. Passing any `--port` replaces the whole list. |
| `--balancer`, `--no-balancer` | Turn the load balancer on or off. It is for public services. |
| `--replicas 3` | How many copies run, 1 to 100. More than one copy of a public service needs the load balancer. |
| `--server <name>` | A server it may run on. Repeat for several. Passing any `--server` replaces the whole list. |
| `--health http:3000:/health` | How a copy is checked: an HTTP request to a port and path, or `tcp:5432` for a TCP connection. |
| `--cpus 1` | The CPUs each copy may use, from 0.1. |
| `--memory 512` | The memory each copy may use, in MB. |
| `--volume /data:10` | `services create` only: a volume at this path, with its size in GB after the colon. Repeat for several. |
| `--environment <name>` | `services create` only: make it in this environment (its name or id) instead of production. |

See [Service settings](/docs/projects/settings) for what each setting does and the rules between them.

## Deploys [#deploys]

| Command | What it does |
|---|---|
| `openpanel deploy [service] [--commit <sha>] [--wait] [--project p]` | Deploy a service as it is set now. For a Git service, `--commit` builds that commit instead of the branch's latest. `--wait` prints each new status until the deployment runs or fails, and exits with `1` if it fails. |
| `openpanel deployments [service] [--project p]` | A service's deployments, newest first; `*` marks the service's current one. |
| `openpanel deployments get <deployment id>` | One deployment: its status, image, commit and error. |
| `openpanel rollback [deployment id] [--service s] [--yes]` | Run an earlier deployment's image again, with the service's settings of today. Without an id, the newest deployment before the current one that has an image and did not fail or get cancelled. |
| `openpanel metrics [service] [--range 1h\|6h\|24h\|7d\|30d]` | The service's CPU, memory and network now, on average and at the peak over the range, all replicas together, and how often its containers restarted. `--json` gives each replica's points. |
| `openpanel logs [service] [--tail 100] [--deployment id] [-f\|--follow]` | What the service's running containers print, read live from your servers and merged by time. `--deployment` prints that deployment's build and deploy logs instead. `--follow` keeps reading every 2 seconds. |

See [Link and deploy](/docs/cli/deploy) for how a deploy runs.

## Variables [#variables]

| Command | What it does |
|---|---|
| `openpanel env [--service s \| --environment id] [--project p]` | The variables set on the project, on an environment or on a service. A secret shows no value. |
| `openpanel env get <NAME> [--service s]` | One variable's value as set on the project, or with `--service`, as that service gets it and where it was set. |
| `openpanel env set NAME=value… [--secret] [--service s \| --environment id]` | Set variables on the project, or on an environment or a service. They take effect at the next deploy. A secret is never shown again. |
| `openpanel env unset NAME… [--service s \| --environment id]` | Remove variables from that place. |
| `openpanel env pull [file] [--service s] [--force]` | Write what a service gets to a `.env` file (`.env` by default), readable by you only. A secret is written as a comment without its value. `--force` replaces a file that exists. |

To keep a secret out of your shell's history, give the name alone and pass the value on standard input:

```sh
printf %s "$STRIPE_KEY" | openpanel env set STRIPE_KEY --secret
```

See [Variables](/docs/variables).

## Domains [#domains]

| Command | What it does |
|---|---|
| `openpanel domains [--project p]` | A project's domains, with the service each serves and whether its DNS is verified. |
| `openpanel domains add <host> [--service s] [--port 80]` | Give a public service a name on opnl.app, or your own domain. For your own domain, it prints the DNS records to add. `--port` picks one of the service's HTTP ports; by default the first. |
| `openpanel domains verify <host> [--project p]` | Check your own domain's TXT record now. Once it holds the domain's value the domain is verified and yours; otherwise it prints the record to add. |
| `openpanel domains remove <host\|id> [--project p] [--yes]` | Take a domain off its service. |
| `openpanel domains certificate <host> [--chain fullchain.pem --key key.pem \| --remove]` | Show the certificate the edge serves for your own domain, upload one (the chain with your certificate first, and its key), or remove it. |
| `openpanel dns` | The Cloudflare zones where OpenPanel writes your own domains' DNS records. |
| `printf %s "$CLOUDFLARE_TOKEN" \| openpanel dns connect` | Connect a Cloudflare zone with a token limited to it, read from standard input. Organization admins. |
| `printf %s "$CLOUDFLARE_TOKEN" \| openpanel dns token <zone>` | Give a connected zone a new token for the same zone. |
| `openpanel dns remove <zone> [--yes]` | Disconnect a zone once no domain has records OpenPanel wrote there. |

## Servers [#servers]

| Command | What it does |
|---|---|
| `openpanel servers` | The organization's servers. |
| `openpanel servers get <name\|id>` | One server. |
| `openpanel servers status <name\|id>` | Whether its agent is online, its version, when it was last seen, and which version of its desired state it has applied. |
| `openpanel network` | The private network's devices, their addresses, and whether they are online. |
| `openpanel regions` | OpenPanel's own regions. |

Servers are connected in the console. See [Connect your own server](/docs/servers).

## API keys [#api-keys]

| Command | What it does |
|---|---|
| `openpanel keys` | Your API keys; the owner and admins see everyone's. |
| `openpanel keys create --name <name> --scope <view\|deploy\|admin> [--project p]… [--expires 2027-01-01]` | Make an API key for CI or an AI agent, and print it once. Without `--scope`, the key gets `deploy`. Repeat `--project` to limit the key to those projects. |
| `openpanel keys revoke <id> [--yes]` | Revoke a key. Anything using it stops working at once. |

API keys are made, listed and revoked by a person, so these commands work only after `openpanel login`, never with an API key. See [API keys](/docs/api/authentication#api-keys).

## AI agents [#ai-agents]

| Command | What it does |
|---|---|
| `openpanel skills` | The [skills](/docs/ai/skills) that teach an AI agent the common OpenPanel jobs. |
| `openpanel skills install [--dir ~/.claude/skills]` | Copy the skills into an agent's skills folder, Claude Code's by default. |

## Any API path [#any-api-path]

| Command | What it does |
|---|---|
| `openpanel api <METHOD> <path> [--data '<json>']` | Call any [API](/docs/api) path, for what no command covers, and print its JSON. |

For example, the environments of a project:

```sh
openpanel api GET /projects/<project id>/environments
```