---
title: "Press one or more keys on the host computer"
method: POST
path: "/browsers/{id_or_name}/computer/press_key"
tags: ["Browser Computer Controls"]
---

# Press one or more keys on the host computer

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

## Request

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

## Path parameters

- `id_or_name` string, required

## Request body

- 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".

## Response `200`

Keys pressed 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)
