> For the list of every page, fetch /llms.txt. The API contract is the OpenAPI file linked from the API reference.

# Create a sandbox

POST https%3A%2F%2Fapi.usemeadow.ai/v1/sandboxes
Content-Type: application/json

Starts a sandbox from a registry image (`image`) or from an image you built
(`image_id`). The call returns 202 at once with `status: creating`. Then do one
of three things:

* Poll `GET /v1/sandboxes/{sandbox_id}` until `status` is `running` or `failed`.
* Add `?wait=true` to hold this request until then, for up to
  `wait_timeout_seconds`. If the wait ends first you still get 202 with
  `creating`, and the create continues.
* Set `webhook_url` and wait for the `sandbox.running` event.

The status code is 202 in every case, also when `wait=true` returns a sandbox
that is `running` or `failed`. Read `status` in the body.

**Vendor choice and fallback.** Meadow tries vendors in the order given by
`provider.order`, else the project's `routing.sandboxes.order`, else `daytona`
then `modal`. It skips vendors the account has no key for. If a vendor cannot
meet the request, refuses, has no capacity, or misses
`provider.create_timeout_seconds`, Meadow tries the next one. Each try is
recorded in `attempts`. If every vendor fails, the sandbox ends as `failed` with
a `failure_reason`. The HTTP status stays 202 or 200, so read the sandbox body.
A vendor that failed lately on this account can be moved to the end of the
route while it cools down (`sandbox_health` on `GET /v1/provider-keys`). An
order you set (`provider.order`, or the project's `routing.sandboxes.order`) is
tried as written unless its first vendor answered quota exceeded or no capacity
for this account, or failed 3 creates in a row within 10 minutes, and its
cooldown has not ended. A route with no order moves any vendor that is cooling
down. A route with one vendor is never changed. Every move is listed in
`skipped_providers`. A vendor that rejects the stored key (401 or 403) fails
its attempt at once, the next vendor is tried, and the rejection does not count
against the vendor's health.
On a project with `routing.lock`, a request that sends `provider.order`,
`provider.only`, `provider.allow_fallbacks`, `provider.create_timeout_seconds`
or `provider.options` returns 403.

**Retries.** Send `Idempotency-Key` so a retry cannot create a second sandbox.

**Rules.**

* Exactly one of `image` and `image_id` is required.
* Unknown fields return 400, and so does a known field set to `null`. The removed
  fields `model_access`, `sandbox_access`, and `provider_options` return 400. To
  let code in the sandbox call Meadow, mint a narrow key with `POST /v1/keys`
  and pass it in `env`.
* `provider.options` is checked for every vendor in the route before any is
  tried, so a bad option fails the request even when another vendor could serve
  it.
* `resources` are honoured on both vendors, but the units differ and Meadow
  does not convert them: `cpu` counts virtual CPUs on Daytona and physical
  cores on Modal. On Modal `cpu` and `memory_mb` are hard limits unless you send
  `provider.options.modal.burst: true`. A size or GPU type a vendor cannot
  serve skips that vendor with an `unsupported` attempt that carries the
  reason. See `resources`.
* The response does not echo `image`, `image_id`, `env`,
  `timeout_seconds`, `idle_timeout_seconds`, or `webhook_url`. Keep them on your
  side if you need them later. `network` is returned.

Scope: `sandboxes`.

```bash
curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes?wait=true" \
  -H "Authorization: Bearer $MEADOW_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"image":"python:3.12-slim","timeout_seconds":1800}'
```

Reference: https://docs.usemeadow.ai/api-endpoints/sandboxes/create-sandbox

## Authentication

- `Authorization` header (bearer token, required) — A Meadow API key, sent as `Authorization: Bearer mdw_...`. The header `x-api-key: mdw_...` is accepted in its place.

## Request

### Query parameters

- `wait` (boolean, optional, default: false) — When `true`, hold the request until the sandbox is `running` or `failed`, or until `wait_timeout_seconds` passes.
- `wait_timeout_seconds` (integer, optional, default: 300) — Longest time to hold the request when `wait` is true, in seconds, from 1 to 900. A value outside that range returns 400. The create continues after the wait ends.

### Headers

- `Idempotency-Key` (string, optional) — Makes a retry safe. A repeat with the same key and the same body returns the result of the first call instead of starting again. The same key with a different body returns 409. On `POST /v1/keys`, `POST /v1/projects` and `POST /v1/images` a value is scoped to the API key that sent it: another key that sends the same value starts its own request. The sandbox and exec routes scope it to the API key too. On the exec route the header only has an effect with `background: true`. See Idempotency in the introduction for how long a value is kept. The key is 1 to 255 bytes of printable ASCII. A blank, longer, or non-ASCII key, or the header sent twice, returns 400. A UUID works well.

### Body (application/json)

This endpoint expects a SandboxCreate.

- `name` (string, optional) — A label for people. It need not be unique. Must not be empty when sent.
- `image` (string, optional) — A registry image both providers can pull, with its tag. On Modal the image's default command must keep running. If it exits, the sandbox becomes `failed` with `provider_lost`.
- `image_id` (string, optional) — An image built with `POST /v1/images`. Providers where its build is `ready` start at once. A provider with no build yet builds it first, which counts toward `create_timeout_seconds`. A provider whose build `failed` is skipped. Daytona fixes resources on a snapshot. Meadow keeps one Daytona snapshot per image and size (`cpu`, `memory_mb`, `disk_mb`, GPU count and type). The first sandbox that asks for a new size makes the snapshot from the image's own build, which counts toward `create_timeout_seconds`, and the served attempt's `detail` says `provider built a copy of the image for this size`. Later sandboxes of that size start at once. A size Daytona cannot serve skips Daytona with an `unsupported` attempt that carries Daytona's reason.
- `registry_auth` (SandboxCreateRegistryAuth, optional) — Login for a private `image`. Both fields are required when it is sent. Cannot be combined with `image_id`. Daytona does not support it and is skipped.
- `resources` (Resources, optional) — The size of the sandbox. Unknown fields return 400.
- `env` (map from string to string, optional) — Environment variables for every command in the sandbox. Keys must not be empty. Values are never returned by the API.
- `timeout_seconds` (integer, optional, default: 3600) — Longest lifetime, in seconds, from 1 to 86400 (24 hours). The sandbox is terminated when it passes. Meadow enforces this itself. Where the provider has its own lifetime setting, Meadow sets that too, so the sandbox still ends if Meadow is down. A value above 86400 returns 400. A value below 10 skips Modal. The default is one hour, so a long job must send this field. Nothing else in Meadow ends a running sandbox earlier, apart from `idle_timeout_seconds` when you send it, and a spent dollar `limit` on a key with `limit_action` `stop_sandboxes`. A vendor whose own lifetime limit for your account is lower than `timeout_seconds` is skipped with an `unsupported` attempt that says so (checked on Daytona, which reports the time it will end a sandbox).
- `idle_timeout_seconds` (integer, optional) — Terminate after this many seconds with no API call for the sandbox and no background command running. At least 1. Left out, the sandbox never ends for being idle. A foreground or streamed `exec` call, a file upload, and a file download count as activity for as long as they are open.
- `ports` (list of integer, optional) — Ports inside the sandbox to make reachable from outside. They must be listed here: a port cannot be opened after create. Get the address with `GET /v1/sandboxes/{sandbox_id}/ports/{port}`.
- `ssh` (boolean, optional, default: false) — Make the sandbox reachable over SSH. It must be set here: SSH cannot be turned on after create. Get the address and key with `POST /v1/sandboxes/{sandbox_id}/ssh`.
- `network` (SandboxCreateNetwork, optional) — Outbound network rules. Left out, outbound traffic is open. `block_all` cannot be combined with the allow lists. On Modal `block_all` also blocks inbound connections, so Modal is skipped for `block_all` with `ports` or `ssh: true`. Daytona cannot combine `allow_domains` with `allow_cidrs`, takes at most 10 `allow_cidrs` entries and 100 `allow_domains` entries, and takes IPv4 ranges only. It is skipped for a request outside those limits. The rules can be replaced later with `PATCH /v1/sandboxes/{sandbox_id}`. On Modal that works only for a sandbox created with `allow_domains` or `allow_cidrs`: see that operation.
- `provider` (SandboxRouting, optional) — Which sandbox providers may host a sandbox, and in what order. Send it as `provider` on `POST /v1/sandboxes`, or store it on a project as `routing.sandboxes`. A field set on the request replaces the same field from the project. A provider that cannot meet the request (GPU type, lifetime, network rule, private registry) is skipped and recorded in `attempts` as `unsupported`.
- `labels` (map from string to string, optional) — Your own key and value pairs, returned with the sandbox and usable as a filter on `GET /v1/sandboxes`. Keys must not be empty.
- `webhook_url` (string, optional) — Where to send this sandbox's status events. Must be `https` and resolve to a public address. Left out, the project's `webhook_url` is used.

## Response

### 202

Accepted. Without `wait` the sandbox is `creating`. With `wait=true` it is usually `running` or `failed`.

- `id` (string, required) — The sandbox id.
- `project_id` (string, required) — The project the sandbox belongs to.
- `status` (enum, required) — - `creating`: accepted. Meadow is trying vendors. - `running`: ready for exec, file, port, and SSH calls. - `terminating`: delete was asked for and the vendor has not confirmed yet. - `terminated`: ended by delete, by `timeout_seconds`, by the idle timeout, or by the vendor at its own lifetime limit. - `failed`: no vendor could create it, or the vendor lost it while it ran. See `failure_reason`.
  - Allowed values: `creating`, `running`, `terminating`, `terminated`, `failed`
- `created_at` (datetime, required) — When the create call was accepted.
- `name` (string, optional, nullable) — The label given at create. Null when none was given.
- `failure_reason` (enum, optional) — Why the sandbox is `failed`. Null otherwise. - `all_providers_failed`: every provider in the route failed, for mixed reasons. Read `attempts`. - `timeout`: every attempt timed out. - `image_pull_failed`: every attempt failed to pull the image. - `build_failed`: every attempt failed to build the image. - `provider_lost`: the sandbox was running and the provider lost it, for example because the image's main command exited on Modal. - `internal`: Meadow failed.
  - Allowed values: `all_providers_failed`, `image_pull_failed`, `build_failed`, `timeout`, `provider_lost`, `internal`
- `provider` (enum, optional, nullable) — The provider hosting the sandbox. Null until one accepts it.
  - Allowed values: `daytona`, `modal`
- `provider_sandbox_id` (string, optional, nullable) — The vendor's own id, for finding the sandbox in their dashboard.
- `attempts` (list of Attempt, optional) — Every try to create the sandbox, in order. Empty until the first try ends.
- `skipped_providers` (list of SkippedProvider, optional) — Providers Meadow moved to the end of the route because their circuit breaker was open (`sandbox_health` on `GET /v1/provider-keys`), in the order it moved them. Empty when the route was tried as written. A moved provider is still tried if every provider before it fails, and then it also appears in `attempts`. The order is decided when the create is about to try a provider, after `POST /v1/sandboxes` has answered 202. So this list is filled on the answer of a `wait=true` create, on `GET /v1/sandboxes/{sandbox_id}` and in webhook events, and is empty on the first 202 of a create that does not wait.
- `resources` (Resources, optional) — The size of the sandbox. Unknown fields return 400.
- `labels` (map from string to string, optional) — The labels given at create. Empty when none were given.
- `ports` (list of integer, optional) — The ports listed at create.
- `ssh` (boolean, optional) — Whether SSH was asked for at create.
- `network` (NetworkRules, optional, nullable) — The outbound network rules in force: the rules given at create, or the rules of the last `PATCH /v1/sandboxes/{sandbox_id}`. All three fields are always present. Null for a sandbox created before Meadow recorded the rules.
- `started_at` (datetime, optional, nullable) — When the sandbox became `running`. Null before that.
- `expires_at` (datetime, optional, nullable) — When `timeout_seconds` ends the sandbox: `started_at` plus the timeout. Null until it is running.
- `terminated_at` (datetime, optional, nullable) — When the sandbox became `terminated`. Null otherwise.
- `cost` (SandboxCost, optional) — What this sandbox costs at the vendor, so far. Returned by `GET /v1/sandboxes/{sandbox_id}` and `GET /v1/sandboxes`, and left out of the other sandbox responses. It is read from the usage records with the same arithmetic as `GET /v1/usage`, so the two agree: this object covers every vendor sandbox the create started, a provider that Meadow moved on from included, and its `cost` is what `sandbox_cost` in `/v1/usage` adds up for this sandbox over its whole life. It is a list price times time, not the vendor's invoice. `cost_status` says how far to trust it: * `price_table`: the size the vendor granted times its list price. * `price_estimated`: an estimate. `cost_reason` says why: `grant_unconfirmed` (the vendor has not yet confirmed the size, so the size asked for is priced), `spot_unconfirmed`, or `meadow_clock` (the sandbox has ended and its time is still Meadow's own count, which runs longer than the vendor's: Meadow has not yet read the time the vendor billed), or `vendor_window_unavailable` (the same, and Meadow can no longer read that time: the account stores no key for the vendor, or the sandbox ended more than 4 days ago). A reason about the price is shown before either when both apply. * `price_unknown`: no cost can be stated, and `cost` is null. Unknown never means free. `cost_reason` is `not_recorded` when no usage record exists yet (records are written about once a minute, and a create that never reached a vendor has none), or the reason the price table gives, such as a GPU type or a shape it has no price for. A create the vendor refused before it made a sandbox has a record that costs 0.

## Errors

### 400 Bad Request Error

The request breaks a rule. The message names the field. Fix it and send it again.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 401 Unauthorized Error

The key is missing, malformed, unknown, revoked, or expired, or a key it was minted from no longer exists. Check the key and the header.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 402 Payment Required Error

A dollar `limit` stops the create: the key, or a key above it, has spent its `limit`. Nothing was created and nothing was charged. There is no `retry-after` header, because the wait is until the limit resets or is raised. Do not retry: raise the `limit` with `PATCH /v1/keys/{key_id}` or wait for `limit_reset_at`. The body is in Meadow's envelope. With `error.code` `budget_exceeded`, a budget with `hard_limit` on the project or on the account has reached its `limit_usd`. Raise `limit_usd`, switch `hard_limit` off, or wait for the budget's `resets_at`.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 403 Forbidden Error

The key lacks the `sandboxes` scope, or the project is locked and the request sent routing fields in `provider`, or no provider in the route is in the `allowed_sandbox_providers` of the key or a key above it (`key_provider_access_denied`), or a `max_sandboxes` cap is reached: the key's or a key above it (`key_sandbox_limit_exceeded`), or the project's (`project_sandbox_limit_exceeded`). Nothing was created. Retry after a sandbox ends.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 404 Not Found Error

The `image_id` does not exist in this project.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 409 Conflict Error

The `Idempotency-Key` was already used with a different body. Use a new key for a new request.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 413 Content Too Large Error

The request body is larger than this route allows: 1 MiB for JSON bodies, 16 MiB on the model routes, 100 MiB for a file upload, and 100 MB for a build context.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 422 Unprocessable Entity Error

No stored sandbox provider key can serve the request. Store a `daytona` or `modal` provider key, check its `project_ids`, or widen `provider.only`.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 429 Too Many Requests Error

More than 20 failed authentications came from your address in one minute, and this request also failed to authenticate: fix the key, wait for `retry-after` seconds, then retry. Or the server instance was full and no slot came free for the account within 3 seconds (`error.code` `account_in_flight_limit_exceeded`): wait for `retry-after` seconds, then retry.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

### 500 Internal Server Error

Meadow failed. Retry with backoff, and tell us if it persists.

- `error` (ErrorError, required)
- `request_id` (string, optional) — The same id as the `x-request-id` response header. Quote it when you report a problem.

## Types

### SandboxCreateRegistryAuth

Login for a private `image`. Both fields are required when it is sent. Cannot be combined with `image_id`. Daytona does not support it and is skipped.

- `username` (string, optional) — The registry user name.
- `password` (string, optional) — The registry password or token. Never returned.

### Resources

The size of the sandbox. Unknown fields return 400.

- `cpu` (double, optional, default: 2) — The most CPU the sandbox can use. Must be above 0. The unit differs by vendor and Meadow does not convert it: Daytona counts virtual CPUs and rounds up to a whole number. Modal counts physical cores, which it documents as two virtual CPUs each, and takes fractions. Modal also reserves this amount. Size `cpu` for the vendor that will serve. With `provider.options.modal.burst: true` it is only a floor on Modal.
- `memory_mb` (integer, optional, default: 4096) — The most memory the sandbox can use, in MB, at least 1. Daytona rounds up to a whole GiB. A command that passes the limit is killed on Daytona. On Modal the whole sandbox ends and reads `failed` with `provider_lost`. With `provider.options.modal.burst: true` it is only a floor on Modal.
- `disk_mb` (integer, optional) — Disk in MB, at least 1. Daytona rounds up to a whole GiB and gives 3 GiB when this is left out. Modal has no disk setting: every sandbox gets 512 GiB, and a request above that skips Modal with an `unsupported` attempt.
- `gpu` (ResourcesGpu, optional) — Ask for GPUs. Left out, the sandbox has none.

### SandboxCreateNetwork

Outbound network rules. Left out, outbound traffic is open. `block_all` cannot be combined with the allow lists. On Modal `block_all` also blocks inbound connections, so Modal is skipped for `block_all` with `ports` or `ssh: true`. Daytona cannot combine `allow_domains` with `allow_cidrs`, takes at most 10 `allow_cidrs` entries and 100 `allow_domains` entries, and takes IPv4 ranges only. It is skipped for a request outside those limits. The rules can be replaced later with `PATCH /v1/sandboxes/{sandbox_id}`. On Modal that works only for a sandbox created with `allow_domains` or `allow_cidrs`: see that operation.

- `block_all` (boolean, optional, default: false) — Block all outbound traffic.
- `allow_domains` (list of string, optional) — Allow outbound traffic only to these host names. Each may start with one wildcard label, such as `*.example.com`. IP addresses, ports, schemes, paths and wildcards elsewhere return 400. Use `allow_cidrs` for addresses. Meadow sends each entry to the vendor as written, and the vendor applies it. On Daytona and on Modal, `*.example.com` covers every subdomain and also `example.com` itself, and a plain name does not cover its subdomains. What an allowed name opens differs by vendor. On Daytona it opens the name on ports 80, 443 and 22 (other ports not checked). On Modal it opens TLS on port 443 only, and plain HTTP on port 80 is refused. An `https://` URL that redirects to `http://` therefore works on Daytona and fails on Modal. Seen on both vendors on 2026-11-27.
- `allow_cidrs` (list of string, optional) — Allow outbound traffic only to these CIDR ranges, such as `203.0.113.0/24`.

### SandboxRouting

Which sandbox providers may host a sandbox, and in what order. Send it as `provider` on `POST /v1/sandboxes`, or store it on a project as `routing.sandboxes`. A field set on the request replaces the same field from the project. A provider that cannot meet the request (GPU type, lifetime, network rule, private registry) is skipped and recorded in `attempts` as `unsupported`.

- `order` (list of enum, optional) — Providers to try, in this order. Default is the project's order, else `daytona` then `modal`.
  - Allowed values: `daytona`, `modal`
- `only` (list of enum, optional) — Use only these providers.
  - Allowed values: `daytona`, `modal`
- `allow_fallbacks` (boolean, optional, default: true) — When false, only the first provider is tried.
- `sort` (enum, optional) — Order the providers by a measure instead of by `order`. The values are OpenRouter's (https://openrouter.ai/docs/guides/routing/provider-selection.md). - `price`: lowest hourly list price of the size asked for first, from the price table `GET /v1/pricing` returns. A provider whose price is unknown goes last. - `latency`: shortest median create time first, over this account's last 20 creates each provider served in the past 24 hours, as October does. A provider with none goes last. A tie is broken by price. - `throughput`, OpenRouter's third value, has no meaning for a sandbox and returns 400. An `order` wins over `sort`: on the request, and on the project when the request sends neither. A request `sort` wins over the project's `order`. A sorted route is not a configured order: an open circuit breaker moves a provider to the end as it does on the automatic route.
  - Allowed values: `price`, `latency`
- `create_timeout_seconds` (integer, optional, default: 300) — How long to wait on one provider before trying the next, in seconds. The vendor sandbox is created with a lifetime that covers this wait, so a value above 3600 returns 400. A build of `image_id` that has to run first counts toward it. When neither the request nor the project sets it, the last provider in the route gets 300 seconds and each earlier one gets 120 seconds from the moment Meadow asks the vendor, so a slow provider is left sooner. That shorter wait is used only when a later provider can take over: it accepts this request and is not marked `open` in `sandbox_health`. It is not used for a GPU sandbox. Set this field to wait the same time on every provider.
- `options` (map from string to map from string to any, optional) — Vendor-specific settings, keyed by provider, for example `{"daytona": {"spot": true}}`. This is the only place vendor-specific settings appear. A provider's entry is ignored when another provider serves the request. On a request, the options for a provider replace the project's options for that provider. Meadow accepts a fixed set of keys for each provider and checks their types: * `daytona`: `spot`, `public`, `ephemeral`, `kvm` (booleans), `target`, `user` (strings), `language` (`python`, `javascript`, or `typescript`). * `modal`: `cloud` (string), `regions` (array of strings), `runtime` (`gvisor` or `vm`), `burst` (boolean). With `burst` true, `resources.cpu` and `resources.memory_mb` are only reserved and the sandbox may use more, as Modal's own default does. Left out or false, they are hard limits. Any other key returns 400, whichever provider would have served the request. The same check runs when a project is created or patched with `routing.sandboxes.options`, and that 400 names the project field. A setting that Meadow controls itself, such as the name, image, timeouts, or network rules, cannot be set here.

### Attempt

One try at one vendor, for a model call or a sandbox create.

- `provider` (enum, required) — The name of a vendor. Model providers and sandbox providers share one list. Model providers: `anthropic`, `openai`, `google`, `xai`, `azure`, `bedrock`, `vertex`, `openrouter`, `fireworks`, `deepseek`. Sandbox providers: `daytona`, `modal`.
  - Allowed values: `anthropic`, `openai`, `google`, `xai`, `azure`, `bedrock`, `vertex`, `openrouter`, `fireworks`, `deepseek`, `daytona`, `modal`
- `outcome` (enum, required) — How the try ended. - `served`: this vendor served the request. - `unsupported`: the vendor cannot do what was asked, such as a resource size, a network rule, or a model it does not offer. - `refused`: the vendor rejected the request or the stored credential. - `no_capacity`: the vendor had no capacity. - `timeout`: the vendor did not answer in time. - `rate_limited`: the vendor answered 429. - `error`: any other failure.
  - Allowed values: `served`, `unsupported`, `refused`, `no_capacity`, `timeout`, `rate_limited`, `error`
- `reason` (enum, optional) — A stable code for why the try ended as it did. It is narrower than `outcome`, and it is the code to branch on or to count. More values can be added: treat one you do not know like `vendor_error`. - `served`: this vendor served the request. - `no_capacity`: the vendor had no capacity. - `quota_exceeded`: the vendor account is out of quota or credit. - `rate_limited`: the vendor answered 429. - `timeout`: the vendor did not answer in time. - `auth_failed`: the vendor rejected the stored vendor key. - `invalid_request`: the vendor rejected the request itself. - `refused`: the vendor refused for another reason. - `unsupported`: the vendor cannot do what was asked, such as a model, a GPU type, a size or a network rule. - `no_provider_key`: skipped, because no usable vendor key was stored. - `image_pull_failed`, `build_failed`: the vendor could not pull or build the image (sandboxes). - `provider_lost`: the vendor lost the sandbox while it was starting. - `vendor_error`: any other failure.
  - Allowed values: `served`, `no_capacity`, `quota_exceeded`, `rate_limited`, `timeout`, `auth_failed`, `invalid_request`, `refused`, `unsupported`, `no_provider_key`, `image_pull_failed`, `build_failed`, `provider_lost`, `vendor_error`
- `started_at` (datetime, optional) — When Meadow started this try. Absent on attempts recorded before 2026-11-24.
- `finished_at` (datetime, optional) — When this try ended.
- `detail` (string, optional) — A short description of what happened, written by Meadow, such as `provider returned HTTP 404`. On a `served` sandbox attempt it reports resources the vendor granted that differ from the request, such as `provider granted cpu 2 instead of 1.5` or `gpu type H200 instead of H100`. It says `provider built a copy of the image for this size` when this create made a new Daytona snapshot for an `image_id`. On an `unsupported` attempt it carries the vendor's size limit, such as `daytona cannot serve this size: CPU request 8 exceeds maximum allowed per sandbox (4)`. Absent when there is nothing to say.
- `duration_ms` (integer, optional) — How long the try took, in milliseconds.

### SkippedProvider

One provider that Meadow moved to the end of a sandbox create's route, and why.

- `provider` (enum, required)
  - Allowed values: `daytona`, `modal`
- `reason` (string, required) — The attempt reason that opened the provider's breaker, as in `attempts[].reason`: `quota_exceeded`, `no_capacity`, `rate_limited`, `timeout` or `vendor_error`. More values can be added. A route you set with `provider.order` or the project's `routing.sandboxes.order` is tried as written unless the first provider is open on a hard signal: the vendor answered `quota_exceeded` or `no_capacity` for this account, or 3 creates in a row failed with `timeout` or `vendor_error` within 10 minutes. A route with no order (Meadow's default, or `provider.only` alone) moves any open provider back, `rate_limited` included.
- `health_state` (string, required) — The breaker state when the provider was moved, as in `sandbox_health.state`: `open` or `half_open`.
- `consecutive_failures` (integer, required) — Failed creates in the run that opened the breaker.
- `skipped_at` (datetime, required) — When Meadow moved the provider.
- `retry_at` (datetime, optional, nullable) — When the breaker lets a create try the provider again.

### NetworkRules

Outbound network rules. With `block_all` false and both lists empty, outbound traffic is open. `block_all` cannot be combined with the allow lists.

- `block_all` (boolean, optional, default: false) — Block all outbound traffic.
- `allow_domains` (list of string, optional) — Allow outbound traffic only to these host names. Each may start with one wildcard label, such as `*.example.com`. IP addresses, ports, schemes, paths and wildcards elsewhere return 400. Use `allow_cidrs` for addresses. Meadow sends each entry to the vendor as written, and the vendor applies it. On Daytona and on Modal, `*.example.com` covers every subdomain and also `example.com` itself, and a plain name does not cover its subdomains. What an allowed name opens differs by vendor. On Daytona it opens the name on ports 80, 443 and 22 (other ports not checked). On Modal it opens TLS on port 443 only, and plain HTTP on port 80 is refused. An `https://` URL that redirects to `http://` therefore works on Daytona and fails on Modal. Seen on both vendors on 2026-11-27.
- `allow_cidrs` (list of string, optional) — Allow outbound traffic only to these CIDR ranges, such as `203.0.113.0/24`.

### SandboxCost

What this sandbox costs at the vendor, so far. Returned by `GET /v1/sandboxes/{sandbox_id}` and `GET /v1/sandboxes`, and left out of the other sandbox responses. It is read from the usage records with the same arithmetic as `GET /v1/usage`, so the two agree: this object covers every vendor sandbox the create started, a provider that Meadow moved on from included, and its `cost` is what `sandbox_cost` in `/v1/usage` adds up for this sandbox over its whole life. It is a list price times time, not the vendor's invoice. `cost_status` says how far to trust it: * `price_table`: the size the vendor granted times its list price. * `price_estimated`: an estimate. `cost_reason` says why: `grant_unconfirmed` (the vendor has not yet confirmed the size, so the size asked for is priced), `spot_unconfirmed`, or `meadow_clock` (the sandbox has ended and its time is still Meadow's own count, which runs longer than the vendor's: Meadow has not yet read the time the vendor billed), or `vendor_window_unavailable` (the same, and Meadow can no longer read that time: the account stores no key for the vendor, or the sandbox ended more than 4 days ago). A reason about the price is shown before either when both apply. * `price_unknown`: no cost can be stated, and `cost` is null. Unknown never means free. `cost_reason` is `not_recorded` when no usage record exists yet (records are written about once a minute, and a create that never reached a vendor has none), or the reason the price table gives, such as a GPU type or a shape it has no price for. A create the vendor refused before it made a sandbox has a record that costs 0.

- `currency` (string, required) — The currency of `cost_per_hour` and `cost`.
- `cost_status` (enum, required) — How the cost was reached. See above.
  - Allowed values: `price_table`, `price_estimated`, `price_unknown`
- `cost_per_hour` (double, optional, nullable) — The hourly list price of the vendor sandbox that serves this sandbox, or last served it. Null when no vendor sandbox served it or its price is unknown.
- `cost` (double, optional, nullable) — The cost so far across every vendor sandbox this create started. Null when `cost_status` is `price_unknown`.
- `cost_reason` (string, optional, nullable) — Why the cost is unknown or an estimate. Null with `price_table`.
- `billed_from` (datetime, optional, nullable) — When the first vendor sandbox of this create began to count: the moment Meadow asked the vendor for it. Null when there is no usage record.
- `billed_to` (datetime, optional, nullable) — When the last vendor sandbox stopped counting: the vendor confirmed it gone, or its own lifetime ended. Null while any is still counting. A deleted sandbox keeps counting, for up to about a minute, until the next usage record is written. `cost` is final once this is set and `cost_reason` is neither `meadow_clock` nor `vendor_window_unavailable`: Meadow reads the time the vendor billed 2 minutes after the end, then again with a wait that doubles, for 4 days.
- `billed_seconds` (double, optional) — Seconds counted so far, added over the vendor sandboxes. It is `sandbox_seconds` in `GET /v1/usage` for this sandbox.

### ErrorError

- `type` (enum, required) — The class of the failure. - `invalid_request`: the request is malformed or breaks a rule (400), or is too large (413). - `conflict`: the request is valid and the current state refuses it (409). Before 2026-11-24 a 409 used `invalid_request`. - `unauthorized`: the key is missing, unknown, revoked, or expired (401). - `forbidden`: the key's scope or limit does not allow this, or the project's routing is locked (403). - `not_found`: no such resource or route (404). - `no_provider_key`: no stored credential can serve this request (422). - `all_providers_failed`: every vendor in the route was tried (502). - `provider_error`: a vendor failed and no fallback was possible (502). - `rate_limited`: too many requests (429). - `insufficient_quota`: a dollar `limit` on the key, or on a key above it, is spent (402). The name is OpenAI's. - `unavailable`: a dependency Meadow needs is not set up (503). - `internal`: Meadow failed (500), or the feature is not set up (501).
  - Allowed values: `invalid_request`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `no_provider_key`, `all_providers_failed`, `provider_error`, `rate_limited`, `insufficient_quota`, `unavailable`, `internal`
- `message` (string, required) — A sentence for people. It can change, so do not match on it.
- `code` (string, optional) — A stable name for the specific failure. Every Meadow error carries one. `type` stays the general class, and several codes share a type. Branch on `code` when you need to tell two failures of one type apart, for example `api_key_expired` from `api_key_revoked`. The full list is in the Errors guide. A new code can be added at any time, so treat a code you do not know as its `type`. A spent limit (`key_request_limit_exceeded`, `key_token_limit_exceeded`) stays a 403 and not a 429, so a client that retries a 429 does not resend a call a spent key can never make. A spent dollar `limit` (`key_spend_limit_exceeded`) is a 402 for the same reason.
- `param` (string, optional) — The request field, query parameter or header the error is about, when there is one. A nested field is written with dots, such as `credentials.api_key`. Set on most validation errors (400).
- `attempts` (list of Attempt, optional) — The vendors Meadow tried for this request, in order. Present only when it tried at least one.
- `retry` (enum, optional) — Whether to send the same request again. Set on routes under `/v1/sandboxes` only. The values are BoxRouter's (https://boxrouter.ai/docs/error-codes). - `safe`: send the same request again, after `retry-after` seconds when the response has that header. A 429, a 409 `exec_start_in_progress` or `idempotency_request_in_progress`, a 502 `sandbox_unreachable`, and a 5xx on a `GET`, `PUT` or `DELETE`, on `POST /v1/sandboxes/route`, or on a sandbox create or background command start sent with `Idempotency-Key`. - `after_fix`: change the request, the key or the account first. Any other 4xx. - `check_outcome`: read the sandbox or the command before you send it again, because the work may have happened. A 5xx on any other `POST`, which includes a blocking command. - `never`: do not send it again. A 501. When the response has `x-should-retry`, `retry` is `safe` exactly when the header is `true`.
  - Allowed values: `safe`, `after_fix`, `check_outcome`, `never`
- `outcome` (enum, optional) — What happened to the work. Set on routes under `/v1/sandboxes` only. The values are BoxRouter's (https://boxrouter.ai/docs/error-codes). - `not_started`: nothing was changed. Every 4xx, a 501, and a 502 `sandbox_unreachable`. - `unknown`: the work may have happened. Any other 5xx. - `completed` and `partial`: the work happened, in whole or in part. Meadow does not send them today. Handle them as `unknown`. A sandbox create that fails after Meadow accepted it is not an error response: the create returns 202, and the sandbox later has `status` `failed` and a `failure_reason`.
  - Allowed values: `not_started`, `completed`, `partial`, `unknown`

### ResourcesGpu

Ask for GPUs. Left out, the sandbox has none.

- `type` (list of string, optional) — GPU models in order of preference. Required and not empty when `gpu` is sent. A provider that offers none of them is skipped with an `unsupported` attempt. Names are matched without case, and `_` or a space counts as `-`. A name no provider offers returns 400. - Daytona offers `H100`, `H200`, `B200`, `B300`, `L40S`, `RTX-PRO-6000`, `RTX-4090`, `RTX-5090` and `MI355X`. It takes the first name with free capacity. - Modal offers `T4`, `L4`, `A10`, `A100`, `A100-40GB`, `A100-80GB`, `L40S`, `RTX-PRO-6000`, `H100`, `H200`, `B200`, `B200+` and `B300`. It takes the first name it offers and does not try the next one when that type has no capacity. A name may end in `!`, which means exactly this type, such as `H100!`. Modal may place a plain `H100` on an H200 and a plain `A100` on an 80 GB A100. With `!` it does not: `H100!` is sent to Modal as written and `A100!` is sent as `A100-40GB`. For every other type the mark changes nothing, because the vendors already place exactly that type. Daytona has no such mark and gets the name without it. `B200+` means a B200 or a B300: Modal chooses, and Daytona takes whichever of the two has free capacity, B200 first. The sandbox returns the names as you wrote them. When the vendor placed a different type than the first one asked for, the served attempt's `detail` says so.
- `count` (integer, optional, default: 1) — How many GPUs, at least 1.

## Examples

### Returned at once, without wait

**Response**

```json
{
  "id": "sbx_000038c2",
  "project_id": "prj_000057e9",
  "status": "creating",
  "created_at": "2026-11-23T22:20:18.291Z",
  "name": "agent-run",
  "provider": null,
  "provider_sandbox_id": null,
  "attempts": [],
  "resources": {
    "cpu": 1,
    "memory_mb": 1024
  },
  "labels": {
    "owner": "evals",
    "purpose": "docs"
  },
  "ports": [
    8000
  ],
  "ssh": true,
  "started_at": null,
  "expires_at": null,
  "terminated_at": null
}
```

**SDK Code**

```python Returned at once, without wait
import requests

url = "https://api.example.com/v1/sandboxes"

querystring = {"wait":"true","wait_timeout_seconds":"300"}

headers = {
    "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Returned at once, without wait
const url = 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': '00000000-0000-0000-0000-000000007779',
    Authorization: 'Bearer <token>'
  }
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Returned at once, without wait
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Returned at once, without wait
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '00000000-0000-0000-0000-000000007779'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Returned at once, without wait
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")
  .header("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Returned at once, without wait
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Idempotency-Key' => '00000000-0000-0000-0000-000000007779',
  ],
]);

echo $response->getBody();
```

```csharp Returned at once, without wait
using RestSharp;

var client = new RestClient("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "00000000-0000-0000-0000-000000007779");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Returned at once, without wait
import Foundation

let headers = [
  "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### With wait=true, from a built image on Modal

**Response**

```json
{
  "id": "sbx_0000c335",
  "project_id": "prj_000057e9",
  "status": "running",
  "created_at": "2026-11-23T22:22:08.963Z",
  "name": "agent-run-2",
  "provider": "modal",
  "provider_sandbox_id": "sb-000000FAB9",
  "attempts": [
    {
      "provider": "modal",
      "outcome": "served",
      "duration_ms": 291
    }
  ],
  "resources": {
    "cpu": 2,
    "memory_mb": 4096
  },
  "labels": {},
  "ports": [
    8000
  ],
  "ssh": false,
  "started_at": "2026-11-23T22:22:09.435Z",
  "expires_at": "2026-11-23T22:32:09.435Z",
  "terminated_at": null
}
```

**SDK Code**

```python With wait=true, from a built image on Modal
import requests

url = "https://api.example.com/v1/sandboxes"

querystring = {"wait":"true","wait_timeout_seconds":"300"}

headers = {
    "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers, params=querystring)

print(response.json())
```

```javascript With wait=true, from a built image on Modal
const url = 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': '00000000-0000-0000-0000-000000007779',
    Authorization: 'Bearer <token>'
  }
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go With wait=true, from a built image on Modal
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby With wait=true, from a built image on Modal
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '00000000-0000-0000-0000-000000007779'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java With wait=true, from a built image on Modal
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")
  .header("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php With wait=true, from a built image on Modal
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Idempotency-Key' => '00000000-0000-0000-0000-000000007779',
  ],
]);

echo $response->getBody();
```

```csharp With wait=true, from a built image on Modal
using RestSharp;

var client = new RestClient("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "00000000-0000-0000-0000-000000007779");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift With wait=true, from a built image on Modal
import Foundation

let headers = [
  "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### With wait=true, when no vendor could start the image

**Response**

```json
{
  "id": "sbx_0000f0aa",
  "project_id": "prj_000057e9",
  "status": "failed",
  "created_at": "2026-11-23T22:23:30.813Z",
  "name": "agent-run-4",
  "failure_reason": "all_providers_failed",
  "provider": null,
  "provider_sandbox_id": null,
  "attempts": [
    {
      "provider": "daytona",
      "outcome": "error",
      "detail": "provider failed to build image",
      "duration_ms": 11887
    },
    {
      "provider": "modal",
      "outcome": "error",
      "detail": "provider request failed",
      "duration_ms": 1340
    }
  ],
  "resources": {
    "cpu": 2,
    "memory_mb": 4096
  },
  "labels": {},
  "ports": [],
  "ssh": false,
  "started_at": null,
  "expires_at": null,
  "terminated_at": null
}
```

**SDK Code**

```python With wait=true, when no vendor could start the image
import requests

url = "https://api.example.com/v1/sandboxes"

querystring = {"wait":"true","wait_timeout_seconds":"300"}

headers = {
    "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers, params=querystring)

print(response.json())
```

```javascript With wait=true, when no vendor could start the image
const url = 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': '00000000-0000-0000-0000-000000007779',
    Authorization: 'Bearer <token>'
  }
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go With wait=true, when no vendor could start the image
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby With wait=true, when no vendor could start the image
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '00000000-0000-0000-0000-000000007779'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java With wait=true, when no vendor could start the image
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")
  .header("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php With wait=true, when no vendor could start the image
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Idempotency-Key' => '00000000-0000-0000-0000-000000007779',
  ],
]);

echo $response->getBody();
```

```csharp With wait=true, when no vendor could start the image
using RestSharp;

var client = new RestClient("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "00000000-0000-0000-0000-000000007779");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift With wait=true, when no vendor could start the image
import Foundation

let headers = [
  "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### A registry image with a port, SSH, and labels

**Request**

```json
{
  "name": "agent-run",
  "image": "python:3.12-slim",
  "resources": {
    "cpu": 1,
    "memory_mb": 1024
  },
  "env": {
    "GREETING": "hello"
  },
  "timeout_seconds": 1800,
  "idle_timeout_seconds": 900,
  "ports": [
    8000
  ],
  "ssh": true,
  "labels": {
    "owner": "evals",
    "purpose": "docs"
  }
}
```

**Response**

```json
{
  "id": "sbx_000038c2",
  "project_id": "prj_000057e9",
  "status": "creating",
  "created_at": "2026-11-23T22:20:18.291Z",
  "name": "agent-run",
  "provider": null,
  "provider_sandbox_id": null,
  "attempts": [],
  "resources": {
    "cpu": 1,
    "memory_mb": 1024
  },
  "labels": {
    "owner": "evals",
    "purpose": "docs"
  },
  "ports": [
    8000
  ],
  "ssh": true,
  "started_at": null,
  "expires_at": null,
  "terminated_at": null
}
```

**SDK Code**

```python A registry image with a port, SSH, and labels
import requests

url = "https://api.example.com/v1/sandboxes"

querystring = {"wait":"true","wait_timeout_seconds":"300"}

payload = {
    "name": "agent-run",
    "image": "python:3.12-slim",
    "resources": {
        "cpu": 1,
        "memory_mb": 1024
    },
    "env": { "GREETING": "hello" },
    "timeout_seconds": 1800,
    "idle_timeout_seconds": 900,
    "ports": [8000],
    "ssh": True,
    "labels": {
        "owner": "evals",
        "purpose": "docs"
    }
}
headers = {
    "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript A registry image with a port, SSH, and labels
const url = 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': '00000000-0000-0000-0000-000000007779',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"agent-run","image":"python:3.12-slim","resources":{"cpu":1,"memory_mb":1024},"env":{"GREETING":"hello"},"timeout_seconds":1800,"idle_timeout_seconds":900,"ports":[8000],"ssh":true,"labels":{"owner":"evals","purpose":"docs"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go A registry image with a port, SSH, and labels
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300"

	payload := strings.NewReader("{\n  \"name\": \"agent-run\",\n  \"image\": \"python:3.12-slim\",\n  \"resources\": {\n    \"cpu\": 1,\n    \"memory_mb\": 1024\n  },\n  \"env\": {\n    \"GREETING\": \"hello\"\n  },\n  \"timeout_seconds\": 1800,\n  \"idle_timeout_seconds\": 900,\n  \"ports\": [\n    8000\n  ],\n  \"ssh\": true,\n  \"labels\": {\n    \"owner\": \"evals\",\n    \"purpose\": \"docs\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby A registry image with a port, SSH, and labels
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '00000000-0000-0000-0000-000000007779'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"agent-run\",\n  \"image\": \"python:3.12-slim\",\n  \"resources\": {\n    \"cpu\": 1,\n    \"memory_mb\": 1024\n  },\n  \"env\": {\n    \"GREETING\": \"hello\"\n  },\n  \"timeout_seconds\": 1800,\n  \"idle_timeout_seconds\": 900,\n  \"ports\": [\n    8000\n  ],\n  \"ssh\": true,\n  \"labels\": {\n    \"owner\": \"evals\",\n    \"purpose\": \"docs\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java A registry image with a port, SSH, and labels
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")
  .header("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"agent-run\",\n  \"image\": \"python:3.12-slim\",\n  \"resources\": {\n    \"cpu\": 1,\n    \"memory_mb\": 1024\n  },\n  \"env\": {\n    \"GREETING\": \"hello\"\n  },\n  \"timeout_seconds\": 1800,\n  \"idle_timeout_seconds\": 900,\n  \"ports\": [\n    8000\n  ],\n  \"ssh\": true,\n  \"labels\": {\n    \"owner\": \"evals\",\n    \"purpose\": \"docs\"\n  }\n}")
  .asString();
```

```php A registry image with a port, SSH, and labels
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300', [
  'body' => '{
  "name": "agent-run",
  "image": "python:3.12-slim",
  "resources": {
    "cpu": 1,
    "memory_mb": 1024
  },
  "env": {
    "GREETING": "hello"
  },
  "timeout_seconds": 1800,
  "idle_timeout_seconds": 900,
  "ports": [
    8000
  ],
  "ssh": true,
  "labels": {
    "owner": "evals",
    "purpose": "docs"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => '00000000-0000-0000-0000-000000007779',
  ],
]);

echo $response->getBody();
```

```csharp A registry image with a port, SSH, and labels
using RestSharp;

var client = new RestClient("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "00000000-0000-0000-0000-000000007779");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"agent-run\",\n  \"image\": \"python:3.12-slim\",\n  \"resources\": {\n    \"cpu\": 1,\n    \"memory_mb\": 1024\n  },\n  \"env\": {\n    \"GREETING\": \"hello\"\n  },\n  \"timeout_seconds\": 1800,\n  \"idle_timeout_seconds\": 900,\n  \"ports\": [\n    8000\n  ],\n  \"ssh\": true,\n  \"labels\": {\n    \"owner\": \"evals\",\n    \"purpose\": \"docs\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift A registry image with a port, SSH, and labels
import Foundation

let headers = [
  "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "agent-run",
  "image": "python:3.12-slim",
  "resources": [
    "cpu": 1,
    "memory_mb": 1024
  ],
  "env": ["GREETING": "hello"],
  "timeout_seconds": 1800,
  "idle_timeout_seconds": 900,
  "ports": [8000],
  "ssh": true,
  "labels": [
    "owner": "evals",
    "purpose": "docs"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### An image you built, on one vendor, with an outbound allowlist

**Request**

```json
{
  "name": "agent-run-2",
  "image_id": "img_0000a8c8",
  "timeout_seconds": 600,
  "ports": [
    8000
  ],
  "network": {
    "allow_domains": [
      "pypi.org",
      "*.pythonhosted.org"
    ]
  },
  "provider": {
    "only": [
      "modal"
    ],
    "options": {
      "modal": {
        "regions": [
          "us-east"
        ]
      }
    }
  }
}
```

**Response**

```json
{
  "id": "sbx_000038c2",
  "project_id": "prj_000057e9",
  "status": "creating",
  "created_at": "2026-11-23T22:20:18.291Z",
  "name": "agent-run",
  "provider": null,
  "provider_sandbox_id": null,
  "attempts": [],
  "resources": {
    "cpu": 1,
    "memory_mb": 1024
  },
  "labels": {
    "owner": "evals",
    "purpose": "docs"
  },
  "ports": [
    8000
  ],
  "ssh": true,
  "started_at": null,
  "expires_at": null,
  "terminated_at": null
}
```

**SDK Code**

```python An image you built, on one vendor, with an outbound allowlist
import requests

url = "https://api.example.com/v1/sandboxes"

querystring = {"wait":"true","wait_timeout_seconds":"300"}

payload = {
    "name": "agent-run-2",
    "image_id": "img_0000a8c8",
    "timeout_seconds": 600,
    "ports": [8000],
    "network": { "allow_domains": ["pypi.org", "*.pythonhosted.org"] },
    "provider": {
        "only": ["modal"],
        "options": { "modal": { "regions": ["us-east"] } }
    }
}
headers = {
    "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript An image you built, on one vendor, with an outbound allowlist
const url = 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300';
const options = {
  method: 'POST',
  headers: {
    'Idempotency-Key': '00000000-0000-0000-0000-000000007779',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"agent-run-2","image_id":"img_0000a8c8","timeout_seconds":600,"ports":[8000],"network":{"allow_domains":["pypi.org","*.pythonhosted.org"]},"provider":{"only":["modal"],"options":{"modal":{"regions":["us-east"]}}}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go An image you built, on one vendor, with an outbound allowlist
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300"

	payload := strings.NewReader("{\n  \"name\": \"agent-run-2\",\n  \"image_id\": \"img_0000a8c8\",\n  \"timeout_seconds\": 600,\n  \"ports\": [\n    8000\n  ],\n  \"network\": {\n    \"allow_domains\": [\n      \"pypi.org\",\n      \"*.pythonhosted.org\"\n    ]\n  },\n  \"provider\": {\n    \"only\": [\n      \"modal\"\n    ],\n    \"options\": {\n      \"modal\": {\n        \"regions\": [\n          \"us-east\"\n        ]\n      }\n    }\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby An image you built, on one vendor, with an outbound allowlist
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '00000000-0000-0000-0000-000000007779'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"agent-run-2\",\n  \"image_id\": \"img_0000a8c8\",\n  \"timeout_seconds\": 600,\n  \"ports\": [\n    8000\n  ],\n  \"network\": {\n    \"allow_domains\": [\n      \"pypi.org\",\n      \"*.pythonhosted.org\"\n    ]\n  },\n  \"provider\": {\n    \"only\": [\n      \"modal\"\n    ],\n    \"options\": {\n      \"modal\": {\n        \"regions\": [\n          \"us-east\"\n        ]\n      }\n    }\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java An image you built, on one vendor, with an outbound allowlist
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")
  .header("Idempotency-Key", "00000000-0000-0000-0000-000000007779")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"agent-run-2\",\n  \"image_id\": \"img_0000a8c8\",\n  \"timeout_seconds\": 600,\n  \"ports\": [\n    8000\n  ],\n  \"network\": {\n    \"allow_domains\": [\n      \"pypi.org\",\n      \"*.pythonhosted.org\"\n    ]\n  },\n  \"provider\": {\n    \"only\": [\n      \"modal\"\n    ],\n    \"options\": {\n      \"modal\": {\n        \"regions\": [\n          \"us-east\"\n        ]\n      }\n    }\n  }\n}")
  .asString();
```

```php An image you built, on one vendor, with an outbound allowlist
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300', [
  'body' => '{
  "name": "agent-run-2",
  "image_id": "img_0000a8c8",
  "timeout_seconds": 600,
  "ports": [
    8000
  ],
  "network": {
    "allow_domains": [
      "pypi.org",
      "*.pythonhosted.org"
    ]
  },
  "provider": {
    "only": [
      "modal"
    ],
    "options": {
      "modal": {
        "regions": [
          "us-east"
        ]
      }
    }
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => '00000000-0000-0000-0000-000000007779',
  ],
]);

echo $response->getBody();
```

```csharp An image you built, on one vendor, with an outbound allowlist
using RestSharp;

var client = new RestClient("https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "00000000-0000-0000-0000-000000007779");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"agent-run-2\",\n  \"image_id\": \"img_0000a8c8\",\n  \"timeout_seconds\": 600,\n  \"ports\": [\n    8000\n  ],\n  \"network\": {\n    \"allow_domains\": [\n      \"pypi.org\",\n      \"*.pythonhosted.org\"\n    ]\n  },\n  \"provider\": {\n    \"only\": [\n      \"modal\"\n    ],\n    \"options\": {\n      \"modal\": {\n        \"regions\": [\n          \"us-east\"\n        ]\n      }\n    }\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift An image you built, on one vendor, with an outbound allowlist
import Foundation

let headers = [
  "Idempotency-Key": "00000000-0000-0000-0000-000000007779",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "agent-run-2",
  "image_id": "img_0000a8c8",
  "timeout_seconds": 600,
  "ports": [8000],
  "network": ["allow_domains": ["pypi.org", "*.pythonhosted.org"]],
  "provider": [
    "only": ["modal"],
    "options": ["modal": ["regions": ["us-east"]]]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.example.com/v1/sandboxes?wait=true&wait_timeout_seconds=300")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```