Skip to main content
POST
/
boxes
/
{boxId}
/
commands
Execute a command in a Box
curl --request POST \
  --url https://ascii.dev/api/box/v1/boxes/{boxId}/commands \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "command": "<string>",
  "cwd": "<string>",
  "timeoutSeconds": 30
}
'
{
  "ok": true,
  "type": "<string>",
  "success": true,
  "exitCode": 123,
  "stdout": "<string>",
  "stderr": "<string>",
  "timedOut": true,
  "signal": "<string>",
  "stdoutTruncated": true,
  "stderrTruncated": true,
  "cwd": "<string>",
  "startedAt": "2023-11-07T05:31:56Z",
  "finishedAt": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Box API key in the form box_.... Create and rotate keys in the Box dashboard or through the v1 API key endpoints.

Path Parameters

boxId
string
required

Public Box id returned by create/list/get box calls.

Pattern: ^bx_[23456789abcdefghjkmnpqrstuvwxyz]{8}$

Body

application/json
command
string
required
cwd
string

Relative working directory inside the Box work directory.

timeoutSeconds
integer
default:30
Required range: 1 <= x <= 60

Response

200 - application/json

Command result.

ok
boolean
required
Example:

true

type
string
required

Stable success envelope discriminator added by v1.

Allowed value: "command.finished"
success
boolean
required
exitCode
integer | null
required
stdout
string
required
stderr
string
required
timedOut
boolean
required
signal
string | null
stdoutTruncated
boolean
stderrTruncated
boolean
cwd
string
startedAt
string<date-time>
finishedAt
string<date-time>