Skip to main content
Create a sandbox, run a short command, and delete the sandbox when the work is finished. Set an API credential. Include project_reference to identify the project to bill; an environment can also supply project context and initial variables.

1. Create a sandbox

Create a sandbox with POST /sandboxes:
create-sandbox.sh
Set SANDBOX_ID to the response’s id value.

2. Check readiness

Call GET /sandboxes/{sandbox_id}/readyz before sending a command:
check-readiness.sh
Continue when the readiness response has ok: true. If the sandbox is still provisioning, wait briefly and check again. A 404 means the selected sandbox was not found; a 503 reports runtime unavailability.

3. Run a command

Run a command with POST /sandboxes/{sandbox_id}/commands/run:
run-command.sh
For longer work, use a background command and retrieve its status and output separately. The Sandbox API describes command and sandbox lifetimes.

Verify the result

Confirm that the command result contains the working directory printed by pwd. A created sandbox alone does not confirm that a command succeeded.

4. Delete the sandbox

Call DELETE /sandboxes/{sandbox_id} after saving any files you need:
delete-sandbox.sh
A successful deletion ends the sandbox. Its lifetime policy also limits availability if you leave it running.

API references