Sandboxes

Run a command inside the sandbox (`@vercel/sandbox`-compatible).

wait=false (default) returns { command: {..., exitCode: null} } immediately once the background task is spawned.

wait=true streams application/x-ndjson: the first line is the running envelope, the second is the finished envelope with exitCode.

post/v1/sandboxes/{id}/cmd

Request

  • Base URL: /api (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/v1/sandboxes/{id}/cmd
  • Auth: HTTP bearer

Path parameters

idstring required

Request body

argsstring[]

Arguments to pass to the binary. Defaults to empty.

commandstring required

Binary name (argv[0]) — e.g. "ls", "node". The SDK sends this separately from args.

cwdstring nullable

Working directory override.

envobject

Extra env vars.

sudoboolean

When true, the SDK runs the command privileged. We ignore it today — the underlying provider always runs as the sandbox's own user.

waitboolean

When true, the response is an application/x-ndjson stream where the first line is the running-command envelope and the second line is the finished-command envelope with exitCode.

Response

Command started (wait=false) or finished (wait=true)

Changes

No recorded changes to this operation across all 50 revisions of this API.