v13
latestOpenAPI 3.0.32026-07-31359869.4 MBsandboxes
Execute a command
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.
post/v2/sandboxes/sessions/{sessionId}/cmd
Path parameters
sessionIdstring required
The unique identifier of the session in which to execute the command.
Example:sbx_abc123
The unique identifier of the session in which to execute the command.
Query parameters
cmdIdstring required
The unique identifier of the command to stream logs for.
Example:cmd_abc123
The unique identifier of the command to stream logs for.
teamIdstring
Example:team_1a2b3c4d5e6f7g8h9i0j1k2l
The Team identifier to perform the request on behalf of.
slugstring
Example:my-team-url-slug
The Team slug to perform the request on behalf of.
Request body
Example request
{
"command": "npm",
"args": [
"install",
"--save",
"lodash"
],
"cwd": "/home/vercel-sandbox",
"env": {
"NODE_ENV": "production",
"DEBUG": "true"
},
"timeout": 30000
}Response
Example response
{
"command": {
"id": "cmd_123a6c5209bc3778245d011443644c8d27dc2c50",
"name": "npm",
"args": [
"run",
"build"
],
"cwd": "/vercel/sandbox",
"sessionId": "sbx_123a6c5209bc3778245d011443644c8d27dc2c50",
"startedAt": 1673123456789,
"durationMs": 1234
}
}