---
title: "Execute a batch of computer actions sequentially"
method: POST
path: "/browsers/{id_or_name}/computer/batch"
tags: ["Browser Computer Controls"]
---

# Execute a batch of computer actions sequentially

`POST /browsers/{id_or_name}/computer/batch`

## Request

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

Send an array of computer actions to execute in order on the browser instance.
Execution stops on the first error. This reduces network latency compared to
sending individual action requests.

## Path parameters

- `id_or_name` string, required

## Request body

- BatchComputerActionRequest: A batch of computer actions to execute sequentially.
  - `actions` ComputerAction[], required: Ordered list of actions to execute. Execution stops on the first error.
    - `click_mouse` ClickMouseRequest
      - `button` 'left' | 'right' | 'middle' | 'back' | 'forward': Mouse button to interact with
      - `click_type` 'down' | 'up' | 'click': Type of click action
      - `hold_keys` string[]: Modifier keys to hold during the click
      - `num_clicks` integer: Number of times to repeat the click
      - `true` integer: Y coordinate of the click position
      - `x` integer, required: X coordinate of the click position
    - `drag_mouse` DragMouseRequest
      - `button` 'left' | 'middle' | 'right': Mouse button to drag with
      - `delay` integer: Delay in milliseconds between button down and starting to move along the path.
      - `duration_ms` integer: Target total duration in milliseconds for the entire drag movement when smooth=true. Omit for automatic timing based on total path length.
      - `hold_keys` string[]: Modifier keys to hold during the drag
      - `path` array[], required: Ordered list of [x, y] coordinate pairs to move through while dragging. Must contain at least 2 points.
        - integer[]
      - `smooth` boolean: Use human-like Bezier curves between path waypoints instead of linear interpolation. When true, steps_per_segment and step_delay_ms are ignored.
      - `step_delay_ms` integer: Delay in milliseconds between relative steps while dragging (not the initial delay).
      - `steps_per_segment` integer: Number of relative move steps per segment in the path. Minimum 1.
    - `move_mouse` MoveMouseRequest
      - `duration_ms` integer: Target total duration in milliseconds for the mouse movement when smooth=true. Omit for automatic timing based on distance.
      - `hold_keys` string[]: Modifier keys to hold during the move
      - `smooth` boolean: Use human-like Bezier curve path instead of instant mouse movement.
      - `true` integer: Y coordinate to move the cursor to
      - `x` integer, required: X coordinate to move the cursor to
    - `press_key` PressKeyRequest
      - `duration` integer: Duration to hold the keys down in milliseconds. If omitted or 0, keys are tapped.
      - `hold_keys` string[]: Optional modifier keys to hold during the key press sequence.
      - `keys` string[], required: List of key symbols to press. Each item should be a key symbol supported by xdotool (see X11 keysym definitions). Examples include "Return", "Shift", "Ctrl", "Alt", "F5". Items in this list could also be combinations, e.g. "Ctrl+t" or "Ctrl+Shift+Tab". Use X11 names for punctuation in combinations, such as "Ctrl+minus" or "Ctrl+plus". A literal hyphen is also accepted as an alias, so "Ctrl+-" is normalized to "Ctrl+minus".
    - `scroll` ScrollRequest
      - `delta_x` integer: Horizontal scroll amount in xdotool "wheel units." Positive scrolls right, negative scrolls left.
      - `delta_y` integer: Vertical scroll amount in xdotool "wheel units." Positive scrolls down, negative scrolls up.
      - `hold_keys` string[]: Modifier keys to hold during the scroll
      - `true` integer: Y coordinate at which to perform the scroll
      - `x` integer, required: X coordinate at which to perform the scroll
    - `set_cursor` SetCursorRequest
      - `hidden` boolean, required: Whether the cursor should be hidden or visible
    - `sleep` SleepAction: Pause execution for a specified duration.
      - `duration_ms` integer, required: Duration to sleep in milliseconds.
    - `type` 'click_mouse' | 'move_mouse' | 'type_text' | 'press_key' | 'scroll' | 'drag_mouse' | 'set_cursor' | 'sleep', required: The type of action to perform.
    - `type_text` TypeTextRequest
      - `delay` integer: Delay in milliseconds between keystrokes
      - `text` string, required: Text to type on the browser instance

## Response `200`

All actions executed successfully

## 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/kernel/apis/kernel-api.md) - [All operations](https://skmtc.dev/kernel/apis/kernel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kernel/apis/kernel-api/revisions/0f6cf4f58fe6?raw)
