echo hello in a remote sandbox, then destroy it. BoxRouter chooses a route, which is a provider and the account that pays for it.
Before You Begin: A BoxRouter API key from your dashboard, and either a connected provider key or Credits in the same workspace. Set Up Your Account covers both.
Use Python if you have no preference.
Set Your API Key
Clients readBOXROUTER_API_KEY. Set BOXROUTER_BASE_URL to override https://api.boxrouter.ai/api/v1.
The hidden prompt keeps the key out of your shell history.
Install a Client
.mts example uses await using, which needs Node.js 24 or later. HTTP needs curl 7.76 or later and jq.
Run a Command and Clean Up
Save the Python example asquickstart.py and run python quickstart.py, or the TypeScript example as
quickstart.mts and run node quickstart.mts. Paste the CLI and HTTP examples into a shell.
run requests deletion when the command exits, whatever its status, and the HTTP example
deletes in an EXIT trap. DELETE answers 202 with the sandbox. Its state is destroyed once deletion is
confirmed and destroying while cleanup is pending.
If the state is destroying, deletion is still pending. Use the sandbox ID the Python, TypeScript, and HTTP examples print to
check its state and recover before retrying. boxrouter run prints no sandbox ID; create the
sandbox with boxrouter create when you need one.
What Happened
A route is a provider and the account that pays for it: your provider key or Credits. Workspace restrictions and the default request filter routes; BoxRouter tries the top-ranked eligible route first. The sandbox’sroute field records the choice; routing explains the ranking.
If your program stops, the sandbox keeps running until its lifetime ends (300 seconds unless you set lifetime_seconds),
and can run past the end of its lifetime. Check its state and destroy it when you no longer need it. See Lifecycle.
When a command fails inside the sandbox, exec returns its exit_code, stdout and stderr and raises no API
error. These examples pass check=True ({ check: true } in TypeScript).
That raises CommandFailed for a nonzero exit or a timeout.
If It Fails
If sandbox creation returns either error, it created nothing. If a later call fails, a sandbox
created earlier may still need cleanup. Check its state before retrying.
Next Steps
Create a Sandbox
Keep a sandbox across calls and say what it needs.
Work with Files
Upload a file, process it, and download the result.
Recover from Errors
Tell whether your work started, then retry without duplicates.