Skip to main content
POST
Launches a new sandbox: an isolated, fast-starting CPU environment for running untrusted code. Supply at most one of templateId or image; with neither, the sandbox runs the default sandbox image. Every field is optional, so an empty body ({}) is a valid request. Omitted fields use your account’s default sandbox policy. The request returns 201 with the sandbox, usually still in the CREATING state. Poll Get a sandbox until state is RUNNING. The sandbox is billed per second until it terminates. Terminate it explicitly when you’re finished, including on error paths, rather than relying on a timeout to stop billing.

Headers

string
Makes the create safe to retry after a lost response. Repeating the request with the same key and the same body returns the sandbox the first request created (201) instead of creating another. The same key with a different body is a 400. A key whose first create failed is spent: retrying with it returns 409, so retry a failed create with a new key. Keys are unique per account and compared case-insensitively.

Body

string
Container image to run, for example python:3.12-slim. Can’t be combined with templateId.
string
Sandbox template to launch from. Can’t be combined with image.
string
ID of one of your saved container registry credentials (from /v2/registries), for pulling a private image. An ID that isn’t yours is rejected.
string
Human-readable name. Names don’t have to be unique. Generated when omitted.
object
CPU flavor and vCPU count, as on a CPU Pod. Memory and container disk limits scale with the flavor. Defaults to the standard sandbox flavor and size.
Review question: Besides id and vcpuCount, which fields does cpu accept on create? Is cpu.memory read-only? Remove this box before merging.
integer
default:"10"
Container disk in GB. Ephemeral: deleted when the sandbox terminates. Capped per vCPU, the same limit CPU Pods have.
string[]
Preferred data centers, each one that offers sandboxes. Omit to let Runpod choose. With a network volume mounted, omit it or include the volume’s data center.
object
Environment variables as string key-value pairs. Use {{ RUNPOD_SECRET_name }} to reference a Runpod secret. Values are returned as written in API responses, so don’t put plain credentials here.
string[]
Container CMD in exec form, for example ["python", "-m", "http.server", "8080"]. If the image defines an ENTRYPOINT, this is the argument list passed to it. Omit cmd and entrypoint to keep the image’s own; an image with no command runs a keepalive process.
string[]
Container ENTRYPOINT in exec form, overriding the image’s own.
object[]
Ports to expose, at most 15. Each entry has a port and a protocol (http, tcp, or udp). HTTP ports are reached through a proxy URL; TCP and UDP ports through a public IP and port. See Exposed ports.
object
Volumes to mount.
boolean
default:"false"
Inject the SSH public keys registered on your account (PUT /v2/account/ssh-keys) so you can connect over SSH. Does nothing if you have no registered keys. Only images that start sshd from PUBLIC_KEY support it; all Runpod official images do. For a direct connection, also expose 22/tcp in ports.
integer
Seconds of inactivity before the sandbox is terminated. Omitted uses the default. Values above the maximum are clamped to it, and values under 90 are raised to 90. Read the response for the value applied.
integer
Maximum total lifetime in seconds, counted from creation. Omitted or out-of-range values are clamped to the account policy’s default and maximum.
object
String key-value labels for organizing sandboxes. You can filter List sandboxes by label.
enum<string>
default:"ALLOW_ALL"
Outbound network policy: ALLOW_ALL, ALLOW_LIST, or DENY_ALL. Egress is open by default. Restriction isn’t enabled for all accounts yet; until it is, any value other than ALLOW_ALL returns 400.
string[]
Hostnames the sandbox may reach when egressMode is ALLOW_LIST. Requires restricted egress to be enabled for your account.
imageName, cpuFlavorId, vcpuCount, memoryInGb, and dataCenterId are deprecated aliases for image, cpu.id, cpu.vcpuCount, and dataCenterIds. Use the new names.

Response

Returns the created sandbox. See Get a sandbox for all response fields.

Errors

Last modified on October 19, 2026