Skip to main content
POST
/
browsers
/
{id}
/
process
/
spawn
Execute a command asynchronously
curl --request POST \
  --url https://api.onkernel.com/browsers/{id}/process/spawn \
  --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,
  "allocate_tty": false,
  "rows": 32768,
  "cols": 32768
}
'
{
  "process_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "pid": 123,
  "started_at": "2023-11-07T05:31:56Z"
}

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.

allocate_tty
boolean
default:false

Allocate a pseudo-terminal (PTY) for interactive shells.

rows
integer

Initial terminal rows. Only used when allocate_tty is true.

Required range: 1 <= x <= 65535
cols
integer

Initial terminal columns. Only used when allocate_tty is true.

Required range: 1 <= x <= 65535

Response

Spawned

Information about a spawned process.

process_id
string<uuid>

Server-assigned identifier for the process.

pid
integer

OS process ID.

started_at
string<date-time>

Timestamp when the process started.