---
title: "Execute a command asynchronously"
method: POST
path: "/browsers/{id}/process/spawn"
tags: ["Browser Processes"]
---

# Execute a command asynchronously

`POST /browsers/{id}/process/spawn`

## Path parameters

- `id` string, required

## Request body

- ProcessSpawnRequest — Request to execute a command synchronously.
  - `command` string, required — Executable or shell command to run.
  - `args` string[] — Command arguments.
  - `cwd` string, nullable — Working directory (absolute path) to run the command in.
  - `env` object — Environment variables to set for the process.
  - `as_user` string, nullable — Run the process as this user.
  - `as_root` boolean — Run the process with root privileges.
  - `timeout_sec` integer, nullable — Maximum execution time in seconds.
  - `allocate_tty` boolean — Allocate a pseudo-terminal (PTY) for interactive shells.
  - `rows` integer — Initial terminal rows. Only used when allocate_tty is true.
  - `cols` integer — Initial terminal columns. Only used when allocate_tty is true.

## Response `200`

Spawned

- ProcessSpawnResult — 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.

## Other responses

- `400` — Bad Request – invalid input
- `404` — Resource not found
- `500` — Internal Server Error

---

[API](https://skmtc.net/kernel/apis/kernel-api.md) · [All operations](https://skmtc.net/kernel/apis/kernel-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kernel/kernel-api/versions/9e8ce9fcf5e1/schema)
