Sandbox
A Sandbox resource representing an execution environment.
Sandbox object
A Sandbox resource representing an execution environment.
- specobjectBeta
The desired configuration of the sandbox, supplied by the caller at creation time.
Show child attributesHide child attributes
- computeobjectBeta
Compute configuration (size, inactivity timeout) requested for the sandbox.
Show child attributesHide child attributes
- inactivity_timeoutstringBeta
Idle duration after which the sandbox is automatically terminated.
- statusobjectBetaOutput only
The observed runtime state of the sandbox, populated by the server.
Show child attributesHide child attributes
- statestringBetaOutput only
Lifecycle state of the sandbox.
SANDBOX_STATE_UNSPECIFIEDSANDBOX_STATE_PENDINGSANDBOX_STATE_RUNNINGSANDBOX_STATE_STOPPEDSANDBOX_STATE_STOPPING
- namestringBetaIDImmutable
The sandbox resource name, in the form
sandboxes/{sandbox_id}. Derived fromsandbox_id; any value supplied in a create or update request body is ignored.
- create_timestringBetaOutput only
Output only. The creation time of the sandbox.
- update_timestringBetaOutput only
Output only. The last update time of the sandbox metadata and spec.
- display_namestringBeta
Human-readable display label for the sandbox. At most 256 characters.
Get a sandbox Beta
GET
Retrieves a Sandbox by name.
API scopes: sandbox
Parameters
- namestringRequiredpath
Response
Returns the Sandbox object.
List sandboxes Beta
GET
Lists all Sandboxes.
API scopes: sandbox
Parameters
- page_tokenstringquery
- page_sizeint32query
Response
Returns a list of Sandbox objects.
Create a sandbox Beta
POST
Creates a new Sandbox.
API scopes: sandbox
Parameters
- sandbox_idstringRequiredquery
Client-supplied ID that becomes the final path segment of the resource name.
Request body
The sandbox to create.
- specobject
The desired configuration of the sandbox, supplied by the caller at creation time.
Show child attributesHide child attributes
- computeobject
Compute configuration (size, inactivity timeout) requested for the sandbox.
Show child attributesHide child attributes
- inactivity_timeoutstring
Idle duration after which the sandbox is automatically terminated.
- namestringIDImmutable
The sandbox resource name, in the form
sandboxes/{sandbox_id}. Derived fromsandbox_id; any value supplied in a create or update request body is ignored.
- display_namestring
Human-readable display label for the sandbox. At most 256 characters.
Response
Returns the Sandbox object.
Update a sandbox Beta
PATCH
Updates mutable fields on an existing Sandbox. Allowlisted update_mask paths today: display_name, spec.compute.inactivity_timeout. Returns INVALID_PARAMETER_VALUE for empty masks or unknown paths; NOT_FOUND if the sandbox does not exist.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to update, in the form
sandboxes/{sandbox_id}.
- update_maskstringRequiredquery
Field paths to update. Must be a non-empty subset of:
- display_name
- spec.compute.inactivity_timeout Any other path returns INVALID_PARAMETER_VALUE.
Request body
The Sandbox resource carrying new field values. Only fields named in
update_mask are read; unmasked fields are ignored.
- specobject
The desired configuration of the sandbox, supplied by the caller at creation time.
Show child attributesHide child attributes
- computeobject
Compute configuration (size, inactivity timeout) requested for the sandbox.
Show child attributesHide child attributes
- inactivity_timeoutstring
Idle duration after which the sandbox is automatically terminated.
- namestringIDImmutable
The sandbox resource name, in the form
sandboxes/{sandbox_id}. Derived fromsandbox_id; any value supplied in a create or update request body is ignored.
- display_namestring
Human-readable display label for the sandbox. At most 256 characters.
Response
Returns the Sandbox object.
Delete a sandbox Beta
Start a sandbox Beta
POST
Starts a previously stopped Sandbox under the same sandbox name. Returns NOT_FOUND if there is no stopped sandbox to start for the given name.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to start, in the form
sandboxes/{sandbox_id}.
Response
Returns the Sandbox object.
Stop a sandbox Beta
POST
Stops a running Sandbox, preserving it so it can later be restarted with a Start request.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to stop, in the form
sandboxes/{sandbox_id}.
Response
Returns the Sandbox object.
Run a command in a sandbox and wait for its result Beta
POST
Runs a command in the sandbox and blocks until it exits, returning the captured stdout, stderr and exit code in a single response.
API scopes: sandbox
Parameters
- namestringRequiredpath
Resource name of the sandbox to run the command in, in the form
sandboxes/{sandbox_id}. Bound from the URL path.
Request body
- cmdstringRequired
Executable or command to run (e.g.
/bin/echo,python3).
- argsarray of string
Arguments passed to
cmd.
- envsobject
Extra environment variables for the command's process, merged over the sandbox's default environment.
- execution_timeoutstring
Maximum time to wait for the command to finish. When it elapses the command is terminated and the response carries status
TIMED_OUT. The server applies a default when unset and clamps to an upper bound; negative or otherwise invalid durations are rejected withINVALID_ARGUMENT.
Response
- exit_codeint32Output only
Process exit code. Unset when the process was terminated by a signal (e.g. on
TIMED_OUT) or never started (FAILED) rather than exiting normally.
- statusstringOutput only
Terminal status of the command execution. Always set on a successful response; never
EXECUTE_COMMAND_STATUS_UNSPECIFIED.EXECUTE_COMMAND_STATUS_UNSPECIFIEDEXECUTE_COMMAND_STATUS_COMPLETEDEXECUTE_COMMAND_STATUS_TIMED_OUTEXECUTE_COMMAND_STATUS_FAILED
- stdoutstringOutput only
Captured standard output as UTF-8 text. Invalid UTF-8 bytes are replaced with the Unicode replacement character (U+FFFD).
- stderrstringOutput only
Captured standard error, with the same UTF-8 semantics as
stdout.
- command_idstringOutput only
Daemon-generated identifier for this command execution, for correlation (for example in
ListCommands).
- truncatedbooleanOutput only
True when
stdout/stderrwere truncated because the captured output exceeded the server's per-response size cap. The dropped output is not included in this response and is not recoverable through this unary API.