POST /api/sandbox/create
Creates a new sandbox instance.Request body
No request body required.Response
Whether the sandbox was created successfully
Unique identifier for the created sandbox
Preview URL where the sandbox can be accessed
Error message if
success is falseError codes
Failed to create sandbox
Example request
Example response
GET /api/sandbox/status
Checks if a sandbox is alive and returns its information.Query parameters
The sandbox ID to check. If omitted, checks the currently active sandbox
Response
Whether the status check succeeded
Whether the sandbox is currently running
The sandbox identifier
Preview URL for the sandbox
Error message if
success is falseError codes
No active sandbox found
Failed to retrieve sandbox status
Example request
Example response
GET /api/sandbox/files
Retrieves the list of files in a sandbox.Query parameters
The sandbox ID. If omitted, uses the currently active sandbox
Response
Whether the file list was retrieved successfully
Array of file paths as strings
Error message if
success is falseError codes
No active sandbox found
Failed to retrieve file list
Example request
Example response
POST /api/sandbox/diagnostics
Runs diagnostic checks on a sandbox to verify its health and capabilities.Request body
The sandbox ID to diagnose. If omitted, diagnoses the active sandbox
Response
Returns diagnostic results as JSON. The structure depends on the implementation ofrunSandboxDiagnostics.
Example request
Example response
POST /api/sandbox/kill
Terminates a sandbox or all sandboxes.Request body
The sandbox ID to terminate. If omitted, terminates all active sandboxes
Response
Whether the termination succeeded
Error message if
success is falseError codes
Failed to terminate sandbox
Example request (specific sandbox)
Example request (all sandboxes)
Example response
POST /api/packages/install
Installs npm packages in a sandbox.Request body
Array of package names to install (e.g.,
["react", "lodash"])The sandbox ID where packages should be installed. If omitted, uses the active sandbox
Response
Whether the installation succeeded
List of successfully installed packages
Error message if
success is falseError codes
Invalid JSON body or empty packages array
Failed to install packages
Example request
Example response
Sandbox lifecycle
A typical sandbox workflow:- Create a sandbox using
/api/sandbox/create - Generate code with
/api/generate/stream - Apply the code using
/api/apply/stream(includes package installation) - Install additional packages via
/api/packages/installif needed - Check status via
/api/sandbox/statusto verify it’s running - List files with
/api/sandbox/filesto inspect contents - Terminate when done using
/api/sandbox/kill
sandboxId identifier.