Skip to content

Latest commit

 

History

History

cli

README.md

daytona — the Daytona CLI

Sandboxes, images, snapshots, and your organization, from the terminal. Built for people at a keyboard and for coding agents driving a shell: interactive at a terminal, strict and scriptable when piped.

Install

macOS / Linux (script — verifies the release checksum):

curl -fsSL https://raw.githubusercontent.com/daytona/clients/main/cli/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/daytona/clients/main/cli/install.ps1 | iex

The installer installs the highest stable 2.x release. Pre-releases are installed only when you ask for them, with a channel (--channel rc or --channel alpha) or an exact version; a channel also takes a stable release when it is the highest, so it installs a pre-release only while one is newer than the latest stable release:

curl -fsSL https://raw.githubusercontent.com/daytona/clients/main/cli/install.sh | sh -s -- --channel alpha
curl -fsSL https://raw.githubusercontent.com/daytona/clients/main/cli/install.sh | sh -s -- --version 2.0.0

On Windows set $env:DAYTONA_CHANNEL (stable, rc or alpha) or $env:DAYTONA_VERSION before running the installer. The rc channel installs the highest release candidate or stable release, alpha the highest alpha, release candidate or stable release. The install directory is --dir for install.sh and $env:DAYTONA_INSTALL_DIR for install.ps1 (DAYTONA_INSTALL_DIR works for both).

Homebrew (macOS / Linux):

Formula Installs
daytonaio/cli/daytona stable 2.x releases as daytona
daytonaio/cli/daytona-rc 2.x release candidates as daytona, once a 2.x release candidate has been published to it (until then it still installs a 0.x CLI)
daytonaio/cli/daytona-alpha 2.x alpha releases as daytona (the latest alpha can be older than the latest stable release)
daytonaio/cli/daytona@0 the 0.x CLI as daytona-v0, beside any of the above
brew install daytonaio/cli/daytona

The first three formulae install the same daytona binary, so install one of them.

Or download the binary from the releases and put it on your PATH: daytona-linux-<amd64|arm64>, daytona-darwin-<amd64|arm64>, or daytona-windows-<amd64|arm64>.exe; SHA256SUMS lists every asset.

Sign in

daytona login               # opens your browser
daytona login --device      # force the device flow (automatic off-TTY and inside SSH sessions)
daytona login --browser     # force the browser flow inside SSH (forward the printed port with ssh -L)
daytona login --token dtn_… # a project API key

The CLI connects to the Daytona API (https://api.daytona.com), the same default as the SDKs.

The 0.x CLI keeps its own configuration (config.json), which this CLI does not read: sign in again with daytona login, or keep using the 0.x CLI as daytona-v0 (Homebrew daytonaio/cli/daytona@0). Until this CLI has a saved profile, its "not logged in" error and whoami mention it when they find the 0.x file.

A browser or device login selects your personal organization and its default project the first time and remembers your last choice afterwards. Switch with daytona org use <name> and daytona project use <name>; override for one command with --org / --project.

Sandbox commands run on credentials derived from your session (see Credentials below). daytona logout removes the local session and attempts to revoke this profile's login-minted project keys.

login --profile NAME creates a named connection; profile use NAME selects one. Names use 1–64 ASCII letters, digits, ., _ or -, except . and ... Older saved names still load and can be refreshed with login. An active_profile in the configuration that names a missing profile stops the commands that use it (exit 5), like an unknown --profile. Deleting the active profile explicitly selects default when it exists and announces that on stderr; otherwise no profile is active, and the CLI asks you to select one or log in.

Use

daytona image create py312 --ref python:3.12
daytona sandbox create --image py312 --cpu 2 --memory 2048   # CPU in cores (1 core = 2 vCPUs)
daytona sandbox create                   # no --image: boots the platform default image, where the deployment has one
daytona sandbox create --persistent      # keep disk on stop/start, memory on pause/resume
daytona sandbox create --persistent --wake-on-request   # start/resume on toolbox, SSH or private-preview requests
daytona sandbox create --image py312 --lifecycle-timeout 2h --on-lifecycle-timeout delete
daytona image list --platform true       # the platform images every project can boot
daytona sandbox list
daytona sandbox search python --status running
daytona sandbox search --created-start-at 2026-10-01T00:00:00Z --created-end-at 2026-11-01T00:00:00Z
daytona sandbox exec <id> -- python -c 'print("hello")'
daytona sandbox exec <id> --shell -- 'cd /work && make 2>&1 | tail'   # one shell command line
daytona sandbox session create <id> --cwd /work   # a persistent shell: cd and exports carry over
daytona sandbox session run <id> <session-id> -- 'cd app && export MODE=dev'
daytona sandbox docker status <id> --wait
daytona sandbox ssh <id>
daytona sandbox cp ./data.csv <id>:/work/data.csv
daytona sandbox cp <id>:/var/log/app.log - | tail   # - is stdout (or stdin, for an upload)
daytona sandbox port expose <id> 8080 --public   # a preview URL anyone can open, with no credential
daytona sandbox port preview-url <id> 8080 --signed --ttl 10m
daytona volume create shared --type bucket
daytona sandbox create --image py312 --volume shared:/models:ro   # read-only: bucket volumes only; needs a region that can mount buckets
daytona snapshot create <id> --name saved-state
daytona sandbox create-from-snapshot saved-state --name resumed   # resume a memory snapshot
daytona image build my-app --context .  # honours .dockerignore
daytona image capture <id> --name py312-after-setup
daytona image create --ref python:3.12 --idle-expiry 24h   # anonymous: deleted after 24h unused
daytona sandbox exec <id> --tag build -- make   # then: daytona sandbox process kill-all <id> --tag build
                                                # (kill-all needs process containment: not on macOS or a Linux guest without it)
daytona image promote img_123 keep-this   # name an anonymous image (makes it permanent)
daytona org limits                     # sandbox limits and current usage
daytona billing usage                  # current open billing period
daytona billing invoices --unpaid
daytona billing plan list
daytona billing portal-session --open
daytona sandbox delete <id>

Persistent Linux sandboxes

sandbox create --persistent keeps disk across stop/start and memory plus running processes across pause/resume. Linux stop, start, pause, resume and fork require persistence; an ephemeral sandbox can only be deleted. sandbox restart stops a running persistent Linux or Windows sandbox, keeping its disk (not its running processes or memory), and starts it again. It waits up to --timeout (default 10m) until the sandbox is running after it was seen leaving running; --no-wait returns once the restart is accepted. failed, lost, deleting or deleted, and a return to stopped or paused once a start state was seen, exit with code 6; a start refused or failed before a start state was seen, which leaves the sandbox stopped, runs out --timeout. A macOS sandbox, or one that is not persistent or not running, is refused with 409 (exit code 6). A suspended organization, or a project at its monthly budget, is refused with 402 (exit code 1). When neither a per-create policy nor a project lifecycle default overrides it, persistent Linux sandboxes pause after 300 seconds instead of being deleted. Persistent Linux creation accepts volumes, but attached volumes prevent pause and fork (409). A fork inherits persistence; create-from-snapshot inherits it from the snapshot's source and has no --persistent override.

sandbox create --persistent --wake-on-request enables automatic start or resume when authenticated toolbox, SSH or private-preview traffic reaches a stopped or paused Linux sandbox. sandbox update <id> --wake-on-request=true|false changes it; false is accepted for every sandbox, while true requires persistent Linux. sandbox create-from-snapshot <snapshot> --wake-on-request inherits persistence from the source (the API checks it). macOS cannot enable it, including through a --file lifecycle policy. Sandbox detail output (sandbox get) includes lifecycle_policy.wake_on_request in text and in the API's JSON.

The triggering request waits up to about 60 seconds for the sandbox. If it is still waking, HTTP 503 SANDBOX_WAKING exits 1 with a hint to retry the same request; HTTP 409 SANDBOX_START_FAILED exits 6 with a hint to inspect the sandbox and start it again. The CLI does not automatically replay toolbox requests on SANDBOX_WAKING, including process submissions.

sandbox fork retries a sandbox still starting, stopping or pausing. sandbox fork --memory=false copies only the disk (the source is not paused). A fork of a running source comes up running either way; a disk-only fork of a paused source, like any fork of a stopped source, rests stopped. image capture retries a Linux or Windows sandbox still starting, or a macOS sandbox still stopping. snapshot create retries a sandbox still starting. These submissions retry for up to 30 seconds before the POST is accepted. This window limits new retries; an admitted request keeps its normal request timeout. Only SANDBOX_TRANSITION_IN_PROGRESS is retried, not other conflicts. The normal readiness wait starts after acceptance. image delete and snapshot delete retry the same code, for up to 30 seconds, when the API sends it because the only sandboxes still referencing the artifact are being deleted. An API that does not send that code for deletes yet answers a plain CONFLICT there, as it does while a live sandbox still uses the artifact; a plain CONFLICT fails at once.

daytona --help lists every command group; daytona docs --full prints the whole reference on one page. Use daytona docs --dir DIR for separate Markdown files instead; --full and --dir cannot be combined.

daytona region list prints the region catalog as a tree, each NAME indented under the region it is inside, with the columns NAME, ID, PRICE MULTIPLIER and AVAILABLE. PRICE MULTIPLIER is what a create naming the region is billed at, relative to earth. It is read for the selected organization after daytona login with read:billing; with an API key or without that permission the table shows - and JSON/YAML output carries "price_multiplier": null. The region a create that names no region goes to is marked (default); JSON/YAML output carries it as default_region_id next to items (null when it is not listed). --region keeps its name on create, search and catalog commands. On a sandbox create, omitting it falls back to the project's default, then the organization's, then earth; earth means anywhere and may land in any geography. A known unavailable region returns REGION_UNAVAILABLE (409). Image creates have no earth fallback: omitting --region uses the project's default region, then the organization's, then the platform's default region. They also require a narrower region than earth or a broad area and return 400 when the selected region is too broad.

daytona version always prints the CLI's own version. It also reads GET /config from the API the CLI is pointed at (the default API unless --api-url or DAYTONA_V2_API_URL says otherwise) and prints that API's version, build SHA, and build time, with a warning when the CLI and API versions are on different major versions or more than one minor version apart. A well-formed SemVer pre-release API version such as 2.0.0-alpha.6 warns only when it is on another major or more than one minor ahead of the CLI, since a pre-release can trail every stable release of its major. If the API cannot be reached within two seconds, the command still exits 0 and prints the CLI version plus a short diagnostic note.

daytona sandbox docker status <id> reads the sandbox's Docker Engine state (ready, starting, failed, not_present, disabled, unmanaged, deferred, unsupported), who owns it, the optional reason, and the process whose logs hold Docker's output. Add --wait to poll until Docker is ready; --timeout bounds that wait (default 60s).

daytona image build <name> --context DIR uploads the directory without what its ignore file excludes: <Dockerfile>.dockerignore next to the Dockerfile when it exists, otherwise .dockerignore at the context root. What is uploaded matches what docker build (BuildKit) uploads: the ignore file is read as Docker reads it (# comment lines, *, ?, **, character classes, ! exceptions), patterns are evaluated in order and the last one that matches decides, and a pattern that matched a directory applies to everything inside it. So !config after **/*.pem uploads config/ but not config/server.pem. An excluded directory is walked only when a ! pattern could re-include something inside it; an unreadable excluded directory is skipped. As with docker build, a pattern with a syntax error ([a-) fails the build up front, and one that cannot be compiled into a matcher (foo\q) fails it only when a path reaches it (exit 2, naming the ignore file). The Dockerfile and the ignore file are always uploaded, even when a pattern matches them. The 1 GiB context limit counts what is uploaded. Before any request, a directory context must contain the selected Dockerfile (Dockerfile by default, or --dockerfile inside the context). Plain tar contexts are checked for that entry too; compressed or unrecognized archives are checked by the server. A --context tar file is uploaded as is, and sandbox cp never filters. A large context is uploaded in parts; a part has no time limit while it keeps moving, and is retried, then fails (exit 8), once no bytes move for 60 seconds. image create --ref refuses empty or blank references locally.

daytona image logs <id-or-name> accepts an image name or id. Without --follow it reads at most 64 MiB of logs; --follow streams larger ones. Image build/import failures include the recorded build error and its code when available. A timeout on image create, build, capture or snapshot create includes the pending resource id and its get command; the operation keeps running on the server. image capture and snapshot create need write:sandboxes in addition to write:images / write:snapshots (exit code 4 without it). image list --platform accepts only true, false or any. image list --name and snapshot list --name send an explicit empty name (--name '') as name=, as the Python and TypeScript SDKs send it; snapshot list --sandbox <id> lists the snapshots of one sandbox. image create without a name, and image capture without --name, make an anonymous image, kept for --idle-expiry (a duration, or max) after its last use; omitted, it is kept for the longest the platform allows (7 days by default).

sandbox exec <id> -- COMMAND [ARGS...] copies stdout and stderr as raw bytes, including binary output. The words after -- are the program and its arguments, run directly with no shell. With --shell they are instead joined with single spaces into one shell command line, exactly as session run joins them (nothing is quoted or escaped), and the sandbox's shell (bash, else sh) runs that line, so pipes, redirects, globs and $VARIABLES work. The remote shell parses the joined line, so a word must be quoted for it as well as for your local shell: sandbox exec <id> --shell -- 'ls /work | wc -l', or --shell -- echo "'a b'" to keep two spaces. --login runs the line in a login shell, which reads the login profile first; it needs --shell (without it, --login is a usage error and --login=false changes nothing). --timeout only stops the CLI waiting; the process continues. --execution-timeout DURATION sets the remote execution deadline (greater than zero, rounded up to milliseconds). Interrupting the CLI with Ctrl-C or SIGTERM instead forwards INT to the process, escalating to KILL after one second, best effort. --tty requires terminal stdin and stdout, replays output from startup, defaults an unavailable or zero terminal size to 80×24, and forwards terminal resizes on Unix. A --tty session or process attach ends normally when the sandbox closes it normally and then reports the process's exit; when the sandbox closes it for another reason (an expired replay position, a client too slow to keep up), the CLI fails with that reason (exit 1).

sandbox session create <id> starts a shell session, one persistent shell whose commands run one at a time, in order; the working directory, exported variables and functions carry over between them. It prints the session's process record: its id is the session id the other sandbox session commands take (a --name given at create works in its place while the session runs). --cwd, --env, --shell (a POSIX shell on Linux and macOS), --login and --tag apply to the session and every command in it. session run <id> <session-id> -- COMMAND… runs one command in the shell like sandbox exec: the words after -- are joined with spaces into one shell command, its output is streamed as raw bytes, a piped stdin is its input, and the CLI exits with its exit code. The command runs inside the session's shell, so exit ends the session; return N ends only the command, with status N. --execution-timeout stops the command, its clock starting when the command starts (after any command queued ahead of it); the session survives unless the command is still running 5 seconds after the deadline (the shell could not interrupt it and it runs no process to kill), which ends the session; interrupting the CLI sends the command INT, escalating to KILL after one second, and the session survives. session start queues a command and prints its process record without waiting (follow it with sandbox process logs, wait or signal). session commands <id> <session-id> lists the session's commands (sandbox process list --session-id with the session's id; a name is resolved first), session list the sandbox's sessions, session get one session with the shell's current directory, and session delete ends the shell, including a command still running in it, and deletes the session with every command record and log; like every delete, it asks for confirmation at a terminal and otherwise needs --yes or DAYTONA_YES=1. get, commands and delete refuse a process that is not a session. Sessions do not survive a sandbox stop or start.

sandbox ssh [CLI FLAGS] <id> [SSH OPTIONS] [-- COMMAND [ARGS...]] applies CLI flags only before the sandbox id; arguments after it are forwarded to OpenSSH. Gateway host keys are kept per host and port under the CLI configuration directory, never in your personal known_hosts. New keys are accepted without a prompt; subsequent key changes are refused. This is trust on first use: an attacker intercepting the first connection could supply the trusted key. SSH options you forward after the sandbox id (for example -o StrictHostKeyChecking=no or -o UserKnownHostsFile=…) override this policy. The gateway login carries a short-lived sandbox access token limited to SSH, minted for each run; sandbox ssh does not fall back to a project API key, so if the API cannot mint the token, ssh is not started. The CLI replaces the token with <redacted> wherever ssh prints it on stderr (an authentication failure, -v output). Standard output is passed through byte for byte and is not redacted: -G, which prints the resolved configuration there, includes the short-lived token in its user line, so do not log that output.

macOS sandboxes

A macOS sandbox runs on a dedicated physical Mac your organization reserves. A reservation buys one physical Mac of a named model. Set sandbox sizes at create.

Find regions and their regional API endpoints with daytona region list (GET /regions). Use daytona mac-model list --region '<region>' to discover available Mac models and current prices. Replace <region> and <model> below with values from these catalogs.

daytona region list
daytona mac-model list
# Free Macs and prices per model in a region:
daytona mac-model list --region '<region>'
daytona reservation create --region '<region>' --model '<model>'
# Several Macs of one model in one request; --dry-run prints the price first:
daytona reservation create --region '<region>' --model '<model>' --count 3 --dry-run
daytona reservation create --region '<region>' --model '<model>' --count 3 --idempotency-key nightly-macs
# Use the model's default sandbox size:
daytona sandbox create-macos --region '<region>' --image base-macos
# Or set this sandbox's CPU, memory, and disk sizes:
daytona sandbox create-macos --region '<region>' --image base-macos --reservation RESERVATION_ID --cores 10 --memory 16384 --disk 163840 --persistent
# Pay for the next period; a retry with the same key never pays twice:
daytona reservation renew RESERVATION_ID --idempotency-key renew-RESERVATION_ID-2 --yes
daytona reservation update RESERVATION_ID --auto-renew=false

mac-model list shows each model's MAX_SANDBOXES and DEFAULT_SIZE. Each omitted --cores, --memory, or --disk uses the model's DEFAULT_SIZE; a create from a captured image without --disk gets the image's disk size, and a smaller --disk is refused. The disks and disk volumes of the sandboxes on one Mac at once must fit the model's sandbox disk space (SANDBOX_DISK_MIB in mac-model list), not the Mac's whole SSD. Sandbox sizes do not change the reservation. The size is fixed at creation, and daytona sandbox get shows the associated reservation as reservation_id. --disk is the whole sandbox disk in MiB, macOS included, at least 81920. Without --model, a reservation gets the region's default model; an unavailable model is never upgraded.

reservation create --count N reserves N Macs, all or nothing; add --min-count M to accept as few as M when fewer are free or fit under the organization's Mac reservation limit. reservation create and reservation renew send a fresh Idempotency-Key per invocation unless --idempotency-key is given; pass your own to retry safely.

Every sandbox create* sends an Idempotency-Key too, as the SDKs do: --idempotency-key (or the --file body's idempotency_key), else one derived from --name (the same key the SDKs derive, so creating the same name again within a regional API answers with the sandbox the first create made), else a fresh one per invocation. When a create fails without an answer (a network error, a 5xx, a timeout), the error's hint names the key to retry with. A named create also stamps the name as the label name, which the SDKs' find_by_name matches; a --label name=… that disagrees with --name is a usage error, and so is a blank --name (omit it for a generated name). sandbox create-macos checks its sizes (--cores at least 4, --memory at least 4096, --disk at least 81920), --auto-renew (only with --reservation new) and its volumes (at most 8, read-write, not with --persistent) before asking to buy anything.

sandbox create-macos with no --reservation, or with --reservation new, may buy a 24-hour Mac reservation billed to your organization, and so may sandbox start of a stopped macOS sandbox when the organization holds no live reservation in its region (auto-reserve buys one). These commands, reservation create, reservation renew, and reservation update --auto-renew=true ask for confirmation at a terminal; off a terminal, pass --yes or set DAYTONA_YES=1. Using an existing reservation ID, a sandbox start that a live reservation in the region serves, or reservation create --dry-run does not prompt. reservation update --auto-renew=false needs no confirmation.

For both Linux and macOS, stop and pause need a persistent sandbox (sandbox create --persistent or sandbox create-macos --persistent). A persistent macOS sandbox keeps its disk and machine across stop and start, and its memory across pause and resume. sandbox start can run it on any Mac of the organization; after a start on a different Mac, iCloud asks the user to sign in again. With no Mac reservation in the region and auto-reserve on, sandbox start buys one, and can be refused at the organization's Mac reservation limit (max_mac_reservations). Delete erases the disk. A reservation end or a Mac failure stops a persistent sandbox that has started and never deletes it; a Mac failure can lose its most recent writes. An ephemeral sandbox ends with its reservation, or with its Mac when that Mac fails. A paused sandbox keeps an auto-renewing reservation renewing; otherwise it is stopped, with its disk, before the reservation ends.

sandbox fork of a running macOS sandbox waits for running, past an intermediate stopped state. A fork of a paused or stopped source waits for stopped. --timeout bounds the wait; --no-wait returns once accepted.

Custom roles

role list prints the built-in role catalog; role list --custom prints the selected organization's roles, built-in then custom, with their kind. A custom role grants the project and organization permissions you give it:

daytona role create --name "Sandbox operator" --project-permission read:sandboxes,write:sandboxes
daytona role update "Sandbox operator" --project-permission read:sandboxes --dry-run   # who it affects, which keys it revokes
daytona member update user@example.com --role "Sandbox operator"
daytona invite create new@example.com --role developer --role "Sandbox operator"
daytona role delete "Sandbox operator" --yes

role get, update and delete and every --role flag (member update, invite create, service-account create / update) take a role's id (a built-in role's slug, a custom role's UUID) or its name; a name is matched case-insensitively when it is not exact, and an unknown or ambiguous name is a usage error (exit 2) before the change is sent. Ids are matched before names, so a custom role whose name is also a built-in role's slug (in any case) or a UUID, or whose name contains a comma, is passed by its id. A --role value that is not a UUID (a built-in slug included) needs one read of the organization's roles first, and is never sent unresolved. When the login may not read them (403), the built-in catalog is read instead: built-in slugs and names still resolve, and any other value is refused (exit 4) before the change is sent, so pass a custom role by its UUID. Any other failed read stops the command before the change is sent too. role get, create, update, delete and role list --custom need a daytona login session; role list also takes an API key.

Organization regions

org region manages the regions an organization runs on its own infrastructure, and their runners. It takes a login session or an organization API key (with --org).

daytona org region create --name factory-1 --parent us
daytona org region installation <region-id>      # chart, images and addresses an installation needs
daytona org region registration-token create <region-id> --name rack-1 --expires-in 24h --max-uses 10
daytona org region proxy-token create <region-id> --name edge --expires 720h
daytona org region proxy-token rotate <region-id> <token-id> --expires 720h --overlap 1h
daytona org region runner list <region-id>
daytona org region runner cordon <region-id> <runner-id>   # no new sandboxes; running ones stay

A registration or proxy token's secret is printed once, by the create or rotate that makes it (Token (shown once): … in a table, token in JSON and YAML); the API never returns it again and the list commands never print it. Deleting a region, a token or a runner asks first (--yes off a terminal, or pass --yes / DAYTONA_YES=1), and so does a proxy-token rotate with no or a zero --overlap (the default is 0s): the replaced token stops working at once, unless --overlap keeps it working while the proxy switches over. An organization API key works with --org; a project API key is refused (401).

Telemetry from code in a sandbox

A Linux sandbox exports its own OpenTelemetry signals with no setup: a span for each request into the sandbox (sandbox exec, sandbox cp and the other in-sandbox commands, for example), the output of its processes as log records, and CPU, memory and disk metrics. They are what your organization receives when it forwards sandbox telemetry to its own OpenTelemetry endpoint.

Code you run in the sandbox does not export by itself: a current sandbox sets no OTEL_EXPORTER_OTLP_* variable for it (older sandboxes can, see the last point below). DAYTONA_OTEL_ENDPOINT, which every process in the sandbox sees, is the sandbox's endpoint for OpenTelemetry data. To send a program's own traces, logs and metrics there, opt in for that program by pointing its OpenTelemetry SDK at it. sandbox exec runs the words after -- as an argument list, not a shell command, so run the assignments through a shell (single quotes keep your local shell from expanding the variable):

daytona sandbox exec <id> -- sh -c 'OTEL_EXPORTER_OTLP_ENDPOINT="$DAYTONA_OTEL_ENDPOINT" OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf python app.py'
  • The endpoint accepts OTLP over HTTP with uncompressed protobuf bodies only: no gRPC, no JSON, no gzip. Turn compression off if your exporter is configured to compress (OTEL_EXPORTER_OTLP_COMPRESSION=none).
  • What your program exports travels with the sandbox's own signals, so organization telemetry forwarding (set up for the organization in the Daytona dashboard's settings) delivers it too. The platform labels everything it receives with the sandbox and its organization, replacing the service name and any sandbox or organization identity your program sets.
  • When DAYTONA_OTEL_ENDPOINT is unset or empty, a current sandbox exports no telemetry and there is nothing to opt into. macOS sandboxes never set it and export no telemetry.
  • Sandboxes used to get OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_PROTOCOL set for every process, and a sandbox whose memory state predates that change can still set them: one booted before it, one resumed from a pause taken before it, or one created (sandbox create-from-snapshot) or forked from a memory snapshot captured before it. Check with env in the sandbox. A program you opt in sets both variables itself, as above, so it is unaffected; to keep another program from exporting, unset them for it (env -u OTEL_EXPORTER_OTLP_ENDPOINT -u OTEL_EXPORTER_OTLP_PROTOCOL …). Booting the sandbox fresh, by stopping and starting it or with sandbox restart, or capturing the snapshot again, should leave them unset; check with env afterwards.

The CLI itself sends no telemetry of its own.

Command reference

daytona docs --full prints every command, flag and default. The tree:

Group Commands
login, logout, whoami sign in (--device, --browser, --token), sign out, show the credential and the selected organization and project
profile list, use, delete (login --profile NAME creates one)
config get, set, path (the only setting is confirm)
sandbox create, create-from-snapshot, create-macos, list, search, get, wait, start, stop, pause, resume, restart, fork, delete, update, logs, usage, exec, ssh, cp, access-token
sandbox secrets get, set
sandbox network-policy get, set, reset
sandbox port list, in-use, endpoints, expose, unexpose, preview-url (and preview-url expire)
sandbox process list, get, wait, signal, kill, kill-all (needs process containment: not on macOS), logs, attach
sandbox docker status
sandbox session create, list, get, run, start, commands, delete
image create, build, capture, promote, list, get, delete, logs
snapshot create, list, get, delete
volume create, list, get, delete
reservation create, get, list, renew, update
region, cpu-type, mac-model list
org list, get, limits, use, create, update, delete, leave
org region list, get, create, update, delete, installation; registration-token list/create/delete; proxy-token list/create/rotate/delete; runner list/get/delete/cordon/uncordon
project list, get, use, create, update, delete; budget get, budget set, budget remove; member list, member add, member remove; service-account list, service-account add, service-account remove
project lifecycle get [PROJECT], set [PROJECT] (login session only)
member list, update, remove
invite create, list, revoke, get, accept, decline
role list (--custom), get, create, update (--dry-run), delete
key, org-key mint, list, revoke
service-account create, list, get, update, delete
secret set, list, get, delete
registry set, list, get, delete
billing wallet, balances, usage, usage-periods, payment-methods, charges, invoices, invoice pdf, invoice payment-session, top-up, portal-session, payment-method-session, automatic-top-up get/set/delete, balance-notification get/set/delete, coupon redeem, plan get/list/set, contact get/set, profile
audit list
upgrade run the migration tool that moves a project's SDK 0.x code to SDK 2.x (below)
version, docs, completion the CLI's and the API's versions, the reference, shell completion scripts

Flags every command takes: --api-url, --api-key, --profile, --org, --project, -o/--output, -y/--yes, -q/--quiet, --debug (upgrade refuses all but -y/--yes; see below). --file/-f, --no-wait, --timeout and --region exist only on the commands that use them; any other command rejects them as unknown flags (exit 2). --region is on sandbox create*, sandbox list, sandbox search, image list, image create, image build, reservation create, cpu-type list and mac-model list. A renamed flag's old spelling is refused with a hint that names the new one.

daytona upgrade [path] [options...] runs the SDK migration tool for the project at path (default: the current directory): npx @daytona/upgrade for TypeScript and JavaScript, uvx daytona-upgrade for Python. A release CLI runs the newest tool release of its major at or below its version (a CLI-only release publishes no tool of its own version); a pre-release CLI (X.Y.Z-alpha.N) runs the newest pre-release of X.Y.Z at or below its version, and when none is published the runner fails and the error names npx @daytona/upgrade / uvx daytona-upgrade for the latest release; a development build runs the latest release. The language comes from a package.json or Python manifest that requires the Daytona SDK, or from a source file or notebook that imports it (else from any Node or Python project file); node_modules, .git, virtual environments, caches and build output are not searched. A project with both runs the TypeScript tool and then the Python tool. When the SDK selected both, a refusal (exit 2) of the first stops there, and after a first run that succeeded (and so checked the Git tree) the second gets --force. After any other exit of the first (its runner may have failed before starting it), or when no SDK reference selected the tools, the second checks the Git tree itself and refuses changes the first left uncommitted; without an SDK reference the first's refusal does not stop it. Every argument is passed to the tool unchanged (--dry, --suggest-v2, --json, …; see upgrade/MIGRATION.md); -h / --help print the command's help, --yes also tells npx not to ask before installing the tool, and --dry also prints each command on stderr. It needs npx or uvx on PATH (exit 2 when missing), reads no CLI configuration or credential and sends no request to the Daytona API. The CLI's global flags are refused (exit 2, naming the flag, never its value), except -y / --yes, which is also the tool's option.

daytona completion bash|zsh|fish|powershell prints a completion script. Completion is local: it offers the values of flags and arguments with a fixed vocabulary (-o, sandbox wait --for, volume create --type, config set, signal names, …) and the saved profile names (--profile, profile use), sends no request, and does not complete resource ids or regions. Arguments that name a remote resource get no local file names; sandbox cp keeps local file completion for both of its arguments, since either one may be the local endpoint.

Scripts and agents

When stdout is not a terminal, or with --output json or yaml, the CLI never prompts:

  • The default output is a table at a terminal and JSON otherwise; --output always wins. Payload goes to stdout, diagnostics to stderr. Format names are case-sensitive: table, json, yaml, and yml (an alias for yaml). Other spellings are refused (exit 2).
  • Only these commands ask for confirmation: delete, remove, revoke, leave, billing setting deletes, billing plan set, billing automatic-top-up set, Mac purchases, reservation renew, reservation update --auto-renew=true and org region proxy-token rotate with no or a zero --overlap (the default, 0s: the old token stops at once). They prompt at a terminal; in non-interactive mode (no terminal, -o json|yaml, or CI set) they refuse unless --yes or DAYTONA_YES=1 is given, before anything reaches the server. The --dry-run previews (member remove --dry-run, reservation create --dry-run) and every other command run without --yes, including creates that buy no Mac reservation but start billable resources (sandbox create, sandbox create-from-snapshot, image create, …) and the other billing writes (billing balance-notification set, billing coupon redeem, billing contact set, billing top-up, …). CI makes the CLI non-interactive but does not change the output format: at a terminal the default is still a table (--output still wins), so scripts pass -o json explicitly. daytona config set confirm false turns the terminal prompts off; it never consents off a terminal.
  • Every list returns one page and prints the list envelope. --limit (1 to 200, default 100; the billing lists have their own: billing balances, charges and invoices 1 to 100, default 25; billing payment-methods 1 to 100, default 20; billing usage-periods 1 to 60, default 12), --cursor <token> and --all page through it. Where the deployment serves search, sandbox list, image list, snapshot list, secret list, and volume list read it. Secret and volume lists use their project-wide search routes; the other lists use one request spanning every region (for sandbox list, --region becomes its region filter; image list filters the results itself, keeping every image available in the region, not only those homed there), and the results are eventually consistent, so an item just created may be missing (get reads it at once). Where search is not served (501 SEARCH_NOT_CONFIGURED, or 404 from an older API) all five fall back to their list endpoints; secret list and volume list also fall back when an older API answers their search path with the secret or volume named search instead of a page: snapshot list reads GET /snapshots, and sandbox list and image list query each distinct API base URL in the region catalog once for fresh listings and regional cursors, unless --region narrows them. With --region R they ask every API that serves R or a region inside it and print only the items in R or a region inside it (region_id for sandboxes; region_id or region_ids for images); the list API has no region filter and regions can share an API, so a page can then hold fewer than --limit items while the cursor still advances over each API's page. Saved cursors resume unfinished pages. A --cursor token is opaque and belongs to the command and filters that printed it: pass it back to the same command with the same flags. A regional token (several regions' cursors in one) is not an SDK cursor, and the SDKs' cursors are not CLI tokens. Results merge regional cursors and de-duplicate resources by ID. The catalogs (region, cpu-type, mac-model, role, billing plan) and the in-sandbox lists (sandbox port list, sandbox process list, sandbox session list / commands) are returned whole and take no paging flags. An unknown --region on sandbox list or image list is a usage error (exit 2) before any list request. When some regions fail, the list prints the others' items with "incomplete": true and one errors entry per failed region, and exits 7; when every region fails, the command fails with the first region's exit code, code, source and trace_id (for example exit 3 for a refused credential), names every region's failure in the message, and prints no list.
  • Sandbox search time filters use half-open ranges: --created-start-at / --created-end-at, --updated-start-at / --updated-end-at, and --last-activity-start-at / --last-activity-end-at. Start bounds are inclusive; end bounds are exclusive. Values are RFC3339 timestamps.
  • sandbox search --status takes the API's statuses (running, stopped, paused, …), not the SDKs' sandbox states (started, destroyed, …), which the SDKs map to these statuses. Search is eventually consistent: for a few seconds a sandbox just created may not appear yet, and one just changed can still show its old status or labels. The platform currently leaves deleted sandboxes out of search results, so --status deleted returns none; deleting, failed and lost ones are returned until the platform removes their records. --image-ref and --image-ref-prefix match the project image the sandbox was created from (by its name; the snapshot name for a sandbox created from a snapshot), not the registry reference that image was pulled or built from. --spot selects spot sandboxes and --spot=false on-demand ones.
  • Sizes are MiB in the CLI (--memory, --disk, --memory-max, --disk-max, and sandbox search --min-memory / --max-disk …), while the SDKs take GiB (--memory 2048 is memory=2 / memory: 2). Volume sizes are GiB everywhere (volume create --size-gib). Linux sandboxes take --cpu (cores, 1 core = 2 vCPUs); macOS sandboxes take --cores (one Mac CPU each).
  • Sandbox search accepts --persistent to select persistent sandboxes and --persistent=false to select ephemeral sandboxes; omitting the flag leaves both kinds.
  • Sandbox search accepts repeatable --label KEY=VALUE, merged with --labels '{"key":"value"}'; conflicting values across the two flags, or an empty label key, are a usage error (exit 2). --region is checked against the region catalog: an unknown region is a usage error (exit 2), and a parent expands to itself and its children in the search API's region_ids filter.
  • Organization and project names (org create, org update --name, project create, project update --name) are 1 to 64 characters after trimming, with no control characters, and a project cannot be named default. Any other name is a usage error (exit 2): before any request on a create, after one read of the current name on a rename; a rename to the current name is sent and left to the API.
  • Billing amounts are integer cents plus a currency. One-time top-ups use --amount-cents; automatic top-up and low-balance settings use --threshold-cents (and automatic top-up also uses --target-cents).
  • secret set takes the value from --value, --from-file or --stdin (one trailing newline is stripped from a file or stdin). An empty value is refused: the stored value cannot be read back, so an unset variable or an empty file would otherwise erase it silently. --allowed-domain rejects empty entries, including in comma-separated lists. Omit it to preserve an existing scope (creating a secret requires it); use --allowed-domain '*' to remove domain restrictions (the value can then reach any verified HTTPS host). A secret cannot be created or given an empty scope; a secret stored with one before scopes were required keeps it (see below) until --allowed-domain sets one. Delete the secret to remove it entirely. --description '' clears the description. An existing secret is updated in place (PATCH): the value and only the options you pass are sent, and the API keeps every other field, so there is no read and two concurrent updates each change only what they send. An existing secret with no scope (stored before scopes were required) keeps it, and its value reaches no host: the command then prints a warning on stderr, even with --quiet (the exit code is unchanged), until --allowed-domain sets one. When the secret does not exist, it is created, conditionally: if another caller creates it first, the command fails with 412 SECRET_ALREADY_EXISTS (or 409 CONFLICT while that create is in progress) instead of overwriting it; run it again to update it.
  • sandbox secrets set and sandbox network-policy set|reset replace the whole set or policy of a running sandbox. They send If-Match: the --if-match you pass (the etag that get prints), and a change made since that read is refused (412) instead of overwritten. Without --if-match the command reads the current etag just before writing, so it replaces whatever is current. The change applies asynchronously: get shows status and the desired and applied revisions. sandbox secrets get and sandbox secrets set also show the environment variable each attached secret is injected under (bindings, as name:variable; the bindings field in JSON/YAML output).
  • sandbox access-token <id> mints a scoped, short-lived token for one sandbox (--operations, --ports, each comma-separated or none; --ttl) and prints it: treat the output as a secret.
  • Repeatable list flags accumulate: --role a --role b,c is a,b,c (also --permission, --allow-domain, …). --label and --env take one KEY=VALUE each and keep commas inside the value; repeat them for more. An empty key is a usage error (exit 2). sandbox create --env cannot set a name the platform reserves, among them every DAYTONA_* name other than DAYTONA_API_URL, DAYTONA_OTEL_ENDPOINT and DAYTONA_DOCKER_START (DAYTONA_SANDBOX_TOKEN included): the API refuses the create, naming the key.
  • Long operations wait for completion by default; --no-wait returns the accepted resource immediately. sandbox create*, start, stop, pause, resume, fork and delete print the sandbox as sandbox get does in both modes. With --no-wait the sandbox is read once right after the request. If a delete has already removed the sandbox, the API's {"id", "status"} is printed instead; if a create's read fails, {"id", "name", "status"} from the create's answer is printed with a warning on stderr. No lifecycle command prints a sandbox access token.
  • sandbox wait --for takes a settled status: running, stopped, paused or deleted, or the SDK state names started and destroyed; anything else is a usage error (exit 2) before any request. sandbox start on a running sandbox changes nothing, and on a paused one resumes it. --timeout bounds the CLI's own wait (default 10m; the server keeps working) and exits 8 when it passes. A --timeout with nothing to wait for is refused (exit 2): with --no-wait, on image logs / sandbox process logs without --follow, and on sandbox docker status without --wait.
  • Without --type, daytona volume create NAME lets the server choose the volume's type. Bucket volumes are created with daytona volume create NAME --type bucket; add --bucket, --endpoint, --bucket-region, --prefix, --path-style, --access-key-secret, and --secret-key-secret for a customer bucket. --size-gib sizes a disk volume and must be greater than zero.
  • audit list --start-at and --end-at require RFC3339 timestamps and reject invalid values locally, before any request.
  • sandbox create --volume accepts VOLUME:MOUNT_PATH, VOLUME:MOUNT_PATH:ro, or VOLUME:MOUNT_PATH:SUBPATH[:ro]. Read-only (:ro) is for bucket volumes: a disk volume refuses it, and a bucket mount needs a region that can mount buckets. A third segment ro (any case) always means read-only, so a subpath named ro is VOLUME:MOUNT_PATH:ro:ro read-only, and read-write only through the volumes array of --file; there is no :rw (a third segment rw is a subpath named rw, and a fourth segment other than ro is refused). sandbox create-macos --volume takes VOLUME:MOUNT_PATH[:SUBPATH]: a macOS sandbox mounts disk volumes read-write only. Use the volumes array in --file JSON for the same options; an explicit --volume replaces that array. MOUNT_PATH is an absolute path with no .. component; the API normalizes it (repeated slashes, . components and a trailing slash are removed) and refuses /, any path on or beneath /bin, /boot, /dev, /etc, /lib, /lib32, /lib64, /mnt/scratch, /overlay, /proc, /sbin, /sys or /usr, and one with a control character.
  • sandbox port preview-url and sandbox port expose refuse the sandbox daemon's ports 2280, 2281 and 22220, which are never preview ports, as a usage error (exit 2) before any request; unexpose still takes them.
  • sandbox port preview-url also prints expires_at when the token is a JWT whose exp claim is a positive number up to the year 9999 (read from the token, advisory, in whole milliseconds); it is omitted for an opaque token or any other exp, and an expires_at the API itself returns is printed as sent. --signed prints the expires_at the API returns.
  • sandbox port preview-url expire <id> expires every signed preview URL of the sandbox, on every port; signed preview URLs created afterwards work.
  • Ports are private by default: a private preview URL needs the token from preview-url in the X-Daytona-Preview-Token header. For a browser, preview-url --signed gives a short-lived, revocable link with the token in its hostname, and sandbox port expose <id> <port> --public makes the port reachable by anyone with no credential; expose without --public makes it private again. sandbox port endpoints <id> lists the exposed ports with their URLs and visibility (sandbox port list lists the ports listening inside the sandbox).
  • sandbox create --allow-domain api.example.com --allow-cidr 10.1.0.0/16 (or sandbox create-macos with the same flags) sets a network_policy: a domain list implies default-deny (allowed domains are reachable on HTTP/HTTPS only) and --allow-cidr opens addresses on any port. --block-all with --allow-cidr selects the CIDR-only mode, which is not a DNS exfiltration boundary: DNS A lookups for any name are still sent to DNS resolvers and only answers inside the allowed CIDRs come back, so a sandbox can carry data out in the names it looks up. When lookups must be contained, put the names that must resolve in --allow-domain, or set "allow_domains": [] in a --file body to resolve no tenant name (a domain list, even an empty one, also denies TCP 80/443 to the allowed CIDRs unless the name is listed). --block-all without an allow list blocks all outbound traffic and DNS lookups to user-specified domains. --allow-cidr without --block-all or --allow-domain is a usage error, because the resulting policy would be open.
  • sandbox create --outbound-proxy URL [--outbound-proxy-credentials-secret NAME] (and sandbox network-policy set with the same flags) sends the sandbox's web egress through an HTTP or HTTPS forward proxy, alone or beside the allow lists. The secret holds the proxy's username:password, is sent to the proxy and never enters the sandbox, and needs an https:// proxy URL. The secret's allowed_domains must include the proxy host (["*"] for an IP address host). network-policy get shows the proxy in the policy's outbound_proxy, with the URL normalized. set replaces the whole policy: without --outbound-proxy it leaves the sandbox unproxied, and --outbound-proxy needs --allow-domain, --allow-cidr or --block-all beside it (--block-all=false for open egress through the proxy), so that a proxy change does not silently drop the current rules. Linux only: create-macos has no such flag, and the API refuses a proxy for a macOS sandbox. The flag replaces any outbound_proxy in a --file body.

Durations

Every duration flag takes a Go duration such as 90s, 30m or 1h30m, in whole seconds where the API stores seconds:

Flag Commands Meaning
--timeout commands that wait (sandbox create*, start, stop, pause, resume, restart, fork, delete, wait, exec, session run, process wait, process logs --follow, docker status --wait, snapshot create, image create, build, capture, logs --follow) how long the CLI waits; never sent to the server
--execution-timeout sandbox exec, sandbox session run, sandbox session start server-side execution deadline, greater than zero and rounded up to milliseconds; omitted means no execution deadline
--lifecycle-timeout / --on-lifecycle-timeout ACTION sandbox create*, sandbox update the sandbox's wall-clock lifetime and the action when it ends (the earliest time the action runs, not an exact time: the platform acts shortly after the deadline passes; the same holds for --idle-timeout)
--idle-timeout / --on-idle-timeout ACTION sandbox create*, sandbox update idle time before the action, at least 1m (the API's minimum); sandbox update --idle-timeout off clears it
--server-wait sandbox create* how long the server holds the create response (0s answers at once; server default 3s); the CLI still waits for running unless --no-wait, which neither --server-wait nor a --file wait_seconds combines with
--create-ttl sandbox create* how long the sandbox may take to reach running before the server deletes it; max asks for the server's maximum (server default 1h)
--ttl sandbox port preview-url --signed lifetime of a signed preview URL (default 60s)
--escalate-after sandbox process signal when to send --escalate-to
--expires key mint, org-key mint key lifetime in whole seconds, or an RFC3339 timestamp

Lifecycle actions follow the sandbox: delete on any sandbox, stop on a persistent non-GPU sandbox, and pause on a persistent Linux sandbox. A known unsupported action is a usage error before any write; sandbox create-from-snapshot checks action names locally but leaves its inherited persistence for the server to check. A lifecycle or idle timeout is when the action becomes due, not an exact time: the platform runs it on its next check, so it can fire somewhat later than the configured duration. While a sandbox is stopped, commands that work inside it (sandbox exec, sandbox cp, sandbox process …, sandbox session …) and its preview URLs answer 409 SANDBOX_NOT_RUNNING (exit code 6, with a hint to start it), not 404, unless wake-on-request starts it (authenticated requests and private preview URLs only; a public preview URL never wakes a sandbox).

Project lifecycle defaults

These commands need a daytona login session, not an API key. PROJECT is an optional project ID or name; omitted, the selected --project / profile project is used. get shows configured defaults plus effective policies for Linux and macOS, including timeout source, capping and wake-on-request. JSON/YAML retains the API's policy and effective blocks and future fields. macOS uses platform defaults, not the project's defaults.

daytona project lifecycle get
daytona project lifecycle get lab -o json
daytona project lifecycle set --ephemeral-timeout 1h --ephemeral-idle-timeout 10m
daytona project lifecycle set lab --persistent-timeout 2h --persistent-on-timeout pause --persistent-idle-timeout 5m --persistent-on-idle-timeout stop --persistent-wake-on-request=true
daytona project lifecycle set --persistent-wake-on-request=false
daytona project lifecycle set --clear-ephemeral --clear-persistent

set replaces whole blocks, not individual fields. Only blocks named by flags are sent; an omitted block is kept. Within a replaced block, omitted fields are unset: the timeout inherits its platform limit, the idle timeout is disabled, and wake-on-request defaults to false. Include every field you want to keep. In particular, setting only --persistent-wake-on-request=false also unsets that block's timeouts and actions. Defaults affect new sandboxes only.

project lifecycle set flag Example Meaning
--ephemeral-timeout DURATION --ephemeral-timeout 1h maximum ephemeral lifetime
--ephemeral-idle-timeout DURATION --ephemeral-idle-timeout 10m ephemeral idle timeout
--persistent-timeout DURATION --persistent-timeout 2h maximum persistent lifetime
--persistent-on-timeout ACTION --persistent-on-timeout pause maximum-lifetime action
--persistent-idle-timeout DURATION --persistent-idle-timeout 5m persistent idle timeout
--persistent-on-idle-timeout ACTION --persistent-on-idle-timeout stop idle-timeout action
--persistent-wake-on-request[=true|false] --persistent-wake-on-request wake new persistent Linux sandboxes on authenticated toolbox, SSH and private-preview requests
--clear-ephemeral --clear-ephemeral send null to clear the ephemeral block
--clear-persistent --clear-persistent send null to clear the persistent block

Durations must be positive whole-second Go durations, at most 2,147,483,647 seconds; idle timeouts must be at least 1m. Actions are delete, stop, or pause; the API decides class-specific support. A clear flag cannot combine with fields for that same block (even a false wake flag). A set without any changes is a usage error.

JSON output

  • A command that shows an API resource prints the JSON the API returned, and a list prints each item as the API returned it: the API's field names (snake_case), its nulls, and fields a newer API adds, without a CLI release. A field the API leaves out is absent; the CLI never fills one in.
  • Output that comes from inside the sandbox (sandbox process list, get, wait, logs, sandbox session except run and delete, sandbox docker status) is the toolbox API's JSON with every key converted to snake_case (exit_code, next_cursor, process_id, truncated_head) and signal names without SIG.
  • A list prints {"items": [...], "incomplete": false} plus next_cursor when another page exists and errors ([{"region", "status", "code", "source", "trace_id", "message"}], absent fields omitted) when a region failed; items is always an array. sandbox search asks one API and prints {"items": [...], "total": N, "total_relation": "eq" | "gte"} plus next_cursor when another page exists (no incomplete). region list adds default_region_id, and cpu-type list adds the catalog's regions (each region's default_arch and default_type) and arches, as the API sent them. cpu-type list and mac-model list print the same envelope with or without --region (with --region, mac-model list items are the region's catalog entries: model, available, price).
  • --follow with -o json streams NDJSON, one object per line: {"data": "..."} chunks for sandbox logs and image logs, one toolbox log frame (channel, cursor, data, timestamp in Unix milliseconds) for sandbox process logs. YAML is refused with --follow (exit 2). With sandbox process logs --encoding base64, JSON/YAML frame data is kept as the server sent it: standard base64 or base64url, with or without padding. Decoders must accept both alphabets and padding forms. Table output decodes frames; stdin sent by the CLI uses the contract's base64url alphabet.
  • The CLI's own shapes, for output no single API response holds: {"logs": "<text>"} (sandbox logs and image logs without --follow); whoami (profile, api_url, credential_source, context_resolved, and org_id, project_id, org_ref, project_ref, user, org, api_key when known); version (version, go, os, arch, and api_url, api_version, api_build_sha, api_built_at, skew_warning when known); device-login events (verification_uri, verification_uri_complete, user_code, expires_in, only when known), one JSON object on stdout before waiting for approval with JSON/YAML output or non-terminal stdout (even with -o table); profile list rows (credential omitted when empty); config get / config path; reservation create --dry-run; role list --custom, which adds max_custom_roles to the list envelope; region list items, which are the API's region objects with price_multiplier added; and acknowledgements (below). They omit what they do not know rather than print empty values.
  • A command with no resource to print acknowledges with the identifier under the field that names it plus a boolean named after the action, e.g. {"ref": "img1", "deleted": true}:
    • ref: image, snapshot, volume delete (deleted): they take an id or a name, send it as given in one request, and repeat it (volume delete prints the API's operation when it returns one);
    • id: org, project delete, role delete, org region delete, org region registration-token / proxy-token / runner delete (deleted), key / org-key / invite revoke (revoked), service-account delete (archived), project service-account remove (removed), org leave (left), sandbox session delete (deleted, the session's stable id);
    • user_id: member remove, project member remove (removed);
    • name: secret delete (deleted);
    • host: registry delete (deleted);
    • project_id: project budget remove (removed);
    • org_id: billing automatic-top-up delete, billing balance-notification delete (deleted). invite decline prints {"declined": true} (the token is not echoed), sandbox port preview-url expire {"sandbox_id", "revoked": true}, sandbox port unexpose {"sandbox_id", "port", "unexposed": true}, and sandbox process signal / kill {"id", "signal"}. sandbox cp prints {"source", "destination", "bytes"} for a file and {"source", "destination", "recursive": true} for -r, where destination is where the file or directory landed: the local path for a download, <sandbox-id>:<remote path> for an upload; a download to - prints only the file. With table output (-o table, or the default at a terminal) cp prints no acknowledgement; a download to - still writes the file to stdout. With table output org delete, project delete and project budget remove print a sentence on stderr instead.
  • Raw streams are never JSON: the output of sandbox exec, ssh, process attach and cp … -, --follow in table mode, billing invoice pdf, docs, completion, help and --version. sandbox session run is a raw stream too, like sandbox exec.
  • The local configuration commands (login, logout, org use, project use, profile use, profile delete, config set) print nothing on stdout, except the device-login event described above. A successful login prints no additional result on stdout.
  • secret set and registry set print the secret or registry credential the API stored, like secret get / registry get. registry set reads the stored registry first so omitted metadata keeps its values: it needs read as well as write access (secret set updates in place and needs no read). On registry set, an omitted username keeps the existing username; a new registry requires --username. Every set of a basic, ghcr, gcr or ecr registry needs --password-stdin or --password, even a description-only update, because the API cannot preserve an omitted write-only password; an ecr_role registry takes no password. --kind must be basic, ghcr, gcr, ecr or ecr_role; omission on update keeps the stored kind.
  • The one exception to printing the API's JSON as it came: secret get, set and list drop a top-level value field, and registry get, set and list a top-level password field, matched in any case, in every output format. These are the fields that carry the credential in secret set and registry set, so the CLI does not print them back even when a response returns them.
  • With JSON or YAML output (including the default off a terminal) an error is one JSON line on stderr: {"error": {"exit_code": 4, "code": "FORBIDDEN", "message": "…", "source": "DAYTONA_API", "trace_id": "…", "hint": "…"}}. code, source and trace_id come from the server when it sent them and are omitted otherwise, so a server error is never attributed to the CLI; a local error has source CLI, and a passed-through exit status PROCESS, SSH or UPGRADE. A partial list (exit 7) has no code or source of its own: each failed region's status, code, source and trace_id are in the list's errors, and the message names each region with its status and code. Both code and source are open vocabularies. With table output errors are an error: line and an optional hint: line.

Exit codes

Code Meaning
0 success
1 failure: a network error, HTTP 5xx (except 501 and 504), HTTP 429 other than LIMIT_EXCEEDED, anything not listed below
2 usage: wrong number of arguments, an empty or blank id, name or other named argument (not the sandbox search query or config set's value), unknown command, flag or help topic, an invalid flag value or --file body, a credential with a control or non-ASCII character, an invalid API URL, a missing local file, a saved credential used with another API URL, a --project other than a project API key's own, a missing --yes or selection off a terminal; HTTP 400 and 422
3 authentication: no credential, a static credential on a command that needs a daytona login session, or HTTP 401
4 permission denied: HTTP 403
5 not found: HTTP 404, or a --profile / DAYTONA_PROFILE, or the configuration's active_profile, that names a profile that does not exist (on the commands that use the selected profile)
6 conflict: HTTP 409, 412 and 501, and HTTP 429 LIMIT_EXCEEDED (an organization limit)
7 partial result: sandbox list / image list reached only some regions; the others' items are printed with each failure in errors (when no region answers, the first region's failure decides the code)
8 timed out: --timeout passed, a request timed out, or HTTP 408 / 504
130 interrupted (Ctrl-C), or a confirmation prompt answered no
143 terminated (SIGTERM)

Commands that run something in the sandbox, or another local program, pass its status through, as a shell does, so any number, including those above, can also come from the remote side or that program. With JSON or YAML output such an exit still prints the error object on stderr, whose source (PROCESS, SSH or UPGRADE) tells a passed-through status apart from the CLI's own:

Command Exit status
sandbox exec, session run, process wait, process logs --follow, process attach the process's exit code; for sandbox exec, a command that cannot be started → 127; a process ended by a signal → 128 + its number for HUP, INT, QUIT, ILL, TRAP, ABRT, FPE, KILL, SEGV, PIPE, ALRM, TERM, XCPU, XFSZ, VTALRM, PROF and WINCH, whose numbers are the same on Linux and macOS (SIGINT → 130, SIGKILL → 137, SIGTERM → 143); any other signal → 1; its own timeout → 8; lost / failed → its code, else 1
sandbox ssh the ssh client's exit status
upgrade the migration tool's exit status (0 done, 1 failed or --strict items left, 2 refused); for a project with both languages, the higher of the two
sandbox cp the remote tar's exit status when the in-sandbox side of the copy fails

Request bodies (--file)

--file PATH (or --file - for stdin) takes one JSON object (an array or another JSON value is refused, exit 2); explicit flags override its fields. A field of the wrong JSON type is refused (exit 2), naming the field, and the key or index of the first entry of the wrong JSON type when the field holds a map or an array of plain values. A number an integer field cannot hold says why: it is not whole (1.5), out of the field's range (1e30), or a whole number written with a fraction or an exponent (2.0, 1e3), which the CLI does not convert. Keys name the API's request fields exactly, at any depth, as the API does: an unknown key, including one that differs from a field only in case (Name, CORES_MAX), is refused (exit 2). Keys of map values such as env and labels are names of your own and are sent as given. A field whose value is one of several shapes (image create's source) is checked by its type: an unknown type, or a key the chosen shape does not have, is refused too. The bodies use the API's request fields:

Command Body
sandbox create image, name, cpu, memory_mib, disk_mib, cores_max, memory_max_mib, disk_max_mib, cpu_arch, cpu_type, user, env, labels, ports, volumes, secrets, persistent, spot, network_policy, lifecycle_policy, region_id, wait_seconds, create_timeout_seconds, idempotency_key
sandbox create-from-snapshot snapshot (the positional argument wins), name, labels, ports, lifecycle_policy, region_id, wait_seconds, create_timeout_seconds, idempotency_key
sandbox create-macos image, name, cores, memory_mib, disk_mib, persistent, reservation, auto_renew, env, labels, ports, volumes, secrets, network_policy, lifecycle_policy, region_id, wait_seconds, create_timeout_seconds, idempotency_key
sandbox update {"labels": {...}, "lifecycle_policy": {...}} only: labels replaces the label set except the label name, which is kept unless the new set names it (then it must equal the sandbox name; --clear-labels keeps it too), lifecycle_policy takes timeout_seconds, on_timeout, idle_expiry_seconds (-1 clears), on_idle_timeout, wake_on_request (boolean). The CLI sends them as two requests (labels first)
snapshot create name
image create name (the positional argument wins), source ({"type": "registry", "ref": "..."} or {"type": "named", "name": "..."}), region_id, cpu_arch, idle_expiry_seconds; a dockerfile field is refused (use image build)
image build the CLI's own descriptor, all strings: name (the positional argument wins), context (a local directory or tar file), dockerfile (a path inside the context), region_id, cpu_arch; --dockerfile and --context win even when given empty (then refused)
volume create name (the positional argument wins), type, size_gib, bucket (name, origin, endpoint, region, prefix, path_style, credentials)
reservation create region_id, model, auto_renew; with --count the bulk request, which adds count and min_count. --count selects the bulk request; a count field alone is rejected

lifecycle_policy durations and wait_seconds / create_timeout_seconds are integer seconds, as the API stores them.

Credentials

The CLI sends whatever credential you give it and lets the server decide what it may do, with one exception: the commands whose API routes admit only a login session — billing, invite, key, member, org-key, project, service-account, org except org limits and org region, and role except role list (role list --custom included) — refuse a static credential (--api-key, DAYTONA_API_KEY, login --token) before choosing an organization or sending a request (exit 3; a credential saved for another API URL is refused first, exit 2, as below), because the server would answer every API key there, valid or not, with the same 401. A bearer shaped like a JWT (a login's access token) is still sent; a 401 on these commands says they need a daytona login session. Precedence: --api-key > DAYTONA_API_KEY > the active profile. An explicit credential is the only one used for that command — the CLI never falls back to your saved login, and an empty --api-key is a usage error. A static credential (--api-key, DAYTONA_API_KEY, login --token) is sent as-is on every API request: the CLI never mints, caches or substitutes another API key for it. It never reaches a sandbox's toolbox either: see "Toolbox requests" below. A project API key always acts in its own project, so a --project / DAYTONA_PROJECT that names another project is refused (exit 2) on every command that acts in a project (sandbox, image, snapshot, volume, secret, registry, reservation, region and catalog commands) and on whoami, instead of being ignored; the CLI reads the key's project once per command (GET /api-keys/current) when a project is named.

A credential must be printable ASCII: one that contains a control character (such as a line break or tab) or a non-ASCII character is refused before any request (exit 2); the error names where it came from (the flag, the variable, the saved profile, or the login's access token), never the value. A malformed credential the server or the identity provider issues (a login access token, a minted project key, a platform token) is refused (exit 1) before the CLI saves it. With no credential at all, a command that needs an organization or project reports "not logged in" (exit 3) before asking for either.

A saved credential (a login or login --token) belongs to the API URL it was saved with. With --api-url or DAYTONA_V2_API_URL naming another API, the CLI refuses to send it there, or to refresh or exchange it there (exit 2): pass --api-key / DAYTONA_API_KEY for that API, or sign in to it with daytona login --api-url URL --profile NAME.

After a browser or device daytona login, sandbox, image, secret, and registry commands use automatically refreshed, project-scoped credentials. Platform tokens expire after five minutes; automatically minted project API keys expire after 24 hours. The CLI uses project API keys to pre-sign sandbox cp transfers, and as a fallback when platform tokens are unavailable. Automatically minted keys stay on Daytona V2. A replacement attempts to revoke its superseded key.

Browser/device relogin clears cached login keys and platform tokens before publishing the new session, then attempts to revoke the old login's keys with its old credential at its saved API, within a three-second total budget. This also applies when switching accounts or API URLs.

daytona logout removes this profile's saved tokens and key cache first, then attempts to revoke its cached login-minted project keys at the profile's saved API. Revocation has a three-second total budget, including any token refresh; local logout completes even when the server is unreachable. Keys that could not be revoked can remain valid until their expiry. Logout ignores API URL and --api-key overrides and does not end the identity provider's session or revoke manually supplied credentials, other profiles' keys, or keys from other APIs. Keys no longer tracked after replacement with login --token are not revoked by logout. daytona profile delete performs the same revocation for the deleted profile.

Cached platform tokens and minted keys are sent only to the API that issued them, and to the build-log endpoints that API names for an image, which can be on other (regional) hosts.

daytona whoami reports org_id and project_id only when they are resolved IDs; a selection given by name appears in org_ref / project_ref, and context_resolved is false when a name could not be resolved. With a static credential it asks the API about the key: a refused key fails with exit 3, and a project API key reports its own organization and project, with the API's description of the key (no secret) in api_key.

Toolbox requests

The commands that talk to a sandbox's toolbox (sandbox exec, sandbox process, sandbox port list, sandbox docker status, and sandbox cp when it checks the remote path or copies a directory with -r) never send your API credential there, whether it is a login or a static key. Before the first toolbox request, the CLI uses that credential to mint a sandbox access token (POST /sandboxes/{id}/access-token) for that one sandbox, with a five-minute lifetime, no preview ports and only the operations the command needs:

Command Operations
sandbox exec, sandbox process ... toolbox:exec
sandbox cp (remote path check) toolbox:fs
sandbox cp -r toolbox:exec
sandbox port list none (port listing comes with any sandbox access token)
sandbox docker status toolbox

A command that keeps sending toolbox requests for longer than that (process wait, the stdin and resize requests of exec, the resize requests of process attach) mints a new token a minute before the current one's expires_at. An output stream or an attach connection is authorized once, when it opens, and keeps running after that token expires. When the toolbox refuses a token, the CLI mints a new one and sends the request (or opens the connection) once more. If the API refuses the mint, the command fails with the API's error; the CLI does not fall back to the API credential. Your credential therefore needs permission to mint sandbox access tokens (write:sandboxes) for these commands. The file contents of sandbox cp move over pre-signed URLs (POST /sandboxes/{id}/files/sign), which carry no token, and a copy that makes no other toolbox request mints no token.

Environment

Variable Meaning
DAYTONA_API_KEY credential, below --api-key; blank counts as unset
DAYTONA_PROFILE profile, below --profile; it must exist (profile, config, version, help, docs and completion still run when it does not)
DAYTONA_ORG, DAYTONA_PROJECT organization and project for this call (ID or name), below --org / --project
DAYTONA_YES 1 or true confirms the commands that ask for confirmation (listed under Scripts and agents), like --yes
DAYTONA_V2_API_URL another API, for test environments only; below --api-url, above the profile's saved URL
DAYTONA_CONFIG_DIR configuration directory (default $XDG_CONFIG_HOME/daytona, else ~/.config/daytona)
DAYTONA_OIDC_CLIENT_ID the OIDC client a browser or device login uses
CI any value makes the CLI non-interactive
NO_COLOR, TERM=dumb no colour
SSH_CONNECTION, SSH_TTY, SSH_CLIENT any of them makes login use the device flow instead of the browser (--browser overrides)
HTTPS_PROXY, HTTP_PROXY, NO_PROXY the HTTP proxy for API requests (Go's standard handling)

The CLI does not read DAYTONA_API_URL (a value set for the 0.x CLI does not redirect it) or DAYTONA_REGION (pass --region). A login saves the API URL it used in its profile, and the CLI keeps using that URL when neither --api-url nor DAYTONA_V2_API_URL is set, and its saved credential is never sent to another URL (see Credentials). To use the default Daytona API, log in again without a test URL, or use another profile.

Configuration lives in ~/.config/daytona/ ($XDG_CONFIG_HOME/daytona), in files readable only by you.

Develop

go build ./... && go test ./...
golangci-lint run ./...
./hack/gen.sh      # regenerate wire types from ../contract/*.json
./hack/build.sh    # six release binaries + SHA256SUMS into dist/

Wire types are generated from the public contract/ OpenAPI artifacts and must not be edited by hand.