Skip to main content
Live. This area is documented as current, user-reliable behavior.

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/project returns 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 state creating. 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, android or ci-runner. GET /computers/templates lists their sizes, and size must be one of them. Leave size out to get the template’s first size.
  • From a snapshot: pass from_snapshot_id. From code: pass a source with a repository URL, optional revision and a devcontainer.json or setup script inside it. From an image: stackshift computers import IMAGE --name NAME saves a Docker or OCI image as a snapshot to start from.
  • Setup: setup runs a script of up to 64 KB once the computer is running, or applies a devcontainer.json. Follow it with GET /computers/{id}/setup, or stackshift computers create --wait-setup.
  • Region: pass region from GET /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_seconds and delete_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 NAME signs you in with a short-lived certificate through the StackShift SSH gateway at ssh.stackshift.cloud port 2222. Extra arguments such as -L and -D go to your ssh client. Every computer carries its own line in ssh_command, such as ssh -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 2d prints a one-line ssh command that works without the CLI or a key, until it expires (1 minute to 30 days, default 7 days). --revoke stops every line for that computer.
  • Desktop: the live view on the Desktop tab, for templates with a desktop.
  • Commands and files: exec, and files ls, files get, files put. Everything is under /workspace. push, pull and cp copy 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 --background shows under jobs, where you can read its output, wait for it or stop it.
  • Ports: port publish NAME PORT gives it <port>-<name>-<suffix>.sandbox.stackshift.cloud. Choose public or private.
  • Coding agents: stackshift computers agent prompt NAME "fix the failing test" -f runs Claude Code, Codex, Gemini CLI, OpenCode, Cursor, GitHub Copilot, Amp or Qwen Code inside the computer. Save the model key with stackshift computers secrets set and 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 with PATCH /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

  • The command is refused as not allowed in that folder. Commands and file calls must be under /workspace or /tmp.
  • A repeated create makes a second computer. Send the same Idempotency-Key on a retry so the first answer is returned; the CLI does this for you.
  • A delete answers 428 confirmation_required. Send the computer’s exact id or name in the X-StackShift-Confirm-Delete header; the CLI does this for you.
  • A published port answers 502. Nothing listens on that port yet, or it listens only on 127.0.0.1; bind to 0.0.0.0.

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.