Skip to main content
POST
/
computers
/
{id}
/
execute
curl -X POST https://api.tzafon.ai/computers/comp_123/execute \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "click",
    "x": 100,
    "y": 200,
    "include_context": true
  }'
{
  "status": "success",
  "result": {},
  "timestamp": "2025-01-16T12:00:00Z",
  "request_id": "req_abc123",
  "executed_tab_id": "tab_main",
  "page_context": {
    "url": "https://example.com",
    "title": "Example",
    "viewport_width": 1280,
    "viewport_height": 720,
    "scroll_x": 0,
    "scroll_y": 0
  }
}

Path Parameters

id
string
required
Session ID

Request Body

type
string
required
Action type. See table below for all options.
x
number
X coordinate (for click, scroll actions)
y
number
Y coordinate (for click, scroll actions)
text
string
Text to type (for type action)
keys
array
Keys to press (for keypress action)
url
string
URL to navigate to (for go_to_url action)
tab_id
string
Target tab ID (for multi-tab operations)
include_context
boolean
default:"false"
Include page context in response

Action Types

TypeDescriptionParameters
go_to_urlNavigate to URLurl
clickClick at coordinatesx, y
double_clickDouble-clickx, y
right_clickRight-clickx, y
dragDrag from A to Bx1, y1, x2, y2
typeType texttext
keypressPress keyskeys
key_downHold keykey
key_upRelease keykey
mouse_downPress mousex, y
mouse_upRelease mousex, y
scrollScroll viewportdx, dy, x, y
screenshotCapture screenbase64
get_html_contentGet page HTMLauto_detect_encoding
set_viewportSet viewport sizewidth, height, scale_factor
waitWait durationms
change_proxyChange proxyproxy_url

Response

status
string
required
success or error
result
object
Action-specific result data
timestamp
string
ISO 8601 timestamp
request_id
string
Request correlation ID
executed_tab_id
string
Tab where action executed
page_context
object
Page state (when include_context=true)
curl -X POST https://api.tzafon.ai/computers/comp_123/execute \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "click",
    "x": 100,
    "y": 200,
    "include_context": true
  }'
{
  "status": "success",
  "result": {},
  "timestamp": "2025-01-16T12:00:00Z",
  "request_id": "req_abc123",
  "executed_tab_id": "tab_main",
  "page_context": {
    "url": "https://example.com",
    "title": "Example",
    "viewport_width": 1280,
    "viewport_height": 720,
    "scroll_x": 0,
    "scroll_y": 0
  }
}
Execute multiple actions in sequence:
POST /computers/{id}/batch
curl -X POST https://api.tzafon.ai/computers/comp_123/batch \
  -H "Authorization: Bearer sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "actions": [
      {"type": "go_to_url", "url": "https://example.com"},
      {"type": "wait", "ms": 2000},
      {"type": "click", "x": 100, "y": 200},
      {"type": "screenshot"}
    ]
  }'
Batch actions stop on first error. Results are returned for all executed actions.

Simplified Endpoints

Individual action endpoints are also available:
EndpointMethod
/computers/{id}/navigatePOST
/computers/{id}/clickPOST
/computers/{id}/typePOST
/computers/{id}/screenshotPOST
/computers/{id}/scrollPOST
/computers/{id}/viewportPOST
/computers/{id}/htmlPOST
/computers/{id}/keepalivePOST