Run Command

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

Execute a command in a sandbox

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"

GET PARAMETERS
fastboolean
If true, the command runs synchronously and the response carries its output and exit code. The command is not saved in the sandbox command history, produces no logs to stream and cannot be terminated. Commands that do not finish within 60 seconds fail - use the default mode for those.

Example: true

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

Last modified on Apr 22, 2026

Request example

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

Response examples

command
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/my-workspace/sandboxes/sb-12345/commands/cmd-abc123def456", "html_url": null, "id": "cmd-abc123def456", "command": "npm test", "runtime": "BASH", "status": "SUCCESSFUL", "exit_code": 0, "logs_url": "https://api.buddy.works/workspaces/my-workspace/sandboxes/sb-12345/commands/cmd-abc123def456/logs" }
STATUS
200 OK
fast
EXAMPLE RESPONSE
{ "command": "npm test", "runtime": "BASH", "exit_code": 0, "stdout": "All tests passed\n", "stderr": "" }
STATUS
200 OK