Skip to content
LogoLogo

Computer

Capture screens and control desktop applications inside a running sandbox. Use a desktop-capable rootfs from GET /v1/rootfs, such as desktop:1 when available. A running sandbox on a minimal image does not provide a desktop.

Base URL: https://api.sb.createos.sh. Authenticate with X-Api-Key; you must own the sandbox. All paths below start with /v1/sandboxes/{id}/computer. JSON responses use JSend, except screenshots, which return PNG bytes.

Capture and desktop state

MethodPathRequest / result
GET/screenshotPNG screenshot. Optional query: screen_id, window_id, or a rectangle (x, y, width, height).
GET/screenScreen dimensions: { width, height }.
GET/cursorCursor position: { x, y }.
GET/clipboardClipboard contents: { text }.
PUT/clipboardBody: { "text": "hello" }.
POST/openBody: { "target": "https://example.com" }.
POST/launchBody: { "application": "...", "uri": "..." }; uri is optional. Application must be installed.

For desktop operations, omit screen_id to use the primary screen. Use screen_id=screen-1, for example, to target an existing additional screen.

curl --fail "https://api.sb.createos.sh/v1/sandboxes/$SANDBOX_ID/computer/screenshot" \
  -H "X-Api-Key: $CREATEOS_API_KEY" \
  -o screenshot.png

Mouse and keyboard

Each operation uses POST and accepts optional screen_id in the query.

PathJSON body
/mouse/move{ "x": 100, "y": 200 }
/mouse/clickOptional button (left, middle, right), count, and coordinates. Supply x and y together or omit both.
/mouse/scrollOptional direction (up, down) and amount.
/mouse/drag{ "from": { "x": 100, "y": 200 }, "to": { "x": 300, "y": 400 } }
/mouse/down, /mouse/upOptional { "button": "left" }.
/keyboard/type{ "text": "hello", "delay_in_ms": 10 }; delay is optional.
/keyboard/press{ "keys": ["ctrl", "a"] }
/keyboard/down, /keyboard/up{ "keys": ["shift"] }

Windows

MethodPathRequest / result
GET/windowsArray of windows with id and optional title. Optional application filter.
GET/windows/currentCurrent window.
GET/windows/{window}One window.
GET/windows/{window}/geometryid, x, y, width, height, screen.
POST/windows/{window}/focusFocus the window.
POST/windows/{window}/moveBody: { "x": 100, "y": 200 }.
POST/windows/{window}/resizeBody: { "width": 800, "height": 600 }.
POST/windows/{window}/maximizeMaximize.
POST/windows/{window}/minimizeMinimize.
POST/windows/{window}/restoreRestore.
DELETE/windows/{window}Close.

Window operations accept optional screen_id in the query. URL-encode the window ID.

Screens and browser connections

MethodPathRequest / result
GET/screensArray of screen records.
POST/screensOptional width and height; defaults to 1280 × 800. Returns a new screen with HTTP 201.
GET/screens/{screen}One screen record.
POST/screens/{screen}/resizeBody: { "width": 1280, "height": 800 }.
DELETE/screens/{screen}Delete an additional screen. The primary screen cannot be deleted.
GET/screens/{screen}/connectFresh connection details for browser access.

Screen IDs range from screen-0 to screen-7. A screen record contains screen_id, display, width, height, vnc_port, and novnc_port.

The /connect endpoint requires public ingress to be enabled on the sandbox. Enable it through the Sandbox PATCH API before requesting a connection.

Connection details contain screen_id, port, path, token, expires_at, and url when available. Treat tokens and token-bearing URLs as credentials. Use the returned URL and request fresh details after expiry. Requesting a new connection token invalidates the previous token for new connections; existing sessions stay connected.

Errors: 400 invalid input, 404 sandbox or screen not found, 409 sandbox/desktop unavailable, ingress disabled for a screen connection, or screen conflict; 429 screenshot capacity busy; 501 desktop tools unavailable; 502 service unavailable upstream. Creating a ninth screen or deleting the primary screen returns 409.

For TypeScript examples, see SDK Computer.