ABP REST API Reference

March 4, 2026 · View on GitHub

The Agent Browser Protocol (ABP) exposes a REST API on localhost:8222 for AI agent browser control. All endpoints use JSON request/response bodies and operate directly at the browser engine level for low latency and high capability.


Quick Start

1. Start ABP

macOS:

./ABP.app/Contents/MacOS/ABP

Linux:

./abp

2. Verify the browser is ready

curl http://localhost:8222/api/v1/browser/status

3. Full walkthrough

# List open tabs
curl http://localhost:8222/api/v1/tabs

# Create a new tab
curl -X POST http://localhost:8222/api/v1/tabs \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

# Navigate an existing tab (replace {tab_id} with actual ID from above)
curl -X POST http://localhost:8222/api/v1/tabs/{tab_id}/navigate \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

# Click at coordinates
curl -X POST http://localhost:8222/api/v1/tabs/{tab_id}/click \
  -H "Content-Type: application/json" \
  -d '{"x":100,"y":200}'

# Type text
curl -X POST http://localhost:8222/api/v1/tabs/{tab_id}/type \
  -H "Content-Type: application/json" \
  -d '{"text":"hello world"}'

# Take a screenshot with interactive element markup
curl -X POST http://localhost:8222/api/v1/tabs/{tab_id}/screenshot \
  -H "Content-Type: application/json" \
  -d '{"screenshot":{"markup":"interactive","format":"webp"}}'

# Get page text
curl -X POST http://localhost:8222/api/v1/tabs/{tab_id}/text \
  -H "Content-Type: application/json" \
  -d '{}'

# Execute JavaScript (note: parameter is "script", not "expression")
curl -X POST http://localhost:8222/api/v1/tabs/{tab_id}/execute \
  -H "Content-Type: application/json" \
  -d '{"script":"document.title"}'

# Binary screenshot (returns image/webp directly)
curl http://localhost:8222/api/v1/tabs/{tab_id}/screenshot?markup=interactive -o screenshot.webp

# Close the tab
curl -X DELETE http://localhost:8222/api/v1/tabs/{tab_id}

Standard Response Envelope

Every action endpoint returns a standard response envelope with the following fields:

{
  "result": { },
  "screenshot_before": {
    "data": "<base64-encoded image>",
    "width": 1280,
    "height": 720,
    "virtual_time_ms": 0,
    "format": "webp"
  },
  "screenshot_after": {
    "data": "<base64-encoded image>",
    "width": 1280,
    "height": 720,
    "virtual_time_ms": 0,
    "format": "webp"
  },
  "scroll": {
    "scrollX": 0,
    "scrollY": 150,
    "pageWidth": 1280,
    "pageHeight": 4000,
    "viewportWidth": 1280,
    "viewportHeight": 720
  },
  "events": [
    {
      "type": "navigation",
      "virtual_time_ms": 0,
      "data": { }
    }
  ],
  "timing": {
    "action_started_ms": 1700000000000,
    "action_completed_ms": 1700000000050,
    "wait_completed_ms": 1700000000050,
    "duration_ms": 50
  },
  "cursor": {
    "x": 100,
    "y": 200,
    "cursor_type": "pointer"
  },
  "virtual_time": {
    "paused": false,
    "base_ticks_ms": 0
  }
}
FieldDescription
resultAction-specific result data (varies by endpoint)
screenshot_beforeBase64-encoded WebP screenshot taken before the action
screenshot_afterBase64-encoded WebP screenshot taken after the action
scrollCurrent scroll position and page/viewport dimensions
eventsArray of events that occurred during the action
timingTimestamps and duration of the action lifecycle
cursorCurrent cursor position and CSS cursor type
virtual_timeVirtual time state (present when execution control is enabled)

Screenshot Options

Screenshots can be customized via the screenshot field in action request bodies or via query parameters on the GET endpoint.

Markup

The markup field controls which element overlays are drawn on the screenshot. It accepts either a preset string or an array of overlay types:

Preset:

  • "interactive" — equivalent to ["clickable", "typeable", "scrollable"]

Individual overlay types (array):

TypeDescription
clickableHighlights clickable elements (links, buttons, etc.)
typeableHighlights text input fields
scrollableHighlights scrollable containers
gridDraws a coordinate grid overlay
selectedHighlights the currently selected/focused element

Example:

{
  "screenshot": {
    "markup": ["clickable", "typeable", "grid"]
  }
}

Other Options

FieldTypeDescription
disable_markupbooleanSet to true to disable all markup overlays
formatstringImage format: "png", "webp" (default), or "jpeg"

Event Types

Events are collected during action execution and returned in the events array of the response envelope.

TypeDescription
navigationPage navigation occurred (load, redirect, etc.)
dialogA JavaScript dialog appeared (alert, confirm, prompt, beforeunload)
file_chooserA file picker dialog was opened
popupA popup window was opened
tab_closedA tab was closed
scrollThe page was scrolled
download_startedA file download began
download_completedA file download finished
file_selectedFiles were chosen or saved in a file chooser
file_chooser_cancelledA file chooser was dismissed without selection
select_openA native <select> dropdown opened (includes option list)
permission_requestedA permission prompt appeared (geolocation, camera, etc.)

Each event includes:

  • type — one of the types above
  • virtual_time_ms — virtual time when the event occurred
  • data — event-specific payload

Endpoint Reference

All endpoints are prefixed with /api/v1.

Browser

MethodPathDescription
GET/browser/statusGet browser readiness status
GET/browser/session-dataGet session data file paths
POST/browser/shutdownGraceful browser shutdown

Tabs

MethodPathDescription
GET/tabsList all open tabs
GET/tabs/{id}Get tab details
POST/tabsCreate a new tab
DELETE/tabs/{id}Close a tab
POST/tabs/{id}/activateSwitch to a tab
POST/tabs/{id}/stopStop page loading
MethodPathDescription
POST/tabs/{id}/navigateNavigate to a URL
POST/tabs/{id}/backGo back in history
POST/tabs/{id}/forwardGo forward in history
POST/tabs/{id}/reloadReload the page

Mouse

MethodPathDescription
POST/tabs/{id}/clickClick at coordinates
POST/tabs/{id}/moveMove mouse to coordinates
POST/tabs/{id}/scrollScroll via mouse wheel at coordinates
POST/tabs/{id}/dragDrag from start to end coordinates

Keyboard

MethodPathDescription
POST/tabs/{id}/typeType text string
POST/tabs/{id}/keyboard/pressPress a key combination
POST/tabs/{id}/keyboard/downKey down event
POST/tabs/{id}/keyboard/upKey up event

Input Helpers

MethodPathDescription
POST/tabs/{id}/sliderMove a slider to a target value
POST/tabs/{id}/clear-textClear an input field (click, select all, backspace)

Screenshots

MethodPathDescription
GET/tabs/{id}/screenshotBinary screenshot (returns image directly)
POST/tabs/{id}/screenshotScreenshot via action envelope

Content

MethodPathDescription
POST/tabs/{id}/executeExecute JavaScript (script parameter)
POST/tabs/{id}/textGet page text (or text from a CSS selector)

Wait

MethodPathDescription
POST/tabs/{id}/waitWait for a specified duration

Dialogs

MethodPathDescription
GET/tabs/{id}/dialogGet pending dialog info
POST/tabs/{id}/dialog/acceptAccept the pending dialog
POST/tabs/{id}/dialog/dismissDismiss the pending dialog

Execution Control

MethodPathDescription
GET/tabs/{id}/executionGet execution state (paused/running)
POST/tabs/{id}/executionSet execution state (pause/resume with virtual time)

Downloads

MethodPathDescription
GET/downloadsList all downloads
GET/downloads/{id}Get download status
POST/downloads/{id}/cancelCancel a download
GET/downloads/{id}/contentGet download content as base64

File Chooser

MethodPathDescription
POST/file-chooser/{id}Provide files to a native file picker dialog

Popups

MethodPathDescription
POST/select/{id}Respond to a native <select> dropdown

Permissions

MethodPathDescription
GET/permissionsList pending permission requests
POST/permissions/{id}/grantGrant a permission (geolocation requires lat/lng)
POST/permissions/{id}/denyDeny a permission

History

MethodPathDescription
GET/history/sessionsList all sessions
GET/history/sessions/currentGet the current session
GET/history/sessions/{id}Get a session by ID
GET/history/sessions/{id}/exportExport a session
GET/history/actionsList actions
GET/history/actions/{id}Get an action by ID
GET/history/actions/{id}/screenshotGet an action's screenshot
DELETE/history/actionsDelete actions
GET/history/eventsList events
GET/history/events/{id}Get an event by ID
DELETE/history/eventsDelete events
DELETE/historyDelete all history

Batch

MethodPathDescription
POST/tabs/{id}/batchExecute multiple actions in sequence

Full Specification

For detailed request/response schemas, parameter descriptions, and implementation notes, see plans/API.md.