EndpointsUpdate a sandbox

Sandboxes

Update a sandbox

Changes name, size, network policy, idle timeout or labels. Requires manage. A new idle timeout applies from the next activity.

PATCH/sandboxes/{id}
Authorizationstringheaderrequired

Bearer token for the authenticated caller.

Optional workspace/scope context for the request. Carries a single workspace wire id (ws_…) today. Only needed for broad tokens - a workspace-owned token implies its workspace.

Required string length: 1 - 53

Example: "ws_j572abc123def4"

if-matchstringrequired

The etag of the resource version the client last read. Required on writes when the resource exposes an etag field. Mismatch returns 409 ABORTED with the current etag in the error metadata.

Required string length: 1 - 256

Example: "42"

idstringrequired

Sandbox id (sbx_...).

Pattern: ^sbx_[A-Za-z0-9]{1,64}$

Example: "sbx_j572abc123def456"

Body

application/json
namestring

Display name.

Required string length: 1 - 100

Example: "checkout-service"

sizeenum<string>

Compute size. standard is the only size today; larger sizes are added as new values.

Available options: standard

Outbound network access. allow_all means public internet only: HTTP on TCP port 80, TLS on TCP port 443 (including HTTPS), and public DNS. Private, link-local, cluster-internal and execution-cluster node addresses are blocked. Cluster DNS names and other ports or protocols are unavailable.

child attributes
network_policy.modeenum<string>required

Available options: allow_all

idle_timeout_secondsintegerdefault:600

Seconds without API activity after which the sandbox suspends itself. Commands that are still running keep it awake. 300 to 86400; default 600.

Required range: 300 <= x <= 86400

Example: 600

labelsrecord<string, string>

Response

application/json

Sandbox

idstringrequired

Sandbox id (sbx_...).

Pattern: ^sbx_[A-Za-z0-9]{1,64}$

Example: "sbx_j572abc123def456"

workspace_idstringrequired

Required string length: 1 - 53

namestringrequired

Display name.

Required string length: 1 - 100

Example: "checkout-service"

stateenum<string>required

ACTIVE sandboxes run commands and file operations. SUSPENDED sandboxes keep their files and cost only storage. -ING states are in flight; FAILED sandboxes can only be deleted.

Available options: PROVISIONING, ACTIVE, SUSPENDING, SUSPENDED, RESUMING, DELETING, FAILED

sizeenum<string>required

Compute size. standard is the only size today; larger sizes are added as new values.

Available options: standard

sourceobject | nullrequired

null for a sandbox created empty. Where the sandbox content comes from. sandbox: a copy of another sandbox from its latest snapshot (a fork). Repository, snapshot and template sources are added as new type values.

child attributes
source.typeenum<string>required

Available options: sandbox

source.sandbox_idstringrequired

Sandbox id (sbx_...).

Pattern: ^sbx_[A-Za-z0-9]{1,64}$

Example: "sbx_j572abc123def456"

network_policyobjectrequired

Outbound network access. allow_all means public internet only: HTTP on TCP port 80, TLS on TCP port 443 (including HTTPS), and public DNS. Private, link-local, cluster-internal and execution-cluster node addresses are blocked. Cluster DNS names and other ports or protocols are unavailable.

child attributes
network_policy.modeenum<string>required

Available options: allow_all

idle_timeout_secondsintegerrequireddefault:600

Seconds without API activity after which the sandbox suspends itself. Commands that are still running keep it awake. 300 to 86400; default 600.

Required range: 300 <= x <= 86400

Example: 600

envrecord<string, string>required
labelsrecord<string, string>required
created_byobjectrequired
child attributes
created_by.typeenum<string>required

user: a workspace member. opencode: an OpenCode Server (oc_...).

Available options: user, opencode

created_by.idstringrequired

Required string length: 1 - 100

usageobjectrequired
child attributes
usage.active_secondsintegerrequired

Seconds the sandbox has spent ACTIVE, including the current active period.

Required range: x >= 0

usage.cpu_secondsinteger | nullrequired

CPU seconds used. null until CPU accounting is available.

Required range: x >= 0

usage.egress_bytesinteger | nullrequired

Bytes sent to the network. null until network accounting is available.

Required range: x >= 0

usage.ingress_bytesinteger | nullrequired

Bytes received from the network. null until network accounting is available.

Required range: x >= 0

conditionsobject[]required

What needs attention now; empty when nothing does. Reasons:

  • create-failed (error): the sandbox could not be created; it is FAILED and can only be deleted.
  • suspend-failed (warning): the last suspend failed; the sandbox stays ACTIVE.
  • resume-failed (warning): the last resume failed; the sandbox stays SUSPENDED.

Maximum array length: 32 elements

child attributes
conditions.reasonstringrequired

Kebab-case reason; the resource documents the reasons it reports.

Maximum string length: 64

Pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$

Example: "agent-offline"

conditions.severityenum<string>required

error: the resource failed; the condition says why. warning: it is limited or held until the person acts or it recovers. info: worth knowing, nothing to do.

Available options: error, warning, info

conditions.messagestringrequired

Safe to show the person as is.

Maximum string length: 512

conditions.remedyobject | nullrequired

What the person can do; null when nothing they do helps.

conditions.remedy.kindenum<string>required

Available options: free-capacity

conditions.remedy.metricenum<string>required

Available options: kaas/clusters, compute/machines, compute/cpu, compute/memory, compute/machines_concurrency, compute/managed_vm_trial, agents/turns_concurrency, agents/sandboxes, agents/sandboxes_running, agents/retained_filesystem_lifetime, codemode/executions, api/secrets_access, api/secrets_write, domain_routing/preview_hostnames, domain_routing/custom_domains, source_control/repositories

Maximum string length: 256

Unix timestamp (seconds) when this condition last changed.

Required range: x >= 0

last_active_atinteger | nullrequired

Last API activity (Unix seconds).

Required range: x >= 0

created_atintegerrequired

Creation time (Unix seconds).

Required range: x >= 0

updated_atintegerrequired

Last change (Unix seconds).

Required range: x >= 0

etagstringrequired

Opaque version token. Send it as If-Match on writes.