Skip to main content
Sandboxes are isolated Linux workspaces billed per second from your wallet. These routes need a key scoped to all or sandbox. GET routes need read; everything else needs read_write. Sandboxes are on Plus, Pro, and Enterprise: an API key on a free plan gets 402, a dashboard session gets 403. Pass ?teamId= to work with a team’s sandboxes. A team-scoped key only sees its team’s sandboxes. All paths are relative to https://server.pxxl.app/api/v3.

Endpoints

The sandbox object

string
creating, running, paused (you stopped it), paused_idle (auto-stop), paused_low_balance (wallet ran low), or failed. Treat the older stopped and paused_insufficient_points as paused.
string
Public URL of the app listening on $PORT (3000) inside the sandbox.
number
What the sandbox costs per hour while running. Paused sandboxes cost nothing.
number
Charged to your wallet so far. unbilledUsd is the running time not yet charged.
object
The sandbox’s labels, as { "key": "value" }. Empty when it has none.
object
The outbound network policy: mode is allow-all, deny-all, or allowlist, and allow lists the allowed domains and CIDRs. See network policies.

Get pricing

GET /sandboxes/pricing Public. No API key needed.

List sandboxes

GET /sandboxes
usage.hourlyBurnUsd is what everything running right now costs per hour.

Filter by label

Add label=key:value to keep only sandboxes with that label. Repeat it to require several; label=key matches any value of key.

Create a sandbox

POST /sandboxes
string
Shown in the dashboard and usable in the CLI instead of the ID. Generated when left out.
string
default:"base"
base (Debian 13), node, python, go, rust, or bun. nodejs, js, and typescript mean node; py means python; golang means go. GET /sandboxes/pricing lists each template’s runtime version.
string
micro (1 vCPU, 1 GB), small (2 vCPU, 4 GB), medium (4 vCPU, 8 GB), or large (8 vCPU, 16 GB).
number
Custom vCPUs instead of a size. Your plan sets the maximum.
number
Custom memory in MB instead of a size.
number
default:"10"
2, 5, or 10. Included in the price.
number
default:"60"
Pause after this many idle minutes, 0 to 1440. 0 means never.
object
Environment variables, as { "KEY": "value" }.
string
A GitHub repository, owner/repo, to clone into /workspace.
object
Up to 20 labels, as { "key": "value" }. Keys match ^[a-z0-9][a-z0-9_.-]{0,62}$. Values are one line, up to 256 characters.
object
The outbound network policy, { "mode": "...", "allow": [...] }. Left out, the sandbox reaches the whole internet. With allow entries and no mode, it is an allowlist. See network policies.
string
Start from a snapshot: its home directory and /workspace come back. The template comes from the snapshot, so template isn’t needed.
Response 202
The sandbox starts as creating. Poll GET /sandboxes/{id} until status is running (usually a few seconds), or failed.

Get or update a sandbox

GET /sandboxes/{id} returns { sandbox }. PATCH /sandboxes/{id} changes the name, auto-stop, preview access, labels, or network policy. labels replaces all of them; {} clears them.

Network policies

egress controls the sandbox’s outbound connections. allow entries are domains (github.com matches exactly, *.npmjs.org matches any subdomain) or public IPv4 addresses and CIDRs, up to 64. Set it on create, or change it with PATCH:
Response
New connections follow the policy at once; connections already open are not cut. egressApplied is false for a sandbox created before network policies, with a message: the policy applies at its next start.

Snapshots

A snapshot saves a sandbox’s home directory (global installs, dotfiles, caches) and /workspace. Memory and running processes aren’t kept. Start new sandboxes from it to skip installs. POST /sandboxes/{id}/snapshots takes an optional name. The sandbox must be running.
Response 202
Saving takes about 5 to 15 seconds. Poll GET /sandboxes/snapshots/{snapshotId} until status is ready, or failed with an error. Then create a sandbox from it:
GET /sandboxes/snapshots lists your snapshots; ?sandboxId= keeps the ones taken from one sandbox. DELETE /sandboxes/snapshots/{snapshotId} deletes one.

Run a command

POST /sandboxes/{id}/exec The sandbox must be running, or you get 409.
string
required
A shell command, such as npm install && npm test.
string
default:"/workspace"
Directory to run it in.
number
At most 300. The command is stopped and timedOut is true when it runs longer.
output holds stdout and stderr together. Very long output is cut and truncated is true.

Stream output

Send Accept: application/x-ndjson to get output as it’s produced, one JSON object per line:
The last line is exit, or error with a message if the command couldn’t run.

Files

Paths are inside the sandbox. Files are up to 2 MB.
type is file or directory.

Binary files

Images, archives, and other binary files go base64-encoded. Add encoding=base64 to read one, and "encoding": "base64" to write one. The 2 MB limit applies to the decoded bytes.

Processes

GET /sandboxes/{id}/processes lists what’s running in the sandbox:
DELETE /sandboxes/{id}/processes/{pid}?signal=TERM sends a signal to a process and returns { "pid": 64, "signal": "TERM" }. signal is TERM (the default), KILL, INT, or HUP. You get 404 when there’s no such process.

Start, stop, and delete

Logs and usage

GET /sandboxes/{id}/logs returns provisioning events and the container’s recent output:
GET /sandboxes/{id}/usage returns what the sandbox has cost:

Account summary

GET /sandboxes/summary is the account at a glance. The dashboard, the CLI (pxxl sandbox summary) and the AI agent all read it.
  • runwayHours is how long the wallet lasts at the current burn. It’s null when nothing is running.
  • storageGb is the disk reserved by your sandboxes, paused ones included.
  • Hints:
    • idle means a running sandbox has had no activity for 15 minutes or more.
    • runway means the wallet covers less than 2 hours of the running sandboxes.

Private previews

Every sandbox has a preview URL. Set previewAccess when you create the sandbox, or later with PATCH:
  • public (the default): anyone with the URL can open it.
  • private: the URL answers 401 unless the browser comes through a link from POST /sandboxes/{id}/preview-link.
The link works for 12 hours. Opening it sets a cookie for that preview host only and removes the token from the address. Your app never sees the token or the cookie.

Background commands

Add "background": true to start a long-running process, such as a dev server or a watcher, without waiting for it to finish:
The response comes back at once with { "background": true, "pid": 46, "logFile": "/tmp/pxxl-bg/1795542369859626457.log" }. The process keeps running until the sandbox stops or you stop it. Read its output with another exec, for example tail -n 50 <logFile>.

Preview analytics

GET /sandboxes/{id}/analytics?timeframe=24h returns traffic to the sandbox’s preview URL: requests, unique visitors, bandwidth and status codes over time. It has the same shape as a project’s traffic analytics.

Alerts

Pxxl notifies whoever pays for the sandbox: you, or the spaceship owner for a team sandbox. Alerts appear in the dashboard and as push notifications, and the ones that need action also arrive by email. Each alert is sent at most once a day per sandbox. Wallet lines for sandbox usage read like Sandbox api-test · 2 vCPU · 4 GB · 3h 12m.

Terminal

POST /sandboxes/{id}/terminal/ticket returns a short-lived wsUrl for an interactive shell. Connect to it within expiresIn seconds. It works once. The terminal is available when terminals are enabled for your account. Otherwise this route returns 403. pxxl sandbox terminal <id> connects for you.