Browser API
Base path: /api/browser
All endpoints require authentication. See API Overview for auth details.
Session management
Section titled “Session management”Get browser status
Section titled “Get browser status”GET /api/browser/statusResponse:
{ "running": true, "backend": "managed", "current_url": "https://github.com", "tabs": 2, "uptime_seconds": 3600}Close the browser
Section titled “Close the browser”POST /api/browser/closeCloses the browser session. Equivalent to clicking Close Browser in the UI.
Actions
Section titled “Actions”Execute a browser action
Section titled “Execute a browser action”POST /api/browser/actionGeneral-purpose action endpoint. All browser interactions (navigation, clicking, typing, etc.) go through this single endpoint:
{ "action": "goto", "url": "https://github.com/trending"}{ "action": "click", "selector": "#sign-in-button"}{ "action": "type_text", "selector": "input[name=email]", "text": "user@example.com"}{ "action": "scroll", "x": 0, "y": 500}{ "action": "press_key", "key": "Enter"}Available actions: goto, click, double_click, right_click, hover, type_text, press_key, select_option, check, uncheck, scroll, scroll_to_element, drag_and_drop, focus, blur, handle_dialog, wait_for_selector, wait_for_navigation, wait_for_network_idle, go_back, go_forward, reload
Screenshots
Section titled “Screenshots”Get screenshot (polling)
Section titled “Get screenshot (polling)”GET /api/browser/screenshotReturns the current viewport as a binary image.
Take screenshot
Section titled “Take screenshot”POST /api/browser/screenshotTakes a screenshot with optional format/quality options:
{"format": "jpeg", "quality": 85}Returns a binary image response (JPEG or PNG).
DOM Snapshot
Section titled “DOM Snapshot”Get snapshot
Section titled “Get snapshot”GET /api/browser/snapshotReturns a numbered, AI-friendly representation of interactive elements:
{ "snapshot": "[1] Sign in (button)\n[2] Email (input)\n[3] Password (input)\n[4] Remember me (checkbox)\n", "element_count": 47, "url": "https://example.com/login"}GET /api/browser/tabsPOST /api/browser/tabsDELETE /api/browser/tabs/{tab_id}PUT /api/browser/tabs/{tab_id}/activateManage browser tabs — list, create, close, and switch between tabs.
Network
Section titled “Network”Get network requests
Section titled “Get network requests”GET /api/browser/requestsReturns recent network requests.
Start HAR capture
Section titled “Start HAR capture”POST /api/browser/har/startStop HAR capture
Section titled “Stop HAR capture”POST /api/browser/har/stopReturns the captured HAR data.
Add a mock
Section titled “Add a mock”POST /api/browser/mock{ "url_pattern": "*/api/users", "status_code": 200, "body": {"users": []}, "headers": {"Content-Type": "application/json"}}Clear mocks
Section titled “Clear mocks”DELETE /api/browser/mockCookies
Section titled “Cookies”GET /api/browser/cookiesPOST /api/browser/cookiesDELETE /api/browser/cookiesGet, set, or clear browser cookies.
Auth states
Section titled “Auth states”GET /api/browser/auth-statesPOST /api/browser/auth-statesPOST /api/browser/auth-states/{name}/restoreDELETE /api/browser/auth-states/{name}Save and restore authentication state (cookies + localStorage) for reuse across sessions.
Recording
Section titled “Recording”Start recording
Section titled “Start recording”POST /api/browser/recording/start{"name": "login-flow-test"}Stop recording
Section titled “Stop recording”POST /api/browser/recording/stopReturns:
{ "recording_id": "rec_abc123", "duration_seconds": 45, "action_count": 12, "file_path": "workspace/recordings/login-flow-test.json"}List recordings
Section titled “List recordings”GET /api/browser/recordingsReplay a recording
Section titled “Replay a recording”POST /api/browser/recordings/{id}/replayGet or delete a recording
Section titled “Get or delete a recording”GET /api/browser/recordings/{id}DELETE /api/browser/recordings/{id}Device emulation
Section titled “Device emulation”Set device emulation
Section titled “Set device emulation”POST /api/browser/emulation{ "preset": "iPhone 14 Pro"}Or custom:
{ "viewport": {"width": 375, "height": 812}, "device_scale_factor": 3, "is_mobile": true, "user_agent": "Mozilla/5.0 (iPhone...)"}Set profile
Section titled “Set profile”POST /api/browser/profileSet a browser profile (user agent, locale, etc.).
Screen recording
Section titled “Screen recording”POST /api/browser/screen-recordingPOST /api/browser/screen-recording/from-recording/{recording_id}Record the browser viewport as video, or generate a video from an existing action recording.
Live stream
Section titled “Live stream”WebSocket stream
Section titled “WebSocket stream”WS /api/browser/streamReceives screenshot frames as binary WebSocket messages at up to 2 fps. The UI’s Browser page uses this for the live viewport.
Configuration
Section titled “Configuration”GET /api/browser/configPUT /api/browser/config{ "backend": "managed", "headless": true, "auto_snapshot": true, "snapshot_interval_ms": 500, "stream_fps": 2, "stream_quality": 75, "ssrf_allowlist": [], "ssrf_blocklist": []}