Goal
Create a computer, use it every way it can be used, and delete it when finished.Prerequisites
- The StackShift CLI signed in with
stackshift auth login, or a user token or computers key for the REST API. - For the REST API, the project ID of the project the computer belongs to.
POST /computers/projectreturns it, making a project named Computers if you have none yet. The CLI and the dashboard do this for you.
Workflow
1
Create the computer:
stackshift computers create build-box --template coding --wait.2
Open a terminal on it:
stackshift computers sh build-box. The computer pauses when the shell ends.3
Run a command, copy a file in and publish a port:
stackshift computers exec build-box npm test, stackshift computers files put build-box ./app.tgz app.tgz, stackshift computers port publish build-box 3000.4
Delete it when you no longer need the disk:
stackshift computers delete build-box.Create
A create call answers at once with statecreating. The computer turns running when it is ready; add --wait in the CLI, or watch GET /computers/{id} or the event stream.
- Template:
agent-desktop,coding,androidorci-runner.GET /computers/templateslists their sizes, andsizemust be one of them. Leavesizeout to get the template’s first size. - From a snapshot: pass
from_snapshot_id. From code: pass asourcewith a repository URL, optional revision and a devcontainer.json or setup script inside it. From an image:stackshift computers import IMAGE --name NAMEsaves a Docker or OCI image as a snapshot to start from. - Setup:
setupruns a script of up to 64 KB once the computer is running, or applies a devcontainer.json. Follow it withGET /computers/{id}/setup, orstackshift computers create --wait-setup. - Region: pass
regionfromGET /computers/regions. - Internet, idle policy and access can be set at create time and changed later. Limits can pause or delete the computer for you:
max_run_seconds,archive_after_secondsanddelete_after_seconds, each 60 seconds to 30 days.
Create from the CLI or the API
Use it
- Terminal:
stackshift computers sh, or the Terminal tab on the computer’s page. It resumes a paused computer first. - SSH:
stackshift computers ssh NAMEsigns you in with a short-lived certificate through the StackShift SSH gateway atssh.stackshift.cloudport 2222. Extra arguments such as-Land-Dgo to your ssh client. Every computer carries its own line inssh_command, such asssh -p 2222 build-box-k3x9@ssh.stackshift.cloud, where the login is the computer’s name and a short suffix. - Shareable SSH line:
stackshift computers ssh-token NAME --ttl 2dprints a one-linesshcommand that works without the CLI or a key, until it expires (1 minute to 30 days, default 7 days).--revokestops every line for that computer. - Desktop: the live view on the Desktop tab, for templates with a desktop.
- Commands and files:
exec, andfiles ls,files get,files put. Everything is under/workspace.push,pullandcpcopy large files and folders in parallel, checked chunks. - History and jobs: every command is kept in the computer’s history (the latest 200), also while it is paused. A command started with
--backgroundshows underjobs, where you can read its output, wait for it or stop it. - Ports:
port publish NAME PORTgives it<port>-<name>-<suffix>.sandbox.stackshift.cloud. Choose public or private. - Coding agents:
stackshift computers agent prompt NAME "fix the failing test" -fruns Claude Code, Codex, Gemini CLI, OpenCode, Cursor, GitHub Copilot, Amp or Qwen Code inside the computer. Save the model key withstackshift computers secrets setand pass its binding with--secret; the key is added on the way out and never enters the computer.
Change and delete
Rename a computer, change its size, internet rules, idle policy, access and saved logins withPATCH /computers/{id} or the settings tab. A new size must still be one the template offers, and a disk can only grow. Delete removes the computer and its disk and cannot be undone; take a snapshot first if you may want it back. The API asks you to confirm by sending the computer’s id or name in the X-StackShift-Confirm-Delete header.
Expected result
The computer shows as running, answers commands, serves a published port over HTTPS and is gone, with its disk, after delete.
Common failures
Related guides
Pause, snapshot and fork
Pause a computer to stop paying for running time, snapshot it to keep a copy, and fork it up to 20 times to try many things from one starting point.
Computers REST API
Every computer action is an endpoint under /api/v1/computers, with idempotent mutations, a typed error format, live sessions and an event stream.
Computers CLI reference
Every
stackshift computers command: open a shell, create, list, run commands, move files, publish ports, fork, pause, snapshot and manage keys.