Skip to main content

Press Key

POST /v1/browser/interactions/keypress

Press a key in the active tab of your browser session.

Pass a selector or element_ref to focus that element first; without one the key goes to whatever has focus. If the browser's reply is lost, the call still returns 200 with success false and error_code outcome_unknown: inspect the page before you retry.

Authentication​

Requires authentication via: OAuth2PasswordBearer.

Parameters​

NameInTypeRequiredDescriptionConstraints
X-API-Keyheaderstring | nullNonullable

Request Body​

Required: Yes

application/json​

Resolved schema:

{
"properties": {
"session_id": {
"type": "string",
"title": "Session Id"
},
"key": {
"type": "string",
"maxLength": 80,
"minLength": 1,
"title": "Key"
},
"selector": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Selector"
},
"element_ref": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Element Ref"
},
"timeout": {
"type": "integer",
"maximum": 30000,
"minimum": 1,
"title": "Timeout",
"default": 15000
}
},
"type": "object",
"required": [
"session_id",
"key"
],
"title": "BrowserKeyPressRequest"
}

Field details:

FieldTypeRequiredDescriptionConstraints
session_idstringYes
keystringYesminLength=1, maxLength=80
selectorstring | nullNonullable
element_refstring | nullNonullable
timeoutintegerNodefault=15000, min=1, max=30000

Responses​

200​

Successful Response

application/json​

Resolved schema:

{
"properties": {
"success": {
"type": "boolean",
"title": "Success"
},
"message": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Message"
},
"execution_time": {
"type": "number",
"title": "Execution Time"
},
"session_id": {
"type": "string",
"title": "Session Id"
},
"data": {
"anyOf": [
{
"type": "object"
},
{
"type": "null"
}
],
"title": "Data"
}
},
"type": "object",
"required": [
"success",
"execution_time",
"session_id"
],
"title": "BrowserInteractionResponse",
"description": "Generic response for browser interactions"
}

Field details:

FieldTypeRequiredDescriptionConstraints
successbooleanYes
messagestring | nullNonullable
execution_timenumberYes
session_idstringYes
dataobject | nullNonullable

400​

session_id is missing or empty.

No response body.

401​

No credentials, or the Bearer token / X-API-Key is invalid.

No response body.

403​

The account is disabled, or a guest token was used.

No response body.

404​

Session not found, expired, or not yours.

No response body.

422​

Validation Error

application/json​

Resolved schema:

{
"properties": {
"detail": {
"items": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
}

Field details:

FieldTypeRequiredDescriptionConstraints
detailarray<object>No
detail[]objectNo
detail[].locarray<string | integer>No
detail[].loc[]string | integerNo
detail[].msgstringNo
detail[].typestringNo