klops CLI

klops CLI

Everything the web interface does, in a terminal or a script.

View .md Reviewed against 2026.9.10
On this page

What it is

klops is the klickops command line. It uses the same REST API as the web interface. So almost anything you can click, you can also script.

A few things only work on the web for now:

  • filing and answering support requests. You can read them with klops support.
  • live traffic
  • the activity feed
  • your own sign-in methods and email settings

The CLI only talks to klickops. You don't need a kubeconfig, a direct database connection or kubectl. That keeps access control, audit and TLS in one place. Your laptop needs no cluster credentials.

When you'd use it

  • You deploy from a script or from your own CI.
  • You read logs or run a query without opening a browser.
  • You do the same thing in ten projects and don't want to click twenty times.

Signing in

You find the install command in klickops under Resources, CLI & MCP. It's one line and points the CLI at your server right away. On Windows the page shows a PowerShell command.

Later, klops update fetches the version your klickops runs. Once a day klops tells you when a new version is ready. Set KLICKOPS_NO_UPDATE_CHECK=1 to turn that off.

klops auth login --server https://klickops.example.com

Your browser opens klickops. Pick the organization this machine may use. If you want, give it read-only access. Then allow the sign-in. If you didn't start it yourself, deny it.

After that, the sign-in shows under Account, Connected apps. You can end it there. It ends by itself after 30 days without use, and after 90 days at the latest. klops then works in the organization you picked.

On a machine without a browser, add --device. The CLI then shows you a code. You approve it in any browser where you're signed in. That sign-in covers your whole account and lasts at most seven days. klops auth logout ends it on the server too.

The sign-in writes ~/.klickops/config.yaml with permissions 0600. If the permissions are looser, the CLI won't read the file. In CI you don't sign in. Instead you set KLICKOPS_SERVER and KLICKOPS_TOKEN with an API token. That way CI doesn't use your own account.

The shape of a command

A command names the thing first and then the action.

klops apps list --project shop
klops logs web --project shop --follow
klops databases query orders-db --project shop -- "select count(*) from orders"
klops apps deploy web --image nginx:1.27-alpine --port 80 --project shop

Every read command takes -o. That lets you use the output in scripts:

FormatFor
tableReading. The default.
jsonPassing to jq.
yamlComparing, or passing to another tool.
nameJust the names, for a shell loop.
wideWorks, but today shows the same columns as table.

klops prints no colours or escape codes. So klops apps list -o json | jq always gets clean output.

Put a folder online

klops up puts the folder you are in online, without a repository:

klops up --project shop

It packs the folder and sends it. klickops checks the code, keeps it as a version, builds it and puts it live, and klops prints each step. The first upload creates the app, named after the folder unless you name it (klops up web). A new app starts behind sign-in. .git, node_modules, .env files and what .gitignore and .dockerignore name stay out of the upload. klops apps source upload does the same.

klops apps source list shows the kept versions, the last 20. klops apps source deploy --version goes back to one, and klops apps source download saves one as a tar.gz. To change a few files without uploading the folder, use klops apps source put.

Where settings come from

The order is: flag, then environment variable, then config file, then default. So a --project on the command line wins over KLICKOPS_PROJECT. And KLICKOPS_PROJECT wins over the current context in ~/.klickops/config.yaml.

VariableSets
KLICKOPS_SERVERWhich klickops the CLI talks to
KLICKOPS_TOKENThe token to sign in with
KLICKOPS_ORGDefault organization
KLICKOPS_PROJECTDefault project

Exit codes

Scripts rely on these codes. That's why they stay the same.

CodeMeans
0Success
1Something went wrong
2You used the command wrong
3Not signed in, or the token expired
4Signed in, but not allowed
5Not found
6Already exists
7The request was too large

The difference between 3 and 4 matters. A 3 in CI means the token was revoked or is wrong. A 4 means the token needs more rights.

Limits and gotchas

  • Anything that destroys something asks first. Deleting, revoking, restoring over or rolling back needs a yes in the terminal. A script can't answer. The command then exits with 2. With --yes or -y it runs without asking.
  • There is no cache. Every command asks the server. Stale state hurts more than one network call.
  • The CLI refuses a config file with loose permissions. The file holds a token. If anyone can read it, that's surely a mistake.
  • A token belongs to an organization. Give your scripts a token of their own. If you leave the company, the pipeline keeps running. See API tokens.