---
title: "Press one or more keys on the host computer"
method: POST
path: "/computer/press_key"
---

# Press one or more keys on the host computer

`POST /computer/press_key`

Presses the specified keys for an optional duration. Keys should be key symbols
supported by xdotool. For a comprehensive list of key symbols, see
the X11 keysym definitions at https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h
The server honors millisecond-level durations using fractional sleeps under the hood.

## Request body

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

## Response `200`

Keys pressed successfully

## Other responses

- `400` — Bad Request
- `500` — Internal Server Error

## Changes

> 52 revisions in range; 3 could not be searched.

- **2025-10-16** `5ba7ffc94918` — 1 info
  - endpoint added
- **2025-06-27** `f980a92ab23f` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/kernel/apis/kernel-images-api/changes/computer/press_key/post.md)

---

[API](https://skmtc.dev/kernel/apis/kernel-images-api.md) · [All operations](https://skmtc.dev/kernel/apis/kernel-images-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kernel/kernel-images-api/revisions/7a641fa15a85/schema)
