Skip to main content
POST
/
browsers
/
{id}
/
process
/
exec
Execute a command synchronously
curl --request POST \
  --url https://api.onkernel.com/browsers/{id}/process/exec \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "command": "<string>",
  "args": [],
  "cwd": "<string>",
  "env": {},
  "as_user": "<string>",
  "as_root": false,
  "timeout_sec": 123
}
'
{
  "exit_code": 123,
  "stdout_b64": "<string>",
  "stderr_b64": "<string>",
  "duration_ms": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Browser session ID

Body

application/json

Request to execute a command synchronously.

command
string
required

Executable or shell command to run.

args
string[]

Command arguments.

cwd
string | null

Working directory (absolute path) to run the command in.

env
object

Environment variables to set for the process.

as_user
string | null

Run the process as this user.

as_root
boolean
default:false

Run the process with root privileges.

timeout_sec
integer | null

Maximum execution time in seconds.

Response

Execution result

Result of a synchronous command execution.

exit_code
integer

Process exit code.

stdout_b64
string

Base64-encoded stdout buffer.

stderr_b64
string

Base64-encoded stderr buffer.

duration_ms
integer

Execution duration in milliseconds.