Skip to main content

Endpoint

POST /tabs/:id/press
Press a keyboard key (e.g., Enter, Tab, Escape, ArrowDown).

Authentication

Requires userId in the request body to identify the session owner.

Parameters

id
string
required
The tab ID returned from POST /tabs
userId
string
required
The user ID that owns this tab’s session
key
string
required
The key to press. Supports all Playwright keyboard keys:
  • Character keys: "a", "B", "1", "#"
  • Special keys: "Enter", "Tab", "Escape", "Backspace", "Delete"
  • Arrow keys: "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"
  • Modifier keys: "Shift", "Control", "Alt", "Meta"
  • Function keys: "F1" through "F12"
  • Navigation: "Home", "End", "PageUp", "PageDown"

Response

ok
boolean
true if the key was pressed successfully

Example

curl -X POST http://localhost:9377/tabs/abc123/press \
  -H 'Content-Type: application/json' \
  -d '{
    "userId": "agent1",
    "key": "Enter"
  }'
Response:
{
  "ok": true
}

Common use cases

Submit a form

# Focus a submit button and press Enter
curl -X POST http://localhost:9377/tabs/abc123/click \
  -d '{"userId": "agent1", "ref": "e5"}'

curl -X POST http://localhost:9377/tabs/abc123/press \
  -d '{"userId": "agent1", "key": "Enter"}'
# Press Tab to focus next element
curl -X POST http://localhost:9377/tabs/abc123/press \
  -d '{"userId": "agent1", "key": "Tab"}'

# Press Escape to close a modal
curl -X POST http://localhost:9377/tabs/abc123/press \
  -d '{"userId": "agent1", "key": "Escape"}'

Scroll with arrow keys

# Scroll down with ArrowDown
curl -X POST http://localhost:9377/tabs/abc123/press \
  -d '{"userId": "agent1", "key": "ArrowDown"}'

Error responses

StatusErrorCause
400userId is requiredMissing userId in request body
400key is requiredMissing key in request body
404Tab not foundTab ID doesn’t exist or doesn’t belong to this user
500Internal server errorPlaywright error, page closed, or timeout

Notes

  • Key names are case-sensitive: use "Enter" not "enter"
  • Modifier keys can be combined with +: "Control+c", "Shift+Tab"
  • Key press happens wherever focus currently is on the page
  • Use /type endpoint instead for typing text strings
  • For pressing Enter after typing, use the pressEnter parameter in /type

Build docs developers (and LLMs) love