POST /v2/sandboxes/sessions/{sessionId}/cmd

Executes a shell command inside a running session. The command runs asynchronously and returns immediately with a command ID that can be used to track its progress and retrieve its output. Optionally, use the wait parameter to stream the command status until completion.

Servers

Path parameters

Name Type Required Description
sessionId String Yes

The unique identifier of the session in which to execute the command.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Query parameters

Name Type Required Description
teamId String No

The Team identifier to perform the request on behalf of.

slug String No

The Team slug to perform the request on behalf of.

cmdId String Yes

The unique identifier of the command to stream logs for.

Request body fields

Name Type Required Description
env Object No

Additional environment variables to set for this command. These are merged with the sandbox environment.

cwd String No

The working directory in which to execute the command. Defaults to the sandbox home directory if not specified.

sudo Boolean No

Execute the command with root (superuser) privileges.

Default value: false

command String Yes

The executable or shell command to run. This is the program name without arguments.

logs Boolean No

If true, stream the logs of the command execution in real-time via ND-JSON. This is only applicable if wait is also true.

Default value: false

timeout Integer No

Maximum duration in milliseconds the command may run before it is killed with SIGKILL. Enforced at exec time, independently of wait.

wait Boolean No

If true, returns an ND-JSON stream that emits the command status when started and again when finished. Useful for synchronously waiting for command completion.

Default value: false

args[] Array No

Arguments to pass to the command. Each argument should be a separate array element.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.