POST /v1/sandboxes:createFromFile starts a sandbox from an uploaded file. You send a file type and the file bytes, and the sandbox gateway translates the document into a sandbox spec and runs the same create path as POST /v1/sandboxes.
Docker Compose (SANDBOX_FILE_TYPE_COMPOSE) is the only accepted file type. Every service in the file becomes a container in a single sandbox, and one service you name becomes the sandbox primary. The gateway doesn’t store the file bytes. GET /v1/sandboxes/{sandboxId} returns the translated spec.
This isn’t Docker Compose equivalence. Before you import an existing project, read Compose support.
CoreWeave sandboxes are in public preview. For access, contact your CoreWeave account team, CoreWeave Support, or email support@coreweave.com.
Before you begin
You need a CoreWeave API access token with theSANDBOX_USER action, and serverless sandboxes enabled for your organization. See Get started with CoreWeave sandboxes. Authentication and error shapes match the rest of the API. See API overview.
Request fields
The request also accepts
mode, maxLifetimeSeconds, tags, network, objectStorageAccess, annotations, runnerIds, and requestId, with the same meaning as on POST /v1/sandboxes. networkIds returns UNIMPLEMENTED.
This field list is closed. Volumes, instance type, runtime class, image-pull credentials, and published services aren’t available on this endpoint. Use POST /v1/sandboxes when you need them.
Create the sandbox
Write a Compose file, then post it withcontents base64-encoded:
Create a sandbox from compose.yaml
STATE_CREATING. Poll its sandboxId until it reaches STATE_RUNNING or a terminal state:
Poll the sandbox
main marked primary, and HELPER_HOST still set to helper. Inside the sandbox, helper resolves to 127.0.0.1.
To retry a create safely, send requestId. The same requestId with the same declared inputs returns the existing sandbox. The same requestId with different bytes, including a whitespace-only change, returns ALREADY_EXISTS with reason CWSANDBOX_REQUEST_ID_CONFLICT.
Compose support
All services share one pod and one network namespace. Service names resolve to127.0.0.1, so values such as HELPER_HOST: helper and API_BASE: http://main:8080 work without rewriting the file. The sandbox has no per-service IP addresses, bridge networks, or replicas.
The following behavior differs from Docker Compose:
- Startup is serial. Every non-primary service starts one after another, before the primary. Size
maxLifetimeSecondsfor that. A service that never becomes ready leaves the sandbox inSTATE_CREATING. RUNNINGtracks the primary only. A helper that crashes after start doesn’t fail the sandbox.healthcheckbecomes an exec-only startup probe.testmust be a string,CMD,CMD-SHELL, orNONE, and durations must be whole seconds. When the probe exhausts its retries, the container is stopped rather than marked unhealthy.- Ports stay in the pod.
exposeandportsdeclare listen ports, but nothing is published externally. - Images must be pullable. Every service needs
image:in the file or an entry inimageOverrides. A service that still needsbuild:returnsUNIMPLEMENTED. commandandentrypointfollow Docker’s shell and exec forms. Omit them to use the image defaults. Explicitnulland[]are rejected.- GPUs are primary-only, through
deploy.resources.reservations.deviceswith thegpucapability and a positive integer count. - Names must be DNS-1123 labels (
my-app, notMy_App), and can’t use the reservedcw-object-store-agent,cw-object-store-agent-restore, ordns-egressprefixes.
Unsupported keys
The document must be self-contained: the gateway doesn’t read your disk and doesn’t expand your environment. Unrecognized keys are rejected with the offending field path rather than ignored.
The gateway ignores
version, project name, labels, and x-* extension keys. Don’t rely on labels reaching the sandbox.
Common errors
Field violations arrive asBadRequest details naming the path and the limit. They don’t quote your document.
See also
- Get started with CoreWeave sandboxes: create your first sandbox from a spec.
- API overview: authentication, versioning, and error handling.
- Sandbox environment variables: what the platform injects into every container.