Skip to main content
Create a sandbox session, run a short command, and delete the session 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 session

Create a session with POST /sandbox-sessions:
create-session.sh
Set SESSION_ID to the response’s id value.

2. Check readiness

Call GET /sandbox-sessions/{session_id}/readyz before sending a command:
check-readiness.sh
Continue after a successful readiness response. If the session is still provisioning, wait briefly and check again. A 404 means the selected session was not found; a 502 reports a data-plane failure.

3. Run a command

Run a command with POST /sandbox-sessions/{session_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 session lifetimes.

Verify the result

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

4. Delete the session

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

API references