---
title: "Execute a command synchronously"
method: POST
path: "/browsers/{id_or_name}/process/exec"
tags: ["Browser Processes"]
---

# Execute a command synchronously

`POST /browsers/{id_or_name}/process/exec`

## Request

- Base URL: `https://api.onkernel.com`
- URL: `https://api.onkernel.com/browsers/{id_or_name}/process/exec`
- Auth: HTTP bearer

## Path parameters

- `id_or_name` string, required

## Request body

- ProcessExecRequest: Request to execute a command synchronously.
  - `args` string[]: Command arguments.
  - `as_root` boolean: Run the process with root privileges.
  - `as_user` string, nullable: Run the process as this user.
  - `command` string, required: Executable or shell command to run.
  - `cwd` string, nullable: Working directory (absolute path) to run the command in.
  - `env` object: Environment variables to set for the process.
  - `timeout_sec` integer, nullable: Maximum execution time in seconds.

## Response `200`

Execution result

- ProcessExecResult: Result of a synchronous command execution.
  - `duration_ms` integer: Execution duration in milliseconds.
  - `exit_code` integer: Process exit code.
  - `stderr_b64` string: Base64-encoded stderr buffer.
  - `stdout_b64` string: Base64-encoded stdout buffer.

## Other responses

- `400`: Bad Request – invalid input
- `404`: Resource not found
- `500`: Internal Server Error
- `default`: Error returned by the browser or its proxy

---

[API](https://skmtc.dev/onkernel/apis/kernel-api.md) - [All operations](https://skmtc.dev/onkernel/apis/kernel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/onkernel/apis/kernel-api/revisions/0f6cf4f58fe6?raw)
