# The CLI

> Every run command, its flags and how it signs in.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://run.docs.sypnia.com/tools/cli/

For agents: Run CLI commands: login/logout/whoami (device flow, session in ~/.config/sypnia mode 600), use <engine-url>, deploy [--env --local --prebuilt], deploys, promote/rollback, logs, env set|unset|ls|pull|apply, domains add|ls|rm, git connect|disconnect, jobs ls|runs|trigger, queues ls|dlq --replay, tokens create|ls|revoke, telemetry connect, engine install|upgrade|uninstall; --json, --token/SYPNIA_RUN_TOKEN; exit codes 0/1/2/3/4.

`npx @sypnia/run <command>`, or `run <command>` after `npm install -g @sypnia/run`.

| Command                                                 | What it does                                                                                          |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `login` · `logout` · `whoami`                           | Sign in with the device flow; the session is saved in `~/.config/sypnia/` (mode 600)                  |
| `use <engine-url>`                                      | Point the CLI at a self-hosted engine **\[Engine]**                                                   |
| `deploy [--env] [--local] [--prebuilt]`                 | Build and deploy the current folder                                                                   |
| `deploys [--app] [--env]`                               | List deploys                                                                                          |
| `promote <deploy> --env` · `rollback [--to]`            | Release a deploy, or go back                                                                          |
| `logs [--deploy] [--job] [--since] [--level] [--where]` | Read or follow logs                                                                                   |
| `env set\|unset\|ls\|pull\|apply`                       | Environment variables and secrets                                                                     |
| `domains add\|ls\|rm`                                   | Custom domains                                                                                        |
| `git connect\|disconnect`                               | Deploy from a repository                                                                              |
| `jobs ls\|runs\|trigger`                                | Scheduled jobs                                                                                        |
| `queues ls\|dlq [--replay]`                             | Queues and their dead-letter queues                                                                   |
| `cases ls\|trigger <case>\|dlq <case> [--replay]`       | The app's use cases: what each one starts on, run a scheduled case now, and a listener's dead letters |
| `cases keys create\|ls\|revoke`                         | Keys for one external case (`syp_rck_…`)                                                              |
| `tokens create\|ls\|revoke`                             | Deploy tokens                                                                                         |
| `telemetry connect`                                     | Link the app to Sypnia Telemetry                                                                      |
| `engine install\|upgrade\|uninstall`                    | Manage a self-hosted engine **\[Engine]**                                                             |

Every command accepts `--json` for scripts and agents, and `--token` (or `SYPNIA_RUN_TOKEN`) instead of the saved session. Exit codes: `0` success, `1` failure, `2` wrong usage, `3` not signed in, `4` permission denied.
