Guides
Routing and fallbacks
Tell SandboxPlease what matters for a sandbox; it picks the provider and retries elsewhere when one fails.
How a sandbox is routed
Every create carries an optional provider object, modelled on OpenRouter's. Fallback only happens at create: once running, a sandbox stays on its provider. The response's attempts lists every provider tried, skipped lists the providers you named that could not run it and why, and fallback says which provider it left: reason is a stable code (see fallback reasons) and message says it in plain words, e.g. "miniSandbox had no free capacity (503), so it ran on Daytona." It is null when the first choice served it.
1Filter
Drop providers outside only, in ignore, missing a required feature, outside region, or without a key.
2Rank
Sort the rest by price (default) or by cold start with sort, reliable providers first.
3Pin
Move the provider in the slug, then order, to the front.
4Fall back
Try them in turn until one starts. allow_fallbacks: false stops after the pinned ones.
auto
sandbox: "auto" (the default) considers every provider. "e2b" or "e2b/large" pins one, and still falls back unless you turn fallbacks off.
Sort by price or cold start
sort: "price" ranks by list price for the size. sort: "latency" ranks by the median cold start measured over the last 30 days, shown on each provider's page.
Either way, reliability comes first. A provider that failed more than 20% of its creates over the last 24 hours (at least 10 of them, customer creates and our probes) goes after every healthy one, so it only serves as a fallback. Failures the account caused, ours or yours, do not count there: a plan or funds limit, a rate limit, a refused key, or an error in our adapter. On credits, a provider where such failures of our own account are more than 20% of its creates goes after every healthy one too. Among providers priced within 10% of each other, the one with the higher success rate wins, then the faster one. Pinned providers keep their place.
Require features
Only providers with every listed feature qualify: pause, ports, snapshot, fork, custom_image. Ask for pause before you call pause, ports before you ask for a port URL, and snapshot (files) or fork (files, memory and processes) before you snapshot.
Stay in a region
region: "eu" or "us" is a hard filter: a provider that does not run there is skipped with reason region, even when it is cheaper or listed in order.
Order and fallbacks
order lists providers to try first. With allow_fallbacks: false SandboxPlease stops after them and returns provider_error with each attempt in details.attempts.
The API falls back by default, even from a provider pinned in the slug. The playground does the opposite when you pick one provider: fallbacks start off so you see that provider's own error, and the Fall back to another provider switch turns them on. With auto it always falls back.
Fallback reasons
fallback.reason takes one of these values; new ones may be added, so show fallback.message for any you do not handle.
| Reason | The first provider was not used because |
|---|---|
network_policy_unsupported | It cannot enforce the network policy asked for (deny-all, or an allowlist). |
no_internet | Its sandboxes lack the internet access asked for. |
unsupported_feature | It lacks a feature in provider.require. |
region | It does not run in provider.region. |
size | It does not run that size. |
base_image_unavailable | It has no sandboxplease/base image yet. |
no_credentials | It runs only on your own provider key, and you have none for it. |
unpriced | It has no list price yet, so it runs only on your own provider key. |
byok_only | It runs only on your own provider key, never on credits, or runs this size only on your own key (CodeSandbox, large sizes on Tensorlake and Freestyle). |
low_funds | It is not taking sandboxes on credits right now. |
unhealthy | Its recent creates failed or its status page reports an outage. |
key_policy | It is outside the API key's policy. |
private_template | The template is private: it runs only on your own provider key. |
insufficient_balance | Your balance cannot hold its prepaid minutes. |
ignored | It is in provider.ignore or your ignored providers. |
plan_limit | The provider account hit a plan limit. |
rate_limited | The provider answered 429. |
auth_refused | The provider refused the key (401 or 403). |
no_capacity | The provider had no free capacity (503). |
timeout | The provider did not answer in time. |
unreachable | The provider could not be reached. |
provider_error | The provider answered another error. |
adapter_error | The provider answered in a shape SandboxPlease did not expect; we are alerted and fix it. |
unavailable | Sandboxes created before these reasons existed. |
Only and ignore
only restricts the candidates; ignore removes some. When nothing is left the API answers no_eligible_provider with every skipped provider and its reason.
{
"error": {
"code": "no_eligible_provider",
"message": "No provider matches this request: minisandbox is outside the requested region",
"hint": "To get a sandbox, drop provider.region or pick the other region.",
"details": { "skipped": [{ "provider": "minisandbox", "reason": "region" }] }
}
}Unhealthy providers
After 3 creates in a row fail on a provider with a 5xx, a timeout, a network error or a sandbox that never becomes ready, routing stops sending it sandboxes and skips it with reason unhealthy. After 30 seconds one request tries it again: a success puts it back in rotation, a failure pauses it twice as long, up to 10 minutes. A rejected key, a bad request, a rate limit or a plan limit does not count as a failure. Live state per provider is on the status page.
On credits, 3 creates in a row that our own account fails, with a 429, a 401 or a plan limit other than the size, pause the provider for credits only: it is skipped with reason provider_unavailable (fallback reason low_funds), with the same 30 seconds to 10 minutes backoff. Your own key still reaches it.
Your own provider keys
Add a provider key in BYOK and sandboxes on that provider run on your account with them: billing is byok and their usage is not taken from your credits. SandboxPlease charges nothing for it. Turn on BYOK only in the same page to never run on SandboxPlease's keys; providers without your key are then skipped with reason no credentials configured. Nothing changes in your code.
Account defaults
Routing settings set a default sort, a default region and providers to always ignore. A request's sort and region override the defaults; its ignore adds to yours.