Create a sandbox
Creates a sandbox from an image.
DEPLOYED, so you can connect right away. An active sandbox reserves its name;
you can reuse a name after the sandbox fails or terminates.
Related guide: Create and manage sandboxes.Authorizations
Send Authorization: Bearer <api_key>. The legacy Authorization: Api-Key <api_key> scheme is also accepted.
Headers
Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.
1Query Parameters
Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.
1Body
Configuration for a new sandbox. The client may provide a name; otherwise the server generates one. The name is immutable after creation.
When true, return the existing live sandbox with this name or recreate it if it is failed, terminated, or being deleted. The server handles concurrent creation and deletion races with a bounded wait; persistent contention returns a conflict. Requires name. Existing configuration is preserved. Defaults to false when omitted.
Optional unique sandbox name. Generated by the server when omitted; immutable after creation.
1"baseten-api-review-0916"
Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the default sandbox region is used.
"us-pdx-1"
Environment variables injected into the sandbox.
Image reference including its tag. Defaults to baseten/base-image:latest, the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
"baseten/base-image:latest"
Memory allocation in megabytes. Must be between 1024 and 262144. Defaults to 4096, or to 8192 MB per vCPU (a 1:8 ratio) when only cpu is set, capped at the account's memory quota. When cpu is omitted, memory also determines the CPU allocation (by default 2048 MB = 1 vCPU, 4096 MB = 2, 8192 MB = 4, 16384 MB = 6, 32768 MB = 8, 65536 MB = 16, 131072 MB or more = 32).
512 <= x <= 2621444096
Optional number of vCPUs, a whole number between 1 and 32. When omitted, the CPU allocation is derived from memory. When set, memory must be between 1024 and 8192 megabytes per vCPU (a ratio from 1:1 to 1:8), and cpu must not exceed the account's per-sandbox cpu quota. A value equal to the allocation memory alone would give is always accepted. When memory is omitted, it defaults to 8192 MB per vCPU, capped at the account's memory quota. Immutable after creation.
1 <= x <= 322
Filesystem configuration. Set at creation only.
Volumes mounted in the sandbox. Set at creation only.
1Set of ports for a resource
Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
64^[A-Za-z0-9-]+$"api-review-20260916-001"
Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
Response
Sandbox created.
Sandbox resource with configuration and server-managed fields at the root. No metadata, spec, or runtime wrapper.
Immutable sandbox name, provided by the client or generated by the server, used in sandbox_name path parameters.
"baseten-api-review-0916"
Base URL of this sandbox's execution API, always present on successful creation. The URL is assigned before deployment completes; inspect status for readiness. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with your authentication token using Authorization: Bearer . Do not send the Baseten API key directly. No additional routing headers are required. Fetch GET {url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST {url}/process with Content-Type: application/json and {"command":"echo hello","waitForCompletion":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake_case fields.
"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run"
Sandbox deployment status.
DEPLOYING, DEPLOYED, FAILED, DEACTIVATING, DEACTIVATED, DELETING, TERMINATED, ARCHIVING, ARCHIVED, UNARCHIVING, BUILDING, UPLOADING "DEPLOYED"
Time the sandbox was created.
"2026-09-16T21:26:58.545765901Z"
Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the default sandbox region is used.
"us-pdx-1"
Environment variables injected into the sandbox.
Image reference including its tag. Built-in image references are returned in the canonical baseten/ namespace. Use baseten/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
"baseten/base-image:latest"
Memory allocation in megabytes. Must be between 1024 and 262144. When cpu is not set at creation, memory also determines the CPU allocation (by default 2048 MB = 1 vCPU, 4096 MB = 2, 8192 MB = 4, 16384 MB = 6, 32768 MB = 8, 65536 MB = 16, 131072 MB or more = 32).
512 <= x <= 2621444096
Number of vCPUs the sandbox runs with. Always returned, including for sandboxes created without cpu, whose CPU allocation was derived from memory. Set at creation only.
1 <= x <= 322
Filesystem configuration. Set at creation only.
Volumes mounted in the sandbox. Set at creation only.
1Set of ports for a resource
Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
64^[A-Za-z0-9-]+$"api-review-20260916-001"
Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
Time the sandbox was last updated.
"2026-09-16T21:31:13Z"
User or service account that created the sandbox.
"sandbox-automation"
User or service account that last updated the sandbox.
"sandbox-automation"
Time the sandbox was last used.
"2026-09-16T21:31:13Z"
Seconds remaining before automatic deletion, when expiration is configured.
x >= 086400