Skip to navigation

Sandboxes

A sandbox is a container that Meadow starts for you at Daytona or Modal, using the provider key you stored. You create it, run commands in it, copy files in and out, and delete it. The calls are the same on both providers.

Next step: create one sandbox with the request below, then go to Running commands. For a whole job from start to finish, see Run untrusted code and Run a coding agent in a sandbox.

You need a key with the sandboxes scope and a stored daytona or modal key. See Provider keys. Every sample uses two variables:

export MEADOW_BASE_URL="https://api.usemeadow.ai"
export MEADOW_API_KEY="mdw_..."

Create a sandbox

curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes" \
-H "Authorization: Bearer $MEADOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "hello",
"image": "python:3.12-slim",
"timeout_seconds": 600,
"labels": {"team": "docs"},
"provider": {"only": ["daytona"]}
}'

The response is 202 and comes back at once, in about 0.3 seconds:

{
"attempts": [],
"created_at": "2026-11-23T22:18:43.619Z",
"expires_at": null,
"failure_reason": null,
"id": "sbx_0000cff0",
"labels": {"team": "docs"},
"name": "hello",
"network": {"allow_cidrs": [], "allow_domains": [], "block_all": false},
"ports": [],
"project_id": "prj_00009122",
"provider": null,
"provider_sandbox_id": null,
"resources": {"cpu": 2, "memory_mb": 4096},
"ssh": false,
"started_at": null,
"status": "creating",
"terminated_at": null
}

Poll until status leaves creating:

curl -sS "$MEADOW_BASE_URL/v1/sandboxes/sbx_0000cff0" \
-H "Authorization: Bearer $MEADOW_API_KEY"
{
"attempts": [{"duration_ms": 2241, "outcome": "served", "provider": "daytona"}],
"expires_at": "2026-11-23T22:28:46.077Z",
"id": "sbx_0000cff0",
"provider": "daytona",
"provider_sandbox_id": "000021ca",
"started_at": "2026-11-23T22:18:46.077Z",
"status": "running"
}

In our runs a stock image was running 2 to 3 seconds after the create on Daytona and about 1 second after it on Modal.

Wait in the same request

Add ?wait=true to hold the request until the sandbox is running or failed:

curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes?wait=true&wait_timeout_seconds=120" \
-H "Authorization: Bearer $MEADOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"image": "python:3.12-slim", "timeout_seconds": 900, "provider": {"only": ["modal"]}}'

wait_timeout_seconds defaults to 300 and can be at most 900. When the wait ends first, you get the sandbox still in creating, and it keeps starting.

The status code is 202 in every case, including a sandbox that already reads running or failed. Read status, never the status code.

Fields

Send exactly one of image and image_id. Everything else is optional.

FieldMeaning
imageA registry image, such as python:3.12-slim.
image_idAn image you built with Meadow. See Images and build contexts.
registry_authusername and password for a private image. Modal only.
nameAny text. It does not have to be unique.
labelsYour own key and value pairs. You can filter the list by them.
envEnvironment variables for every command in the sandbox.
resourcescpu, memory_mb, disk_mb, gpu. See Resources.
timeout_secondsLongest lifetime. Default 3600, at most 86400.
idle_timeout_secondsEnd the sandbox after this long with no activity. Off by default.
portsPorts to reach from outside. See Files, ports, and SSH.
sshtrue to allow SSH logins.
networkOutbound rules. See Network rules.
providerWhich provider hosts it. See Choose Daytona or Modal.
webhook_urlWhere to send this sandbox’s events. See Webhooks.

There is no field for the command the sandbox runs. The sandbox runs the image’s own default command and you start your work with exec. On Modal the sandbox ends if that default command exits, so use an image whose command keeps running, such as CMD ["sleep", "infinity"]. python:3.12-slim, ubuntu:24.04, and alpine:3.20 all stayed up on Modal in our runs.

Everything except the network rules is fixed at create, the two timeouts included. You cannot add a port or extend the lifetime later. The one change a running sandbox takes is a new set of network rules: see Network rules. Choose timeout_seconds for the whole job, and add idle_timeout_seconds if you want an unused sandbox to end early.

A field Meadow does not know returns 400:

{"error":{"code":"parameter_unknown","message":"unknown field in sandbox create request","param":"cmd","type":"invalid_request"},"request_id":"req_0000d7ea"}

Statuses and the lifecycle

StatusMeaning
creatingMeadow is asking a provider for the sandbox.
runningYou can run commands and copy files.
terminatingA delete or a timeout has started and the provider has not confirmed yet.
terminatedGone, by your delete, a timeout, the provider’s own lifetime limit, or a spent dollar limit with limit_action stop_sandboxes.
failedIt never started, or the provider lost it. failure_reason says which.

creating leads to running or failed. running leads to terminating and then terminated, or to failed if the provider loses the sandbox. terminated and failed are final, with one exception: deleting a failed sandbox moves it to terminated. It keeps its failure_reason and gains a terminated_at, so code that counts failures after cleanup should read failure_reason. Meadow keeps the record, so a GET on a finished sandbox still answers 200.

Any call that needs a live sandbox (exec, files, ports, SSH) returns 409 in every other status:

{"error":{"code":"conflict","message":"sandbox is not running","type":"conflict"},"request_id":"req_00002a1a"}

You can watch the lifecycle with webhooks and skip the polling.

Attempts and failure reasons

Each provider Meadow tries is recorded in attempts, in order. An attempt has a provider, an outcome, often a detail, and a duration_ms. It also has a reason (a stable code such as quota_exceeded, auth_failed or served), a started_at and a finished_at: branch on outcome and reason, never on the text of detail. An attempt recorded by an older server build can lack those three fields.

Create is asynchronous. A create that no provider could serve still returns 202, with status failed and no error object: the failure is on the sandbox, in failure_reason and in attempts. Always read status after a create, also with ?wait=true.

OutcomeMeaning
servedThis provider hosts the sandbox.
unsupportedThe provider cannot meet the request. Meadow did not ask it.
refusedThe provider rejected the request, for example a bad credential.
no_capacityThe provider had no room.
rate_limitedThe provider throttled the request.
timeoutThe provider missed create_timeout_seconds, or the 120 second wait on a provider that is not the last (see When a provider is failing).
errorAnything else, including an image the provider could not pull or build.

This request asks for a rule Daytona cannot apply, so Meadow moved on to Modal:

curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes?wait=true" \
-H "Authorization: Bearer $MEADOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image": "python:3.12-slim",
"timeout_seconds": 300,
"network": {"allow_domains": ["pypi.org"], "allow_cidrs": ["1.1.1.1/32"]},
"provider": {"order": ["daytona", "modal"]}
}'
{
"id": "sbx_0000a780",
"status": "running",
"provider": "modal",
"attempts": [
{"detail": "daytona cannot combine allow_domains and allow_cidrs", "outcome": "unsupported", "provider": "daytona"},
{"duration_ms": 320, "outcome": "served", "provider": "modal"}
]
}

When no provider serves the request, the sandbox is failed. failure_reason is one of:

failure_reasonMeaning
all_providers_failedEvery provider in the route was tried or skipped. Read attempts.
build_failedEvery attempt failed while building or pulling the image.
image_pull_failedEvery attempt failed to pull the image.
timeoutEvery attempt timed out.
provider_lostThe sandbox was running and the provider no longer has it.
internalMeadow failed. Report it.

A misspelled image name is the failure you are most likely to meet, and the message does not name it. With "image": "python:3.12-slimm":

{
"status": "failed",
"failure_reason": "all_providers_failed",
"attempts": [
{"detail": "provider failed to build image", "duration_ms": 7252, "outcome": "error", "provider": "daytona"},
{"detail": "provider request failed", "duration_ms": 1583, "outcome": "error", "provider": "modal"}
]
}

With Daytona alone the same request reads build_failed. With Modal alone it reads all_providers_failed. When a create fails with one of these two details, check the image name and tag first, then check that the provider can pull the image without a login.

A failed create still answers 202. The failure is in the body.

Choose Daytona or Modal

The provider object on the request decides which provider hosts the sandbox.

FieldMeaning
orderProviders to try, in this order. Default is the project’s order, then ["daytona", "modal"].
onlyProviders that are allowed. Others are never tried.
allow_fallbacksfalse tries the first provider only. Default true.
create_timeout_secondsHow long to wait on one provider before the next, at most 3600. When it is not set: 300 on the last provider in the route and 120 on an earlier one (see When a provider is failing). Before 2026-11-27 the hosted beta cut the provider’s create call at 30 seconds whatever this said (seen on 2026-11-24 with a Daytona H100 create).
sortprice or latency: order the vendors by a measure instead of by order. See Sort by price or start time.
optionsProvider settings. See Provider options.

A provider you have no stored key for is skipped. A provider that cannot meet the request is recorded as unsupported and Meadow moves to the next one. Fallback happens at create only. A running sandbox never moves.

Reasons to pick one provider:

You needUse
A private registry image (registry_auth)Modal
allow_domains and allow_cidrs togetherModal
Inbound ports or SSH with block_allDaytona
More than 2 CPU or 4 GiB on a built image_idModal
A hard CPU and memory limitDaytona
A lifetime under 10 secondsDaytona
A pinned SSH host keyModal

With allow_fallbacks: false the request above fails, because Daytona is first and cannot serve it:

{
"status": "failed",
"failure_reason": "all_providers_failed",
"attempts": [
{"detail": "daytona cannot combine allow_domains and allow_cidrs", "outcome": "unsupported", "provider": "daytona"}
]
}

When the route has no usable provider at all, the create is rejected with 422 and no sandbox is recorded:

{"error":{"code":"no_provider_key","message":"no sandbox provider is allowed by routing policy","type":"no_provider_key"},"request_id":"req_00005259"}

When a provider is failing

Meadow remembers recent create failures per provider, for your account.

  • After 3 failed creates in a row on one provider within 10 minutes (a timeout or a provider error), the provider is open for 60 seconds.
  • After one quota, capacity or rate limit answer, it is open for 30 seconds.
  • Then one create tries the provider again. If it works, the provider is back in its usual place. If not, the wait starts again.

What an open provider changes depends on whether you set an order:

RouteWhile the first provider is open
provider.order, or the project’s routing.sandboxes.orderTried as written, unless the provider answered quota exceeded or no capacity, or failed 3 creates in a row. Then it moves to the end until retry_at. A rate limit answer alone never moves it.
No order (Meadow’s daytona then modal, or provider.only alone)Any open provider moves to the end until retry_at.
One provider (allow_fallbacks: false, or one provider allowed)Never changed.

The provider that was moved is still tried when the others fail too. Each move is listed on the sandbox in skipped_providers, with the provider, the reason that opened it and retry_at. The route is decided after the 202, so the list shows on a wait=true answer and on GET /v1/sandboxes/{sandbox_id}, not on the first 202 of a create that does not wait. GET /v1/provider-keys shows the state as sandbox_health: see Provider keys.

A provider that rejects your stored key (401 or 403) fails its attempt at once with reason auth_failed, and Meadow tries the next provider. A rejected key does not count against the provider’s health. Store a working key with PUT /v1/provider-keys/{provider}.

When neither the request nor the project sets create_timeout_seconds, Meadow waits 120 seconds on a provider that is not the last in the route and 300 on the last, so a slow provider is left sooner. Set create_timeout_seconds to wait the same time on each. A GPU sandbox always waits 300 on each, and so does a create where no later provider can take over: none can serve the request, or each is open or half_open in sandbox_health. For a short time after Meadow moves on, the provider it left may still start its sandbox: Meadow deletes it, and until the provider confirms, that sandbox is in your usage.

A project can hold these settings as defaults, and can lock them. On a locked project a request that sends provider gets 403 with project routing is locked. See Projects.

Sort by price or start time

provider.sort orders the vendors by a measure. The values are OpenRouter’s.

  • price: the lowest hourly list price for the size you asked for goes first. The prices are the ones GET /v1/pricing returns. A vendor with no price for that size goes last. Daytona charges for disk, so its price needs a disk size. Without resources.disk_mb, Meadow assumes the disk Daytona has granted most often to sandboxes that asked for none, the rule meadow usage reprice uses, and the route shows that Daytona price as price_estimated with cost_reason default_disk_assumed. Until Meadow has seen such a grant, Daytona’s price is unknown and it goes last.
  • latency: the shortest median create time goes first. The median is over your account’s last 20 creates that the vendor served in the past 24 hours, from Meadow’s create call to running. A vendor with none goes last, and a tie is broken by price. Modal answers running before its container starts, and Daytona’s time can be up to a second late: see Known limits.
  • throughput returns 400: it has no meaning for a sandbox.

An order wins over sort. Meadow reads them in this order and uses the first one set: the request’s order, the request’s sort, the project’s order, the project’s sort. A sorted route is not a configured order, so an open vendor moves to the end as on the automatic route (see When a vendor is failing). POST /v1/sandboxes/route shows the sort it used, and for latency each vendor’s median_create_ms.

There is no option to spread the creates of a batch across vendors. Send each create with the order you want.

See where a create would go

routeSandbox, POST /v1/sandboxes/route, takes the body you would send to POST /v1/sandboxes and answers 200 with the vendors a create would try now, in order, without creating anything or calling a vendor:

curl -sS -X POST "$MEADOW_URL/v1/sandboxes/route" \
-H "Authorization: Bearer $MEADOW_KEY" -H "Content-Type: application/json" \
-d '{"image":"python:3.12-slim","resources":{"cpu":1,"memory_mb":1024,"disk_mb":3072},"provider":{"order":["daytona","modal"]}}'

Each entry in candidates has the vendor, skipped with the reason when the vendor’s health moved it to the end, probe when this create would be the one that tries a cooling vendor again, create_timeout_seconds (the wait on that vendor), cost_per_hour with cost_status, and health. excluded lists vendors of the route a create would not try: no_provider_key, or unsupported with the vendor’s reason. A body a create would refuse gets the same error here. Health can change between this call and your create, so the create can still take another path. cost_per_hour is the list price of the size you asked for; on Daytona it is unknown unless you set resources.disk_mb.

Provider options

provider.options passes settings through to one provider. An entry for a provider that does not serve the request is ignored.

ProviderKeys
daytonaspot, public, ephemeral, kvm (booleans), target, user (strings), language (python, javascript, or typescript)
modalcloud (string), regions (list of strings), runtime (gvisor or vm), burst (boolean, see Resources)
{
"image": "python:3.12-slim",
"ports": [8000],
"provider": {
"only": ["daytona"],
"options": {"daytona": {"public": true}, "modal": {"regions": ["us-east"]}}
}
}

We ran daytona.public and modal.regions. The other keys are passed to the provider as written and we have not run them.

Any other key returns 400, whichever provider would have served. Meadow checks the options of each provider in the route, so options for a provider that is not in it, such as one you hold no key for, are ignored. On 2026-11-28 a create with an unknown daytona key, on an account that held only a Modal key, returned 202 and Modal served it.

{"error":{"code":"invalid_request","message":"unsupported key in provider.options.daytona","type":"invalid_request"},"request_id":"req_00001e53"}

That body is from an older server build. The current server code sends error.code parameter_unknown and an error.param that names the key, such as provider.options.daytona.<key>.

So does a key for something Meadow sets itself, such as the name, image, timeouts, or network rules:

{"error":{"code":"parameter_invalid","message":"provider.options.modal.timeout conflicts with meadow-managed settings","param":"provider.options.modal.timeout","type":"invalid_request"},"request_id":"req_0000b121"}

Seen on the hosted beta on 2026-11-28.

Resources

{"resources": {"cpu": 1.5, "memory_mb": 3000, "disk_mb": 5000}}

The defaults are 2 CPU and 4096 MB of memory. Both providers treat cpu and memory_mb as limits, but they count differently, and Meadow passes the numbers through without converting them.

DaytonaModal
cpuVirtual CPUs, rounded up to a whole number. A hard limit.Physical cores, which Modal documents as two virtual CPUs each. Fractions are allowed. A hard limit, and Modal also reserves this amount.
memory_mbRounded up to a whole GiB. A command that passes it is killed.A hard limit. A command that passes it ends the whole sandbox, which then reads failed with provider_lost.
disk_mbRounded up to a whole GiB. Default 3 GiB.No disk setting. Every sandbox gets 512 GiB, and a request above that skips Modal.
Built image_idAny size Daytona offers. The first sandbox of a new size waits for a snapshot of that size.Any size.
Over the provider’s limitSkipped with an unsupported attempt that carries Daytona’s reason.Skipped the same way for disk_mb.

So the same cpu gives more compute on Modal. With eight busy processes, measured as a multiple of the work one process does alone: 1.95 on Modal and 1.14 on Daytona at cpu 2, and 1.00 on Modal and 0.57 on Daytona at cpu 1. Size cpu for the provider that will serve. Inside the sandbox, Modal shows the limit. Daytona shows the host: nproc and free reported 64 CPUs and 755 GiB on 2026-11-24, while the cgroup limits were the ones requested. On Daytona read the limit from the cgroup files, not from nproc.

To let a Modal sandbox use more than it asked for, send "provider": {"options": {"modal": {"burst": true}}}. Then cpu and memory_mb are floors, as in Modal’s own default, and Modal bills the larger of the request and what was used.

Seen on the hosted beta on 2026-11-24: a Modal sandbox with memory_mb: 1024 had a 1 GiB memory limit, and a script that kept allocating memory was killed with exit code 137 after about 950 MB, which ended the sandbox with provider_lost. With burst the same sandbox showed no memory limit. A sandbox from a built image on Daytona at 1 CPU and 2048 MB got that size, and one at 4 CPU and 8 GiB got that size too, with the attempt detail provider built a copy of the image for this size. Modal gave 512 GiB of disk whatever disk_mb asked for. The compute multiples above were measured on a test server against the real providers on 2026-11-23 and were not measured again.

The resources field of the sandbox always shows what you asked for. When Daytona grants something else, the served attempt says so:

{
"attempts": [
{
"detail": "provider granted cpu 2 instead of 1.5, memory_mb 3072 instead of 3000, disk_mb 5120 instead of 5000",
"duration_ms": 1424,
"outcome": "served",
"provider": "daytona"
}
],
"resources": {"cpu": 1.5, "disk_mb": 5000, "memory_mb": 3000}
}

Modal grants what you asked for and reports nothing for CPU and memory.

Asking Daytona for a size it does not offer skips Daytona. This attempt came from a request for 16 GiB of memory on the test server:

{
"detail": "daytona cannot serve this size: Memory request 16GB exceeds maximum allowed per sandbox (8GB)",
"outcome": "unsupported",
"provider": "daytona"
}

The limit in that message belongs to the Daytona organization that was used. Yours can differ.

A sandbox from a built image_id gets the size it asks for on both providers. Daytona fixes resources on a snapshot, so Meadow keeps one Daytona snapshot per image and size. The first sandbox that asks for a new size makes the snapshot, which counts toward create_timeout_seconds, and its served attempt says provider built a copy of the image for this size. Later sandboxes of that size start at once.

GPUs

gpu takes type (a list in order of preference) and count.

{"resources": {"cpu": 2, "memory_mb": 8192, "gpu": {"type": ["H100", "L40S"], "count": 1}}}
DaytonaModal
TypesH100, H200, B200, B300, L40S, RTX-PRO-6000, RTX-4090, RTX-5090, MI355XT4, L4, A10, A100, A100-40GB, A100-80GB, L40S, RTX-PRO-6000, H100, H200, B200, B200+, B300
Which type you getThe first in your list with free capacity. Meadow reads your organization’s capacity before the create.The first in your list that Modal offers. Modal does not try the next one when that type has no capacity.

Names are matched without case, and _ or a space counts as -. A name neither provider offers returns 400. A provider that offers none of the names is skipped with an unsupported attempt. When the provider placed a different type than the first one you asked for, the served attempt says so, for example provider granted gpu type T4 instead of RTX-4090.

A name may end in !, which means exactly this type. Modal may place a plain H100 on an H200, and a plain A100 on an 80 GB A100, at no extra cost. Ask for H100! or A100! when the job must run on that card, for example a benchmark. H100! goes to Modal as written and A100! goes as A100-40GB. For other types the mark changes nothing. Daytona places exactly the type you name and gets the name without the mark. B200+ means a B200 or a B300. The sandbox object returns the names as you wrote them. No sandbox with ! or B200+ has been run on the hosted beta.

GPU sandboxes were run on the test server on 2026-11-23: an A10 and a T4 on Modal, and an RTX 4090 on Daytona. On the hosted beta an H100 sandbox was served on each provider on 2026-11-24. Which types a provider gives you depends on your provider account.

Timeout and idle timeout

timeout_seconds is the longest lifetime. It cannot be extended: PATCH /v1/sandboxes/{sandbox_id} changes network rules only, and a body with timeout_seconds returns 400. Ask for the longest time the job may need, up to 24 hours. The clock starts when the sandbox starts running, and expires_at shows the end. At that moment the sandbox goes to terminating and then terminated. In our run with timeout_seconds: 20 on Modal, the sandbox was terminating within 2 seconds of expires_at and terminated 31 seconds later.

idle_timeout_seconds ends the sandbox early when nothing uses it. These count as use:

  • Any call for that sandbox: get, exec, files, ports, or SSH.
  • A background command that is still running.

The list call (GET /v1/sandboxes) does not count. So a client that polls GET /v1/sandboxes/{id} more often than the idle timeout keeps the sandbox alive. Poll the list, or use a webhook, when you want the idle timer to run. In our run with idle_timeout_seconds: 30, a sandbox we watched through the list was terminated 32 seconds after it started.

A sandbox that ends at either timeout is terminated with no failure_reason.

For a long job, such as an agent run of 13 hours:

  • Send timeout_seconds. The default is one hour.
  • Leave idle_timeout_seconds out, or keep a background command running. A running background command holds the idle timer off.
  • Run the work as a background command. A background command has no time limit of its own. A blocking or streamed command is tied to one HTTP request, and the hosted beta ends a request after one hour.
  • Nothing else in Meadow ends a running sandbox early, unless the key that holds a spent dollar limit has limit_action stop_sandboxes (see Spend limits). Meadow turns Daytona’s auto-stop and auto-pause off and sets no idle timeout on Modal.
  • A provider can still have a lower limit for your account. Daytona can cap how long a sandbox may live per organization and region. When that cap is below your timeout_seconds, Meadow skips Daytona with an unsupported attempt whose detail starts with provider would end this sandbox at. This check was added on 2026-11-24 and has not been seen on the hosted beta.
  • On Modal the sandbox ends when the image’s main command exits, whatever the timeout. See Known limits.

Limits you will hit: timeout_seconds above 86400 returns 400. Modal needs at least 10 seconds, so a shorter request skips Modal. More in Known limits.

List sandboxes

curl -sS "$MEADOW_BASE_URL/v1/sandboxes?status=running&label=team=docs&limit=50" \
-H "Authorization: Bearer $MEADOW_API_KEY"

The response is {"object": "list", "data": [...], "has_more": false, "next_cursor": null}, newest first. Each sandbox carries cost, as on GET /v1/sandboxes/{sandbox_id}: see Usage and cost. A key sees the sandboxes of its own project only. Repeat label to require several labels. limit is 50 by default and 200 at most. When next_cursor is not null, pass it as cursor for the next page.

Delete a sandbox

curl -sS -X DELETE "$MEADOW_BASE_URL/v1/sandboxes/sbx_0000cff0" \
-H "Authorization: Bearer $MEADOW_API_KEY" -w '%{http_code}\n'

Meadow waits up to 15 seconds for the provider.

  • 204 with no body: the sandbox is terminated.
  • 202 with the sandbox in terminating: the provider is slow, and Meadow finishes in the background.

Treat both as success. Poll the sandbox if you need to see terminated.

On Daytona every delete we ran returned 204 in about 2 seconds. On Modal expect the 202. In our first runs about half of the Modal deletes returned 204 in about 1 second. In later runs every one returned 202, most of them after the full 15 seconds, and the sandbox reached terminated 20 to 30 seconds after that. A 202 can also come back at once. If your service deletes a Modal sandbox inside a request, do the delete in the background.

Deleting twice is safe: the second call returns 204. An unknown ID returns 404.

Read the full output of background commands before you delete. After the delete Meadow keeps only the last 256 KiB of each stream, for 24 hours (see Running commands).

Idempotency

A create that times out on your side may or may not have reached Meadow. Send an Idempotency-Key header so that the retry cannot start a second sandbox:

curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes" \
-H "Authorization: Bearer $MEADOW_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: docs-web-1" \
-d @create.json

The same key with the same body returns the first sandbox, with 202. The same key with a different body returns 409:

{"error":{"code":"idempotency_key_reused","message":"idempotency key reused with different request parameters","type":"conflict"},"request_id":"req_00003937"}

The value belongs to the API key that sent it. Another key of the project that sends the same value starts its own sandbox.

The key is 1 to 255 printable ASCII characters. A blank key returns 400 with Idempotency-Key must not be blank, and a longer one returns 400 with Idempotency-Key must be at most 255 bytes. The header also works on background exec and on POST /v1/keys, POST /v1/projects and POST /v1/images. The other routes ignore it, and so does a blocking or streamed exec.

The value stays on the sandbox for as long as the sandbox record exists, whatever its state. A retry with the same key and body returns the first sandbox even after it has failed or ended. To start again after a failed create, send a new key.

Limit how many run at once

The 403 below was seen on the hosted beta on 2026-11-28, from a key created with "max_sandboxes": 0. The rest is read from the server’s code and its tests.

max_sandboxes caps how many sandboxes may be alive at once. Set it in two places:

  • On a key, with POST /v1/keys or PATCH /v1/keys/{key_id}. It covers the sandboxes made by that key and by every key created from it. A created key’s cap cannot be above its parent’s.
  • On a project, with POST /v1/projects or PATCH /v1/projects/{project_id}. It covers every sandbox of the project, whichever key made it.

A sandbox counts while it is creating, running or terminating. A failed sandbox counts until Meadow has confirmed that the provider deleted what it started. A create past a cap returns 403 and creates nothing:

error.codeWhich cap
key_sandbox_limit_exceededThe key’s, or a key above it.
project_sandbox_limit_exceededThe project’s.
{"error":{"code":"key_sandbox_limit_exceeded","message":"key max_sandboxes limit reached: 0 sandboxes are alive","type":"forbidden"},"request_id":"req_0000fdd9"}

Two creates sent at the same moment cannot both take the last place. Lowering a cap below the number alive ends no sandbox. It stops new creates until enough have ended. Send null to remove a cap. On a created key whose parent has a cap, null returns 403 key_grant_exceeds_parent. A cap counts sandboxes. For a cap in dollars, see Spend limits.

Errors you may see on create

StatusMessageFix
400exactly one of image or image_id is requiredSend one of the two.
400timeout_seconds must be at most 86400Ask for 24 hours or less.
400provider.create_timeout_seconds must be at most 3600Ask for an hour or less.
400registry_auth cannot be used with image_idPut the login on the image build.
400webhook_url must use httpsUse a public https address.
404image not foundCheck image_id and that the key is in the image’s project.
403project routing is lockedRemove provider from the request.
402api key spend limit reachedThe key, or a key above it, has spent its dollar limit. Raise it or wait for the reset. See Spend limits.
403key max_sandboxes limit reached or project max_sandboxes limit reachedWait for a sandbox to end, or raise the cap. See Limit how many run at once.
422no usable sandbox provider key stored for allowed providersStore a Daytona or Modal key.

The full list of error types is in Errors.

API reference

Operations on this page: createSandbox, getSandbox, listSandboxes, deleteSandbox.