Skip to main content
POST
Run Command

Authorizations

Authorization
string
header
required

API key from Settings > Developer > REST API

Headers

Idempotency-Key
string | null

Repeat a request safely: the same key and body return the original result.

Maximum string length: 120

Path Parameters

machine
string
required

Body

application/json
command
string | null

A shell command (run with sh -c).

Required string length: 1 - 65536
argv
string[] | null

Or an argv, no shell.

Required array length: 1 - 4096 elements
cwd
string
default:/project

The working directory (default /project).

Required string length: 1 - 1024
env
Env · object

Extra environment variables.

timeout
integer | null

Kill the command after N s.

Required range: 1 <= x <= 604800
wait
boolean
default:false

Wait up to about 60 s for it to finish and return its output; after that the running job.

Response

Successful Response

job_id
string
required

The job id (mjb_…).

status
enum<string>
required

The state (see the enum).

Available options:
succeeded,
failed,
canceled
exit_code
integer | null
required

The command's exit code, once it has ended.

stdout
string
required

The command's output (stderr is merged into it, in order).

stderr
string
required

Always empty: stderr is merged into stdout.

truncated
boolean
required

True when only the last 256 KB of output is returned.

resumed
boolean
required

True when the machine was paused and resumed for this call.

next
string
required

What to do next, for agents.