Guides
Key policies
Give each API key only what it needs: how much it spends, how many sandboxes it runs, for how long, where and when.
How policies work
A policy is a set of optional rules on one key, edited in Settings › Keys. A key without rules behaves as before. Rules apply on every call (who and when), at create (which sandbox, and how long it may live) or while running, where the meter stops sandboxes that break them within a minute. Counters are race-safe: ten parallel creates on a key with max_running: 3 start exactly three.
{
"daily_cap_usd": 50,
"max_running": 20,
"max_idle_s": 900,
"allowed_regions": ["eu"],
"allowed_operations": ["create", "exec", "files", "kill"],
"ip_allowlist": ["203.0.113.0/24"],
"sandbox_network": { "allow": ["pypi.org", "registry.npmjs.org", "*.github.com"] },
"alert_thresholds": [50, 80, 100],
"alert_webhook_url": "https://hooks.example.com/sandboxplease"
}Routing respects the policy: providers it rules out are skipped and listed in the error's details.skipped, and a timeout longer than the key allows is shortened rather than refused.
Presets
CI runner
Short-lived sandboxes, a few at a time, stopped when idle.
{"max_running":10,"max_creates_per_minute":30,"max_lifetime_s":1800,"max_idle_s":600,"max_sandbox_cost_usd":1}Agent in production
A daily cap with alerts, idle sandboxes stopped, cost per sandbox bounded.
{"daily_cap_usd":50,"max_running":20,"max_idle_s":900,"max_sandbox_cost_usd":5,"alert_thresholds":[50,80,100]}EU only
Sandboxes run only in the EU.
{"allowed_regions":["eu"]}Hackathon / demo
$5 to spend, expires in 24 hours, sandboxes stop with it.
{"kill_at_expiry":true,"max_running":3,"max_lifetime_s":3600,"alert_thresholds":[80,100]}Read-only analytics
Lists and reads sandboxes; cannot create, run or kill anything.
{"read_only":true}Every rule
Spend
Hard cap on what the key spends per UTC day. New sandboxes are refused and running ones stopped once it is reached.
A sandbox stops once it has cost this much; its lifetime is shortened at create to fit.
Only providers whose list price for the size is at or under this hourly price are used.
Concurrency and rate
Running and paused sandboxes the key can hold at once.
Sandboxes the key can create in any rolling minute.
Sandboxes the key can create in any rolling hour.
Sandboxes the key can create in any rolling 24 hours.
Commands the key can run per minute, across all its sandboxes.
Lifetime
A longer timeout at create is shortened to this.
A sandbox no API call touched for this long is stopped; a longer idle_timeout at create is shortened.
Sandboxes never outlive the key's expires_at: their lifetime is shortened at create and the meter stops them.
Scope
Only these providers are used.
These providers are never used.
Sandboxes run only in these regions; ["eu"] makes an EU-only key.
Sizes the key can create.
Templates the key can start; a create without a template uses the provider's default and is allowed.
"byok" runs only on your own provider keys, "credits" only on SandboxPlease credits.
The key can list and read sandboxes, nothing else.
Calls the key can make besides reading; list and get are always allowed.
Network
API calls are accepted only from these addresses.
What the key's sandboxes may reach. Creates get this rule; a request may only ask for less. Only providers that enforce it are used.
Calls must carry an Origin or Referer from this list, for keys used from a browser.
Time
The key works only on these days (0 = Sunday) between start and end (HH:MM) in the time zone.
The key works only from this moment.
The key stops creating after this many sandboxes in its life; good for one-time keys.
Safety
Alerts when the key crosses these shares of its credit limit, daily cap or burst limit, e.g. [50, 80, 100].
Alerts are emailed unless this is false.
Alerts are also POSTed here as JSON: { "type": "key.alert", ... }.
Logs what the policy would block without blocking, to roll a policy out safely. The kill switch still applies.
Dry run
With dry_run: true nothing is refused, shortened or stopped: each rule that would have acted is counted instead. Watch the counts in the key's Usage and limits panel and under Policy blocks in Activity, then turn dry run off.
Kill switch
Disable key in the key's menu refuses its next call with key_disabled and stops every sandbox it runs right away. Unlike revoking, it can be undone, and dry run does not soften it.
Keys in a workspace
In a team workspace, a member's key reaches only the sandboxes created by that member's keys: get, list, exec, files, ports, pause, resume and kill, through the API, MCP and the playground. Another member's sandbox answers not_found, like a sandbox of another account. Keys of the owner and of admins reach every sandbox in the workspace, and so do they in Logs.
Members can tighten their own keys but not undo what an owner or admin decided: a key an owner or admin disabled stays off, a policy they set can only get stricter (lower caps, shorter lists, no dry run), and only they change limit_reset, raise or remove credit_limit_usd, push back or remove expires_at or leave BYOK out of the limit. Each refusal is a forbidden error; for a policy, details.rules names the rules that would loosen.
Alerts
alert_thresholds are percentages of the key's credit limit, daily cap and max_sandboxes. Each threshold alerts once per window (per day for the daily cap), by email unless alert_email is false, and as a POST to alert_webhook_url when set:
{
"type": "key.alert",
"key": { "id": "4b0c…", "name": "Coding agent" },
"limit": "daily_cap_usd",
"threshold_pct": 80,
"used": 40.12,
"max": 50,
"unit": "usd",
"at": "2026-11-23T14:02:11.000Z"
}Errors
The key's policy does not allow this call; details.rule names the rule.
The key reached a concurrency or rate cap of its policy; details.rule names the cap.
This key used up its credit limit for the period, or its daily cap.
The key's kill switch is on: its calls are refused and its sandboxes were stopped.
details.rule names the rule that refused the call, so a client can tell a daily cap from a rate limit.