Create an API key
In account settings, create an API key with the scopesandbox (or all) and the permission read_write. Store it as PXXL_API_KEY.
read key can list and inspect sandboxes but can’t create, run commands, or change anything.
Create a sandbox and run a command
- Node.js
- Python
- CLI
- curl
Serve a preview
Anything listening on$PORT (3000) inside the sandbox is served at the sandbox’s previewUrl. Start your server in the background so exec returns:
Copy files in and out
Files up to 2 MB, text or binary:sandbox.files.write(path, bytes) and sandbox.files.read(path, { binary: true }) (Python: binary=True) do the same.
Save a snapshot
Installed something you’ll want again? Snapshot the sandbox and start the next one from it. The home directory and/workspace come back; running processes don’t.
Clean up
A sandbox pauses itself afterautoStopMinutes of inactivity (60 by default), and a paused sandbox costs nothing. Delete it when you no longer need /workspace:

