CLI
The sandal CLI (private beta): sign in with your browser, then create, exec into, copy files to, expose, snapshot and fork sandboxes from your terminal.
Install#
Private beta: the CLI is not on npm yet. Install the single-file binary from your beta bundle, or the npm package file that is in the same bundle (sandal-dev-cli-0.1.0-beta.16.tgz, Node.js 24+, also gives sandal-mcp):
install -m 755 cli/bin/sandal-darwin-arm64 ~/.local/bin/sandal # Intel Mac: sandal-darwin-x64
npm install -g ./sandal-dev-cli-0.1.0-beta.16.tgz # alternative: from the bundle's CLI + MCP folder
sandal version # 0.1.0-beta.16Sign in#
sandal login signs you in through the Sandal Console with a browser (device authorization). In a terminal it opens the Console page, prints the URL and a short code, and waits until you confirm the code there. Confirm only if you just ran sandal login yourself. The CLI then stores a CLI session (a one-hour access token plus a rotating refresh token) in a named profile and refreshes it automatically before it expires. It also picks the project for the profile: --project <id>, else the profile's current project (same organization), else the project named Default, else the only one.
Credentials live in ~/.config/sandal/config.json (or $SANDAL_CONFIG_DIR/config.json, or under $XDG_CONFIG_HOME/sandal/), written with mode 0600; the CLI refuses a config file that is group- or world-readable. A browser sign-in replaces an API key stored in the same profile. If the code expires or is denied, run sandal login --new.
sandal login # opens the browser, shows the code, waits
sandal login --no-browser # print the URL and code without opening a browser
sandal whoami # resolved target, credential, scopes and expiry
sandal profile list
sandal profile use <name>
sandal sessions list # CLI sessions of your account
sandal logout # revokes this profile's session and removes it (or removes its API key)| Flag | Meaning |
|---|---|
--no-browser | Print the URL and code without opening a browser |
--project <id> | Use this project instead of the default choice |
--profile <name>, --api-url <url> | Store the session in this profile; sign in against another API |
--new | Replace a pending sign-in code (a rerun otherwise shows the same code) |
--json | Print the URL, code and expiresAt and exit without waiting |
--json --wait | Print the same, then wait for the browser step |
Agents, scripts and machines without a browser can split the flow in two: sandal login --json prints the URL and code and exits, a person approves in the Console, then sandal onboard --wait --json stores the session. Account commands (orgs, projects, api-keys, billing, sessions) need a browser sign-in; an API key cannot manage the account.
CI and other non-interactive use keeps the API key. Create a project API key in the Console and pipe it in; the key is read from stdin (--key-stdin or --api-key-stdin) or from a hidden prompt (--key), validated against the API, and stored in the profile. Without a terminal on stdin, sandal login reads the key from stdin on its own. Or skip login and set SANDAL_API_KEY.
printf '%s' "$SANDAL_API_KEY" | sandal login --key-stdin # organization and project come from the keyAPI keys are never accepted as command-line arguments. Environment variables override the profile: SANDAL_API_KEY, SANDAL_ORGANIZATION_ID, SANDAL_PROJECT_ID, SANDAL_API_URL (default https://api.sandal.dev) and SANDAL_PROFILE. SANDAL_API_KEY alone is enough: the organization and project are resolved from the key, and the two id variables are optional overrides.
Global options#
| Option | Meaning |
|---|---|
--json | Print machine-readable JSON (every command) |
-p, --profile <name> | Profile from the config file (or SANDAL_PROFILE) |
--api-url <url> | API origin (or SANDAL_API_URL) |
--organization <id> | Organization id (or SANDAL_ORGANIZATION_ID) |
--project <id> | Project id (or SANDAL_PROJECT_ID) |
-h, --help | Help for any command, e.g. sandal create --help |
Exit codes: 0 ok, 1 failed, 2 usage or config, 3 auth, 4 not found, 5 conflict, 6 quota, 7 unavailable, 8 timeout, 9 network. sandal exec and sandal shell pass the remote exit code through.
Sandboxes#
sandal create#
Create a sandbox and wait until it is running. Without --template it uses the project's default template. On a terminal it prints a table; piped or with --json it prints JSON Lines (the ready event carries the sandbox).
sandal create --size s --name dev
sandal create --cpu 4 --memory 8192 --disk 40 --ttl 8h
sandal create --size m --auto-stop 30m --env FOO=bar| Option | Meaning |
|---|---|
-t, --template <id> | Published template id (default: the project default template) |
--template-digest <sha256:…> | Pin the exact template digest |
-n, --name <name> | Display name |
--size <tier> | xs 1/1/10, s 2/4/20, m 4/8/40, l 8/16/80, xl 16/32/160 (vCPU / GiB RAM / GiB disk) |
--cpu, --memory <MiB>, --disk <GiB>, --cpu-class | Explicit resources instead of a size (defaults 2 vCPU, 4096 MiB, 20 GiB, burstable) |
--ttl <duration> | Hard expiry (default 24h) |
--auto-stop, --auto-archive, --auto-delete <duration> | Automatic lifecycle policy |
--auto-resume | With --auto-stop: wake on API or preview traffic (not SSH) with the disk kept (switched on per project during the beta) |
-e, --env <NAME=value> | Initialization environment (repeatable) |
--no-wait, --wait-timeout <seconds> | Return after admission / bound the wait (default 300) |
--idempotency-key <key> | Retry-safe mutation identity (default: random) |
Without --template the project's default template is used (see the Quickstart). A pinned catalog id stops working when it is retired (404, “was retired”); omitting the template never goes stale.
sandal list / sandal get#
sandal list # ID NAME STATE KIND TEMPLATE CPU MEM AGE (deleted sandboxes hidden)
sandal list --state running --json
sandal get <sandbox>Lifecycle#
sandal stop <sandbox> # keeps the disk
sandal start <sandbox>
sandal pause <sandbox> # keeps memory
sandal resume <sandbox>
sandal archive <sandbox> # cold storage; needs a running sandbox
sandal recover <sandbox> # from archive or failure (optionally --snapshot <id>)
sandal delete <sandbox> # deletes the sandbox and wipes its disk; returns once the delete is accepted (--wait: until teardown finishes)
sandal fork <sandbox> --name dev-2 # copy-on-write fork into a new sandbox (or --snapshot <id>)
sandal lifecycle get <sandbox> # policy, idle evidence, next automatic transition
sandal lifecycle set <sandbox> --auto-stop 1h # off | inherit | duration
sandal lifecycle defaults --auto-archive 7d # project defaults
sandal keep-alive <sandbox> --for 2h # restart the idle clock and hold it (max 24h)Processes#
sandal exec <sandbox> -- npm test # streams output, exits with the remote exit code
sandal exec <sandbox> --cwd /workspace -e CI=1 -- sh -c 'make && make test'
sandal exec <sandbox> --detach -- python3 -m http.server 3000 # prints the process id
sandal logs <sandbox> <process> -f
sandal shell <sandbox> # interactive PTY shellsandal exec options: -w, --cwd (default /workspace), -e, --env NAME=value, --secret NAME=secretId@version (Vault reference), --timeout 30m, -t, --tty, -d, --detach, --shell (run the string through /bin/sh -lc), --root (run as root; the default template refuses it with 422 capability_unavailable, exit code 7, and the message names tenant-root-v1 and up to three ready templates of your project that declare it; see Root and FUSE (preview)), --direct-exec (use the direct exec path for this one command; without it a single sandal exec uses the API path, which is slightly faster for one call).
Each sandal exec is a new process: a single command takes about 0.4 s median. For many short commands, hold one SDK handle instead (on the direct path, about 125 ms median per command on the default Linux template and about 50 ms on the default container image, measured from Helsinki on November 29, 2026).
Files#
sandal cp ./hello.txt <sandbox>:/workspace/hello.txt
sandal cp -r ./src <sandbox>:/workspace/src
sandal cp <sandbox>:/workspace/out.txt .
sandal upload <sandbox> ./hello.txt /workspace/hello.txt
sandal download <sandbox> /workspace/out.txt - # '-' prints to stdout
sandal files ls <sandbox> /workspace
sandal files cat <sandbox> /workspace/hello.txt
sandal files stat|rm|mkdir|mv ...
sandal files find <sandbox> '**/*.ts' --path /workspace
sandal files grep <sandbox> TODO --path /workspace --include '*.ts'
sandal files replace <sandbox> oldName newName --path /workspace --dry-runLarge transfers use signed transfer URLs (24 MiB in about 5 s up and 3 s down); where those are switched off the CLI falls back to the much slower chunked API.
Ports#
sandal ports expose <sandbox> 3000 --ttl 1h # prints the exposure and its URL
curl -H "Authorization: Bearer $SANDAL_API_KEY" <url>/
sandal ports get <sandbox> <exposure>
sandal ports revoke <sandbox> <exposure>Exposure URLs (url) require Authorization: Bearer <API key>. For a link anyone can open, add --share (or sandal ports token); revoke it with sandal ports share-links revoke.
The shortcut for share links:
sandal share <sandbox> 3000 --ttl 1h --single-use # exposes the port if needed and prints a share link
sandal share ls <sandbox> <exposure>
sandal share revoke <sandbox> <exposure> <share-link> # the link answers 410 from then on
sandal share token <sandbox> <exposure> # a one-browser link with an access tokenA share link lives 24 h at most, can be single-use and is revocable; a revoke does not end a session that is already open (up to 1 h). See Share links.
Snapshots#
sandal snapshot create <sandbox> # waits until ready
sandal snapshot list <sandbox>
sandal snapshot get <sandbox> <snapshot>
sandal fork <sandbox> --snapshot <snapshot> --name from-snapshotGit#
sandal git clone <sandbox> https://github.com/acme/app.git /workspace/app --depth 1
sandal git status <sandbox> /workspace/appPrivate repositories take credentials by Vault reference (--credential secretId@version), never inline tokens. git branches, commit, push, pull and checkout are also available.
sandal git diff <sandbox> --path /workspace/app --base main # per-file +/- (add --file <path> for its patch)
sandal git deliver <sandbox> --run <run> -m "Fix the bug" --title "Fix the bug" --body @PR.md --draft
sandal git connections create --provider github --app-id 123456 --installation-id 78901234 --private-key @app.pem
sandal git grants list-project --state activegit deliver commits, pushes and opens or updates a pull request. Connections and grants are the git credential broker (sandal git connections); delivery is sandal git deliver --help. Both are rolling out and off by default.
Agents#
sandal agents start <sandbox> --provider claude --key ANTHROPIC_API_KEY --prompt "Fix the flaky test" --follow
sandal agents start <sandbox> --provider codex --key OPENAI_API_KEY --repo acme/web --prompt-file task.md
sandal agents follow <sandbox> <run> # live, resumable (--cursor), --poll for long polling
sandal steer <sandbox> --run <run> "Use the existing retry helper instead"
sandal agent interrupt <sandbox> <run>
sandal agents list --state failed --all # every run of the project
sandal prompt <sandbox> "…" # conversational shorthand; --resume cnv_… / --new
sandal conversations <sandbox>
sandal agent models # harnesses, models, effortsEverything about runs, keys, streaming and failure codes is in sandal agent --help.
Browser IDE#
sandal ide open <sandbox> --path /home/enter/workspace # VS Code in your browser; --no-browser prints the link
sandal ide status <sandbox>
sandal ide stop <sandbox>Browser IDE: beta, off by default (sandal ide --help).
Webhooks#
sandal webhooks create https://example.com/hook --event run.completed,run.failed --secret-file ./secret
sandal webhooks deliveries <webhook> --status exhausted
sandal webhooks redeliver <webhook> <delivery>
sandal webhooks rotate <webhook> --overlap 86400See Webhooks.
Project#
sandal capabilities # features and limits enabled for this project
sandal templates list # templates with what their image declares (CAPABILITIES, e.g. tenant-root-v1)
sandal templates get <template> # published digest and capabilities of a template
sandal completion zsh > ~/.zfunc/_sandal
sandal versionAccount and billing#
These need the browser sign-in (sandal login); an API key cannot read organization billing. Billing and invoices are not available yet in the private beta (the Console shows them as "Not available").
sandal billing # plan, balances and invoices of the organization
sandal billing usage # Sandbox compute of this billing period, every project: vCPU-s, GiB-s, estimate
sandal billing usage --since 2026-11-01T00:00:00Z --sandboxes # with the Sandboxes behind the totalmacOS VMs run on a Mac leased to your organisation alone: sandal macos lease create --region eu-central --accept-apple-licence, then sandal macos create --region eu-central --lease <lease> --accept-apple-licence. sandal macos create waits until the VM is running (about a minute; progress on stderr, and the reason while it waits, for example that both VM slots of your leased Mac are taken). --no-wait returns at once. sandal macos exec on a VM that is still starting waits until it is running. Right after a VM turns running its agent can take a moment to connect; if that first command is refused, wait a few seconds and run it again.
Devices: sandal devices capabilities shows what your project can create. iOS Simulators: sandal devices ios create | screenshot | tap | type | launch | open-url | apps | logs | crash-reports | record | ui-tree | delete; Android devices (preview): sandal devices android …. sandal devices apps upload <file|url> uploads an app once and prints its asset id for sandal devices install <device> --asset <id>. See Devices.
Runners: sandal runners labels lists the runner labels and works without signing in; sandal runners jobs list <pool> shows when each job started on its runner (STARTED) and when Sandal is starting a fresh runner for a job that lost its own. See Runners.
Windows VMs (preview) use sandal windows-vms and sandal rdp; see Windows VMs.
sandal capabilities is the source of truth for what your project can use today. Commands for features it reports as unavailable (for example sandal templates build) answer with exit code 7 on the beta.
Generated commands#
The CLI has two halves that behave the same way:
- Workflow commands you have seen above (
create,exec,cp,agents start,git deliver,ide open, …) are written by hand for the common jobs. - Generated commands cover every other operation of the API, one
sandal <resource> <operation>per OpenAPI operation, generated from the same API document as the SDKs (the generator's drift check is part of every release). Their help text comes from the API reference.
sandal resources # every generated command, grouped by resource
sandal resources git # one resource
sandal agents list --help # flags come from the operation's parameters and body
sandal sandboxes list-network-policies --source sandbox --all
sandal git grants create <sandbox> --repositories acme/web --permissions '{"contents":"read"}'Shared rules for every generated command:
| Rule | Detail |
|---|---|
| Flags | One flag per path, query and body field (--sandbox-id, --created-after, …). --data json|@file|- supplies the whole body; flags override its fields. |
| Pagination | --limit and --cursor, or --all to follow every page |
| Revisions | --expected-sandbox-revision defaults to the sandbox's current revision |
| Identity | --idempotency-key (default: random) on mutations, --request-id (default: a fresh UUID) |
| Output | A table on a terminal, JSON when piped or with --json; the same exit codes as every command |
Of the API's operations, most have a generated command, some are covered by a workflow command instead, and a handful (for example operator-only routes) are reachable only through sandal api.
sandal api#
An authenticated escape hatch to any route, with the profile's credentials and the same output and errors:
sandal api GET ~/agent-runs -q state=failed -q limit=5
sandal api GET ~/git/grants --paginate # follow nextCursor, merge the pages
sandal api POST ~/sandboxes/<sandbox>/agent-runs --data @run.json
sandal api GET /v1/projects/{projectId}/webhooks~/… expands to /v1/organizations/{organizationId}/projects/{projectId}/… for the active profile, and {organizationId} / {projectId} are filled in anywhere in the path. Mutations get an Idempotency-Key and every request an X-Request-Id (override either with -H). -o file writes the response body to a file. The Authorization header always comes from the profile; you cannot override it.
Secrets never go in arguments#
Anything secret (provider keys, GitHub App private keys, GitLab tokens, webhook secrets, passwords) is read only from:
| Form | Reads |
|---|---|
@path | A file (@~/… is expanded) |
- | Standard input (once per command) |
env:NAME | A variable of your shell |
A literal value is refused with a usage error that names the flag but never echoes the value, because argv ends up in shell history and in ps. A single trailing newline is stripped. For agent keys, --key NAME on its own reads $NAME:
sandal agents start <sandbox> --key ANTHROPIC_API_KEY ... # $ANTHROPIC_API_KEY
sandal git connections create --provider gitlab --namespace acme --token env:GITLAB_TOKEN
sandal git connections create --provider github --app-id 1 --installation-id 2 --private-key @app.pem
printf '%s' "$KEY" | sandal login --api-key-stdinSecret values are never printed back. Commands that create a secret you must keep (a webhook signing secret) can write it to a file with mode 0600 (--secret-file).
Command reference#
The CLI command reference (sandal --help, sandal <command> --help) lists every workflow command with its options, and every generated command with its HTTP operation. It is generated from the CLI itself; sandal <command> --help is authoritative for the version you have installed.
Scripting#
Every command accepts --json and prints JSON on stdout (commands that wait, like create and fork, print JSON Lines: one event per line, ending with ready); errors go to stderr (or a JSON error object with --json).
ID=$(sandal create --size s --json | jq -r 'select(.event=="ready") | .id')
sandal list --json | jq -r '.sandboxes[] | select(.state == "running") | .id'