WEBINARLive webinar: Terraform in Buddy, Oct 21st.Terraform: plan, approve, apply with state in Buddy. Live on October 21st.Save your seat

Execute Command

View as Markdown
  • POST
  • /workspaces
  • /:workspace
  • /sandboxes
  • /:sandbox_id
  • /exec

Run a command in a sandbox and return its result

Request

REQUIRED SCOPES
SANDBOX_WRITE
URL PARAMETERS
workspacerequiredstring
The human-readable ID of the workspace

Example: "my-company"

sandbox_idrequiredstring
The ID of the sandbox

Example: "sb-1234567890abcdef"

BODY PARAMETERS
commandrequiredstring
Command to execute in the sandbox
runtimestring enum
Runtime environment for command execution (default: BASH)
Allowed enum:
BASH,
JAVASCRIPT,
TYPESCRIPT,
PYTHON

Response

RESPONSE BODY
commandstring
Command to execute in the sandbox
runtimestring enum
Runtime environment for command execution (default: BASH)
Allowed enum:
BASH,
JAVASCRIPT,
TYPESCRIPT,
PYTHON
exit_codeinteger
Command exit code
stdoutstring
Everything the command wrote to standard output
stderrstring
Everything the command wrote to standard error

Last modified on Oct 7, 2026

Request example

curl -X POST "https://api.buddy.works/workspaces/:workspace/sandboxes/:sandbox_id/exec" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "command": "npm test", "runtime": "BASH" }'