# CLI reference Every kortix command, the project-scoped token model, env vars, and exit codes. Canonical page: https://kortix.com/docs/reference/cli The `kortix` CLI drives everything the dashboard can, from a terminal — laptop, coding agent, or session sandbox. For common workflows, see [Using the CLI](/docs/guides/using-the-cli). Always available inside a session sandbox, no setup: - Binary on `PATH` (`/usr/local/bin/kortix`). - `KORTIX_CLI_TOKEN` pre-injected — the project-scoped token the CLI authenticates with. (`KORTIX_TOKEN` is also present, but it's the sandbox *service* key, not a CLI token.) - `KORTIX_API_URL` points at the platform you're running against. ## Quickstart inside a session ```sh kortix whoami # confirms what project + account this token has kortix projects info # the project you're running inside kortix secrets ls # encrypted env vars + manifest env spec kortix sessions ls # every session on this project (incl. you) kortix cr ls # open change requests kortix cr open --title "..." # propose merging your branch into main ``` The sandbox token is project-scoped: read+write anything on *this* project (secrets, sessions, triggers, and change requests), but it can't list other projects or touch account-level resources. See [Token scope](#token-scope). ## On your laptop ```sh curl -fsSL https://kortix.com/install | bash kortix login # opens browser, you click Authorize ``` The local CLI uses a user-scoped token at `~/.config/kortix/config.json` (mode 0600), which sees every project on every account you're a member of. ## Command surface ### Auth | Command | Effect | | --- | --- | | `kortix login [--token ] [--host ] [--api ]` | Default: opens browser → click Authorize → token written. `--token` is the headless fallback. `--host` logs into a named host slot. | | `kortix logout [--host ]` | Remove the token for the active host (or named one). | | `kortix whoami [--host ] [--json] [--token-only]` | Print the user + active account on the chosen host. `--json` for machine-readable output; `--token-only` prints just the active token context. | | `kortix token [--host ]` | Shortcut for `whoami --token-only` — the active token's project/session/agent grants, script-friendly. | ### Hosts A host is one Kortix API endpoint. The built-ins `cloud` (Kortix Cloud), `selfhost` (your `kortix self-host` stack), `local-dev` (a local `pnpm dev` server), and `kortix-internal-dev` are always available, and you can add more endpoints. One host is active at a time; the CLI prints the active host before operational commands so Cloud/local actions are harder to mix up. | Command | Effect | | --- | --- | | `kortix hosts ls` | List configured hosts (`●` marks active). | | `kortix hosts use []` | Switch active host. No name → arrow-key picker. | | `kortix hosts add --url [--login]` | Register a new host. `--login` runs the browser flow right after. | | `kortix hosts rm ` | Remove a host (confirms when it's the last one). | | `kortix hosts info []` | Detailed view of one host. | | `kortix hosts current` | Print the active host name (script-friendly). | `--host ` overrides the active host for one invocation: `kortix projects ls --host local`. ### Accounts One Kortix login can belong to many accounts (personal, a company account, …). Exactly one is active at a time; every account-scoped command (`projects ls`, `ship`, …) operates on it unless overridden. | Command | Effect | | --- | --- | | `kortix accounts ls [--json]` | List the accounts you belong to. | | `kortix accounts use []` | Switch the active account. No arg → arrow-key picker. | | `kortix accounts current [--json]` | Print the active account. | | `kortix accounts info [] [--json]` | Show one account (defaults to the active one). | ### Self-host `kortix self-host` is one generic Docker-native system — no separate "target" to pick. `init` generates a `docker-compose.yml` + `.env` (plus a `Caddyfile` and `updater.sh` when a domain is configured) into `~/.config/kortix/self-host//`, and `start` pulls the images and runs `docker compose up`. It's identical on a laptop, any VPS, or a cloud VM — there is no AWS profile, no Terraform, no TUF/signing, no SSM. `start` creates config if needed, starts Supabase/API/gateway/frontend locally, and collects the Daytona sandbox key, managed GitHub access, and optional Pipedream connector integration via the `configure` wizard. Local ports, generated secrets, and image tags are handled automatically. A public domain + TLS is opt-in: set `KORTIX_DOMAIN` (and optionally `KORTIX_API_DOMAIN`, default `api.`) via `env set` to turn on the bundled Caddy reverse proxy, which terminates TLS via ACME HTTP-01 on ports 80/443 — leave it unset for the default loopback-port setup. An always-present in-compose `kortix-updater` service (gated by `KORTIX_AUTO_UPDATE`, on by default) pulls the configured channel's images on an interval (`KORTIX_UPDATE_INTERVAL`, default daily) and rolls the stack forward when anything actually changed — `update`/`reconcile` just runs that same logic once, immediately. The full operator runbook lives at `docs/runbooks/self-hosting.md` in the repository, and the architecture is documented at [Self-hosting architecture](/docs/reference/self-hosting-architecture). For a bare Linux box (VPS/EC2), `scripts/kortix-selfhost-up.sh` installs Docker + the CLI and runs `init`/`start` for you — see the runbook. | Command | Effect | | --- | --- | | `kortix self-host init` | Create or refresh the self-host config, without starting the stack. Non-mutating to a running stack. | | `kortix self-host configure` | Interactive wizard for integrations (Daytona, GitHub, Pipedream) and update policy (channel, auto-update, interval). | | `kortix self-host doctor` | Validate local Docker tooling and the rendered Compose config. Non-mutating. | | `kortix self-host start` | Create config if needed, start the stack, and register the `selfhost` host. | | `kortix self-host update [--tag \| --channel stable\|latest]` | Pull the configured (or given) channel/tag's images and recreate the stack in place — migrates first, then rolls forward. | | `kortix self-host reconcile` | Alias for `update` — converge to the configured channel/version right now. | | `kortix self-host rollback --release ` | Roll back to an explicit older version (same mechanics as `update`, pinned). | | `kortix self-host version` | Show the running version, configured channel, and whether a newer release is available. | | `kortix self-host restart` | Restart the stack. | | `kortix self-host status` | Show Docker Compose service status. | | `kortix self-host open` | Open the dashboard in your browser. | | `kortix self-host env ls` | Show persistent self-host env values, masking populated secrets. | | `kortix self-host env set KEY=VALUE …` | Update persistent env values (domain, integrations, update policy, …) before the next start. | | `kortix self-host logs [service]` | Tail Docker Compose logs. | | `kortix self-host stop` | Stop the stack. | Common flags: `--instance ` (default `default`), `--tag ` / `--release ` (pin an explicit image tag), `--channel stable|latest` (default `stable`), `--auto-update on|off` (default `on`), `--update-interval ` (default `86400`), `--json`, and `--yes`. ### Projects | Command | Effect | | --- | --- | | `kortix projects ls [--all] [--json]` | Every project on the active account. `--all` spans every account you belong to, grouped. | | `kortix projects info [] [--json]` | Show one project (defaults to the linked/default one). | | `kortix projects use []` | Set the global **default** project (interactive picker if omitted). Switches the active account to that project's account. | | `kortix projects unset` | Clear the global default project. | | `kortix projects link []` | Bind cwd to a remote project. Writes `.kortix/link.json` with `project_id`, `account_id`, `host`, `host_url`. No arg → arrow-key picker. | | `kortix projects unlink` | Drop `.kortix/link.json`. | | `kortix projects rm [] [--purge] [-y\|--yes]` | Archive a project (defaults to the linked one). `--purge` also deletes its managed git repo (irreversible). `-y` skips the confirmation. | | `kortix projects open []` | Open the dashboard URL for a project in your browser. | A directory link (`.kortix/link.json`) always wins over the default; the default (`kortix projects use`) is what commands use anywhere else on your machine. #### How a command finds "the project" In strict order: 1. `--project ` flag. 2. `KORTIX_PROJECT_ID` env var (this is also how a session sandbox's own project is picked up — one check, not a separate sandbox step). 3. `.kortix/link.json` in the exact cwd — no ancestor/parent-directory search. 4. The global default project set by `kortix projects use`. If none resolve, the command errors pointing to `projects link`. #### How a command finds "the host" 1. `--host ` flag. 2. Inside a session sandbox: the platform-injected `KORTIX_CLI_TOKEN` / `KORTIX_EXECUTOR_TOKEN` resolves the host directly — this wins over `.kortix/link.json`'s host field. 3. `host` field in `.kortix/link.json` (so a repo on your laptop hits its home Kortix instance). 4. The globally-active host. ### Secrets Encrypted env vars stored on the project, injected as plain env into every session sandbox at boot. | Command | Effect | | --- | --- | | `kortix secrets ls` | List secrets by identifier + manifest `env` spec (`env:` in `kortix.yaml`, `[env]` in legacy `kortix.toml`), showing `→ KEY` when the injected env key differs; marks required-but-missing. | | `kortix secrets set NAME=VALUE …` | Upsert one or more. `NAME=-` reads VALUE from stdin (so values never appear in shell history). Add `--identifier ` (alias `--id`) with exactly one `KEY=VALUE` pair to store a second value under the same env key. | | `kortix secrets request NAME [NAME …] [--scope runtime\|connector] [--expires ]` | Mint a short-lived link for a human to **enter** the value(s) directly — you never see or handle the raw value. Surface the URL (web: fill-in modal; Slack: tappable link). | | `kortix secrets unset NAME …` | Remove. | ### Env — dotenv ↔ secrets | Command | Effect | | --- | --- | | `kortix env pull [--out .env] [--force]` | Write a `.env` skeleton (names only — plaintext can't leave the cloud). | | `kortix env push --from ` | Upload every `NAME=VALUE` from a dotenv file as a secret. Supports quoted values, `export NAME=…`, comment lines. | ### Connectors Integrations agents call as tools (Pipedream apps, MCP servers, OpenAPI/GraphQL/HTTP endpoints) — mirrors the dashboard's Customize → Connectors. Connectors are project-wide visible; the access gate is which agents may call one (`[[agents]].connectors` in `kortix.yaml`, see [Grants](#grants)). `add` / `rm` / `policy set` edit the **local** `kortix.yaml` (the source of truth) — run `kortix ship` to apply, then `sync` to reconcile — unless you pass `--apply`, which skips ship/CR and applies on the cloud project immediately. | Command | Effect | | --- | --- | | `kortix connectors ls [--json]` | List connectors + status, auth. | | `kortix connectors show [--json]` | Show one connector's tools (actions). | | `kortix connectors add --provider

[options] [--apply]` | Add a `[[connectors]]` block to `kortix.yaml` (or apply instantly on the cloud project with `--apply`). | | `kortix connectors rm [--apply]` | Remove a `[[connectors]]` block. | | `kortix connectors rename ` | Set a connector's display name (applies now). | | `kortix connectors mode shared` | Set the profile model — `shared` is currently the only mode (applies now + re-syncs). | | `kortix connectors sync` | Reconcile the catalog from the shipped `kortix.yaml`. | | `kortix connectors credential [value]` | Set a connector's credential (prompts if no value; reads stdin with `-`). | | `kortix connectors connect ` | Start a Pipedream 1-click connect. | | `kortix connectors link [--expires ]` | Mint a durable shareable Quick Connect link to hand a human. Auto-finalizes. | | `kortix connectors finalize ` | Confirm a Pipedream connection completed. | | `kortix connectors apps [] [--json]` | Browse the Pipedream app catalog. | | `kortix connectors policy ls [--json]` | Show project-wide execution policies. | | `kortix connectors policy set --default ` | Set the default execution mode. | | `kortix connectors policy ls [--json]` | Show one connector's tool-call rules. | | `kortix connectors policy set ` | Set a rule for a tool name, glob (`send_*`), or `/regex/` (applies now). | | `kortix connectors policy rm ` | Remove a connector rule. | | `kortix connectors policy clear` | Remove all of a connector's rules. | `add` options: `--name

) [options]` | Create a custom template (kicks a build). | | `kortix sandboxes update [options]` | Update a UI-created template. | | `kortix sandboxes build ` | Trigger a rebuild for a template. | | `kortix sandboxes rebuild ` | Force-rebuild (delete existing snapshot first). | | `kortix sandboxes rm ` | Delete a UI-created template. | | `kortix sandboxes fix` | Start a session seeded with the last failed build log so an agent can repair it. | Options for `add`/`update`: `--image ` (mutually exclusive with `--dockerfile`), `--dockerfile ` (repo-relative), `--name

]` | List commits on `--ref`. | | `kortix files show ` | Show one commit + its changed files. | | `kortix files diff [--path

]` | Print a commit's unified patch. | | `kortix files compare ` | Summarize the diff between two refs. | Options: `--ref ` (branch/tag/commit, default: the project's default branch), `--path

` (scope to a subtree or file), `--limit `, `--json` (supported by every subcommand). ### Triggers Round-trip through the manifest's `triggers:` (v2 `kortix.yaml`) or `[[triggers]]` (legacy `kortix.toml`); the dashboard sees the same state. `add` / `rm` / `enable` / `disable` edit the **local** manifest — run `kortix ship` to apply. `pause` / `resume` are a separate **server-side** activation switch (cloud state, not the manifest) — use them to stop one of two deployments of the same repo from double-firing; manual `fire` still works while paused. | Command | Effect | | --- | --- | | `kortix triggers ls [--json]` | List triggers + runtime state (`last_fired_at`). | | `kortix triggers add [options]` | Append a `[[triggers]]` block (cron or webhook) to `kortix.yaml`. See options below. | | `kortix triggers rm ` | Remove a trigger from `kortix.yaml`. | | `kortix triggers info [--json]` | Show one trigger in full. | | `kortix triggers fire ` | Manually fire a trigger now. | | `kortix triggers enable ` | Set `enabled = true`. | | `kortix triggers disable ` | Set `enabled = false`. | | `kortix triggers pause` | Deactivate **all** of this project's triggers server-side (crons + webhooks stop auto-running). | | `kortix triggers resume` | Re-activate this project's triggers server-side. | `add` options: `--type ` (default `cron`), `--prompt ` (required — initial prompt for the spawned session), `--agent ` (default: the opencode default), `--cron ` (6-field cron, e.g. `"0 0 9 * * 1-5"`), `--timezone ` (default UTC), `--secret-env ` (HMAC secret env var, webhook type), `--name