Change a running sandbox's network rules
Replaces the outbound network rules of a running sandbox. A 200 means the vendor accepted the rules. A change that removes access was in force when the call returned in every run on both vendors. On Modal, access that a change adds can stay blocked for some seconds after the 200 (seen: still blocked right after the call in 3 of 5 runs, open 15 seconds later in the one run checked again). Modal’s call reports no moment at which the rules took effect, so Meadow cannot wait for it: check from inside the sandbox before you rely on a new allowance. A common use: create the sandbox with the hosts that setup needs, then narrow the rules before untrusted code runs.
Rules:
networkis the only field and it is required. It has the same shape and the same checks asnetworkon create.- The whole rule set is replaced. A field you leave out is set to its default
(
falseor an empty list), so{"network": {}}opens the network. Send every rule you want to keep. - Sending the same rules again is safe and returns 200.
- The sandbox must be
running. Any other status returns 409. - Connections that are already open may be cut when the new rules no longer allow them.
- No webhook event is sent for this change.
- A rule set the vendor hosting the sandbox cannot apply returns 400 and
changes nothing. The message names the cause:
- Daytona cannot combine
allow_domainswithallow_cidrs. - Modal changes rules only on a sandbox that was created with
allow_domainsorallow_cidrs. A Modal sandbox created with an open network or withblock_allreturns 400 for every change. A list type (allow_domainsorallow_cidrs) can be used in a change only when the sandbox was created with at least one entry of that type, and opening the network needs both. On Modal,block_allin a change is applied as two empty allow lists. - A Modal sandbox created before this operation existed returns 400.
- Daytona cannot combine
Scope: sandboxes.
Authentication
A Meadow API key, sent as Authorization: Bearer mdw_.... The header
x-api-key: mdw_... is accepted in its place.
Path parameters
The sandbox id returned by POST /v1/sandboxes. It must belong to the key’s project.
Request
Outbound network rules. With block_all false and both lists empty, outbound
traffic is open. block_all cannot be combined with the allow lists.
Response headers
Meadow’s id for this request, req_ and 24 hex characters. Every response
carries it, including errors, streams and unknown routes. Every error in the
Error schema repeats it as request_id. Quote it when you report a problem.
Response
The sandbox with the new rules in network.
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, bytimeout_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. Seefailure_reason.
Why the sandbox is failed. Null otherwise.
all_providers_failed: every provider in the route failed, for mixed reasons. Readattempts.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.
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.
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.
When the sandbox became running. Null before that.
When timeout_seconds ends the sandbox: started_at plus the timeout. Null until it is running.
When the sandbox became terminated. Null otherwise.
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_reasonsays why:grant_unconfirmed(the vendor has not yet confirmed the size, so the size asked for is priced),spot_unconfirmed, ormeadow_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), orvendor_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, andcostis null. Unknown never means free.cost_reasonisnot_recordedwhen 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.