Create a new ephemeral sandbox environment. Optionally executes a command or an OpenCode prompt if provided. Sandboxes are isolated Linux microVMs that can be used to evaluate account-generated code, run AI agent output safely, or execute reproducible tasks. The sandbox will automatically stop after the timeout period. If no command or prompt is provided, the sandbox is created without triggering any background task. Use the prompt parameter as a shortcut to run opencode run "<prompt>" in the sandbox. Authentication is handled via the x-api-key header.
Your Recoup API key. Learn more.
Optional command execution parameters. If command and prompt are both omitted, sandbox is created without running any command. Use prompt as a shortcut for running OpenCode.
Request body for creating a new sandbox. All fields are optional - if no command or prompt is provided, sandbox is created without triggering a command execution task. Use prompt as a shortcut to run OpenCode with a given prompt instead of specifying command/args manually.
The command to execute in the sandbox environment. If omitted, the sandbox is created without running any command.
1"ls"
Optional arguments to pass to the command.
["-la", "/home"]Optional working directory for command execution.
"/home/user"
A prompt to pass to OpenCode in the sandbox. When provided, the sandbox will execute opencode run "<prompt>". Cannot be used together with command.
1"create a hello world index.html"
Sandbox created successfully
Response containing sandbox information
Status of the request
success, error Array of sandbox objects
The account's saved snapshot ID used for creating new sandboxes. Null if no snapshot has been saved.
"snap_abc123def456"
The GitHub repository URL associated with the account's sandbox environment. Used as the filesystem source when restoring sandboxes.
"https://github.com/username/repo"
The recursive file tree of the account's GitHub repository. Null if no github_repo is set or if the fetch fails.
Error message (only present if status is error)