Skip to navigation

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

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Path parameters

sandbox_idstringRequired

The sandbox id returned by POST /v1/sandboxes. It must belong to the key’s project.

Response headers

x-request-idstringOptional

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.

idstring
The sandbox id.
project_idstring
The project the sandbox belongs to.
statusenum
  • 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:
created_atdatetime
When the create call was accepted.
namestring or nullOptional
The label given at create. Null when none was given.
failure_reasonenumOptional

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.
providerenum or nullOptional
The provider hosting the sandbox. Null until one accepts it.
Allowed values:
provider_sandbox_idstring or nullOptional
The vendor's own id, for finding the sandbox in their dashboard.
attemptslist of objectsOptional
Every try to create the sandbox, in order. Empty until the first try ends.
skipped_providerslist of objectsOptional

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.

resourcesobjectOptional
The size of the sandbox. Unknown fields return 400.
labelsmap from strings to stringsOptional
The labels given at create. Empty when none were given.
portslist of integersOptional
The ports listed at create.
sshbooleanOptional
Whether SSH was asked for at create.
networkobject or nullOptional

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_atdatetime or nullOptional

When the sandbox became running. Null before that.

expires_atdatetime or nullOptional

When timeout_seconds ends the sandbox: started_at plus the timeout. Null until it is running.

terminated_atdatetime or nullOptional

When the sandbox became terminated. Null otherwise.

costobjectOptional

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

401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error