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

Goal

Call the Computers API from any language or tool: authenticate, create, command, connect and clean up.

Prerequisites

  • A user token or a computers key.
  • Your project ID.

Workflow

1
Send Authorization: Bearer <token> on every call. A computers key works on these routes only.
2
Create a computer with POST /computers and an Idempotency-Key header. It answers 202 with state creating.
3
Poll GET /computers/{id} or stream GET /computers/{id}/events until state is running.
4
Call exec, files, ports, actions or sessions. Delete with DELETE /computers/{id} when done.

Endpoints

The base URL is https://api.stackshift.cloud/api/v1. The full contract is the OpenAPI file for Computers.
  • Computers: GET|POST /computers, GET|PATCH|DELETE /computers/{id}, POST /computers/project (your latest project, or a new one named Computers), GET /computers/templates, GET /computers/regions.
  • Lifecycle: POST /computers/{id}/pause, resume, fork, restore, and PUT|DELETE /computers/{id}/activity-leases/{task} to keep one awake.
  • Snapshots: POST /computers/{id}/snapshots, GET /computers/snapshots, DELETE /computers/snapshots/{id}, and POST /computers/images/import to turn a Docker or OCI image into a snapshot.
  • Work: POST /computers/{id}/exec (add Accept: text/event-stream to stream), GET|PUT|DELETE /computers/{id}/files, GET /computers/{id}/files/list, POST /computers/{id}/files/mkdir, POST /computers/{id}/ports, DELETE /computers/{id}/ports/{port}.
  • Commands: GET /computers/{id}/history, GET /computers/{id}/jobs with logs, wait and kill, and POST /computers/{id}/commands/{command_id}/stdin. History and jobs work while the computer is paused and never wake it.
  • Setup and large files: GET|POST /computers/{id}/setup, and the fast upload and download routes under /computers/{id}/files that move big files in checked parallel parts.
  • Computer use: POST /computers/{id}/actions, GET /computers/{id}/screenshot, POST take-over, POST hand-back, GET steps, GET recordings, GET|POST approvals.
  • Coding agents: POST /computers/{id}/agent/prompt runs Claude Code, Codex, Gemini CLI, OpenCode, Cursor, GitHub Copilot, Amp or Qwen Code inside a computer, with files attached and up to 3 copies of the same task. Also GET /agent/providers, GET /agent/models?provider=&secret_binding_id= (models for an agent and key), GET /agent/turns (turn history, works while the computer is paused), GET /agent/conversations, GET /agent/conversations/{cid}/events, POST …/steer, POST …/interrupt, GET …/result, GET /agent/fanouts, GET /agent/fanouts/{id} and POST /agent/fanouts/{id}/keep.
  • Connections: POST /computers/{id}/sessions for live, view_link, cdp, terminal and ssh, GET /computers/{id}/events, and POST|DELETE /computers/{id}/ssh-tokens for a shareable SSH line.
  • Look inside: GET /computers/{id}/system, windows, processes, logs, metrics and limits.
  • Money and settings: GET /computers/usage, GET /computers/pricing, GET /computers/public-pricing (no sign-in needed), and GET|PUT /computers/settings.
  • CI: GET /computers/ci, GET /computers/ci/jobs and POST|DELETE /computers/ci/connections. These need a user token.
  • Teams: /computers/teams. See Computer Teams reference.
  • Keys: GET|POST /computers/keys, DELETE /computers/keys/{id}. These need a user token.

Create, command, delete

curl

Live connections

POST /computers/{id}/sessions returns a short-lived WebSocket url. live and view_link carry the screen as VNC bytes in binary frames, for noVNC and other VNC clients; view_link ignores keyboard, mouse and clipboard input and is meant to be shared. cdp speaks the Chrome DevTools Protocol. terminal carries terminal bytes and takes {"type":"resize","rows":R,"columns":C} text frames. ssh sessions are for the SSH gateway at ssh.stackshift.cloud port 2222. Opening a session on a paused computer wakes it, and the connection waits up to 90 seconds.

Errors and events

Every error is {"error": {"code", "message", "retryable"}}. Retry only when retryable is true.
  • 400 invalid_request. 401 unauthorized. 402 spend_cap_reached and insufficient_funds. 403 forbidden. 404 computer_not_found.
  • 409 computer_invalid_state, idempotency_conflict and approvals_disabled. 422 template_unavailable and size_unavailable. 423 input_locked. 428 confirmation_required. 429 limit_exceeded and capacity_busy.
  • 500 internal_error and 501 not_available. 503 capacity_unavailable and node_unavailable: try again shortly, or in another region.
  • capacity_busy means free computers are busy right now. It is retryable; try again in a few minutes, or upgrade to start now.
  • Events are server-sent events with id: set to the sequence number and event: set to the type. Resume after a drop with Last-Event-ID or after_seq. Types: state_changed, step, input_lock_changed, approval, forked, snapshot, idle, port_changed, agent.turn (a coding agent turn ended).

Expected result

You can create, drive and delete a computer using plain HTTP, and handle every error code the API returns.

Common failures

  • A mutation answers 400 invalid_request. Create, delete, fork, pause, resume, restore and snapshot need an Idempotency-Key header of at most 128 characters.
  • The same key returns an older answer. Repeating a key returns the first answer with replayed: true; use a new key for a new request.
  • A request answers 409 idempotency_conflict. The key was used before with a different body. Send the original body or use a new key.
  • A delete answers 428 confirmation_required. Send the computer’s or snapshot’s exact id or name in the X-StackShift-Confirm-Delete header.

Computers CLI reference

Every stackshift computers command: open a shell, create, list, run commands, move files, publish ports, fork, pause, snapshot and manage keys.

Computers MCP tools

One MCP address gives any MCP client 18 tools to create computers, see and use their screens, run commands, fork, pause and ask you first.

Computers keys and limits

A computers key lets an agent or tool drive computers and nothing else. Set how many it may run, how large, from which templates and how much it may spend.

Usage, prices and spending limit

What computers cost, what the free plan includes, how to read this month’s usage and how to stop spending at a limit you choose.

Use StackShift Computers from n8n

Create and drive computers from an n8n workflow with the HTTP Request node, or give an n8n AI agent the Computers tools through the MCP Client Tool node.