Terminate a sandbox
Ends the sandbox at the vendor. Everything in it is lost. The sandbox record
stays and reads terminated, so GET and the list still return it.
Meadow waits up to 15 seconds for the vendor. It returns 204 when the vendor
confirms. When the vendor is slower it returns 202 with the sandbox in
terminating, and finishes the teardown in the background. Treat both as
success. Poll GET /v1/sandboxes/{sandbox_id} if you need to see terminated.
Safe to call twice: deleting a sandbox that has already ended returns 204.
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.
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 vendor is slow. The sandbox is terminating and Meadow finishes in the background.
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.