[TEMPLATE-ID] with the template’s UUID, [SNAPSHOT-ID] with a file system snapshot ID, and [GITHUB-ORG] with your GitHub Container Registry organization or user name.
CoreWeave sandboxes are in public preview. For access, contact your CoreWeave account team, CoreWeave Support, or email support@coreweave.com.
Create a template
Templates are managed by organization admins. Write operations require thesandbox_admin role; every sandbox user in the organization can read templates and start sandboxes from them.
- CLI
- curl
Create a template from a file:Inspect and list existing templates:
template.json
displayNameis required and must be unique among the organization’s active templates: 1 to 128 characters after trimming. Prefer names that are not UUID-shaped, so they do not collide with ID-first lookup.specis a partial sandbox specification, capped at 1 MiB. It uses the same fields as a create request, and everything in it can be overridden at create time.speccannot select an instance type or attach sandbox networks yet. A template that setsinstanceTypeornetworkIdsis rejected as unimplemented.- Template contents are visible to every sandbox user in the organization. A template is not a secret-distribution channel; literal credentials do not belong in one.
Start a sandbox from a template
Start a sandbox from a template by ID. Selection is by UUID only; display names work for lookup and listing, not for create.Create a sandbox from a template
overrides with the same shape as a sandbox specification. Overrides replace whole fields on presence, they are not merged:
- A message you set replaces the template’s whole message. A message you omit keeps the template’s value.
- A list or map you set replaces the template’s whole collection, including when you set it empty. Removing one entry means sending the full collection with the desired contents.
- Overriding any container field replaces the entire container list. There is no sparse patch of a template container, so an override that touches the container must carry the full container, including
image.
Override the container per run
Sandbox.run_from_template() and client.runFromTemplate(). See the client documentation for the SDK workflow.
Example templates
The examples below are complete documents forcwic sandbox template create -f template.json. Unlike a policy, an organization can hold many templates, so these compose: create one per recurring workload shape.
Web service with a public HTTPS endpoint
A template for sandboxes that serve HTTP to the public internet through a platform-issued HTTPS endpoint. The assigned URL is echoed on the sandbox after create.template.json
Workspace restored from a snapshot
A template whose scratch volume starts from the same file system snapshot every time: a golden workspace that each sandbox forks privately.template.json
Curated egress
A template that grants a fixed set of destinations: one CIDR range on port 443 plus sibling sandboxes in the same organization. Every rule must fit inside the runner policy’sallowedEgress envelope, or the create is rejected.
template.json
network.egress opts into the policy’s defaultEgress instead. Keep the egress list on the template when the workload’s destinations are known, and leave it empty when the policy default is the right posture.
CKS-only: pod attachments
On your own CKS cluster, an admin can put anattachments block on a template: a Kubernetes pod-specification fragment applied to every sandbox created from it. This is how a template pins node selection, tolerations, or a pull secret that the sandbox specification itself has no fields for.
template.json
- A template with attachments is CKS-only. Its
requiresCksoutput field is true, and creating from it withmodeset toSANDBOX_MODE_SERVERLESSfails withFailedPrecondition. An unset mode is treated as CKS. - Attachments are admin-owned. Only
sandbox_admincan write them, plain create requests cannot supply them, and create-time overrides cannot change or remove them. - The fragment uses Kubernetes JSON, with camelCase keys under
specandmetadata, unlike the sandbox specification fields elsewhere in the template. Unknown keys are rejected. - The allowed surface is deliberately narrow: scheduling and runtime plumbing such as
nodeSelector,tolerations,imagePullSecrets,volumes,topologySpreadConstraints,hostAliases, DNS settings, and a singlecontainersentry limited toname,env,envFrom,volumeMounts, andvolumeDevices, plus pod labels and annotations. Security-sensitive fields are rejected:securityContext,runtimeClassName,initContainers,affinity, host namespaces,hostPathvolumes, and non-default service accounts, among others. - Attachments layer on top of the policy’s
basefragment. List-valued fields combine with the policy base:imagePullSecretsandtolerationsare deduplicated, whiletopologySpreadConstraints,hostAliases, andreadinessGatesappend. Single-valued fields such asnodeSelectorkeys specialize the base. A same-name volume, environment variable, or mount-path conflict between the two layers rejects the create.
Manage templates
- CLI
- curl
- Reads accept an ID or a display name. If the path segment parses as a UUID it is looked up by ID; otherwise it is resolved as a display name among active templates.
- Every successful update increments the template’s
revision. Sandboxes record the revision they were created from, so you can tell which sandboxes predate a template change. - Delete is a soft delete. Existing sandboxes are unaffected, new creates can no longer select the template, and the display name becomes reusable for a new template.
Next steps
- Policy examples: complete runner policies to pair these templates with.
- Configure a sandbox policy: the constraint groups a template’s spec is validated against.
- Policies overview: how templates and policies divide the work profiles used to do.
- Get started: runner setup and your first sandbox.