Sandboxes
Lifecycle and timeouts
The states a sandbox moves through, its deadline, and how to end it.
States
| Status | Meaning |
|---|---|
starting | The VM is booting or being handed over. |
running | Ready. You can run commands and use files. |
paused | Frozen, with its files and memory kept. Not billed. See Pause and resume. |
stopped | Ended: destroyed, or its deadline passed. Gone for good. |
error | It failed to start or resume. The error field says so in plain words. Contact support with the sandbox id. |
POST /api/v1/sandboxes returns once the sandbox is running, so you can use it straight away.
The deadline
Every sandbox has a deadline, deadlineAt. When it passes, the sandbox stops by itself and is destroyed. Nothing runs forever, and a crashed agent on your side can't leave a sandbox running up a bill.
- Set it at creation with
timeoutSec. The default is 10 minutes (your organization can change the default). The minimum is 10 seconds. - The longest is 24 hours. Plans can be lower: sessions on the Free plan are up to 1 hour.
- Move it with
POST /api/v1/sandboxes/{id}/timeoutand a newtimeoutSec. This resets the deadline to now plus that many seconds; it doesn't add to it.
curl -s -X POST "$QR_BASE_URL/api/v1/sandboxes/$SBX/timeout" \
-H "Authorization: Bearer $QR_API_KEY" -H "Content-Type: application/json" \
-d '{"timeoutSec": 1800}'The deadline is enforced twice: by the agent inside the VM, which shuts it down, and by the API, which cleans up any sandbox past its deadline.
Ending a sandbox
DELETE /api/v1/sandboxes/{id} stops and destroys it right away and returns the sandbox with status: "stopped". Its files are gone. To keep them, take a snapshot first.
Billing time
A sandbox is billed from startedAt, when it is handed to you, until it stops, minus any time it spent paused. Prices are on the Sandboxes page.