Docs / API reference

API Reference

Drive a real, hosted browser — open pages, read them, click/type, extract data. All routes below are served from https://app.getagentbrowser.com. This page is rendered directly from the live, machine-readable contract at /.well-known/openapi.yaml (OpenAPI 3.0.1) — also published as /.well-known/ai-plugin.json for GPT-plugin discovery.

Authentication

Every REST request carries an Authorization: Bearer header with a workspace API key. AgentBrowser's separate MCP server surface (clients & integrations) uses its own short-lived, self-issued OAuth2 client-credentials tokens instead — see the raw spec's components.securitySchemes.mcpOAuth for that flow.

POST /api/sessions

Open a hosted browser session on a live render node.

Operation ID: createSession

Request body (optional)

FieldTypeDescription
urlstringOptional public HTTP(S) URL to open immediately (default about:blank). Exact about:blank is allowed; credentials, loopback, private, link-local, metadata, mixed public/private DNS answers, and every other scheme are rejected.
profilestringmobile emulates an iPhone-class device (viewport, UA, touch).

desktop mobile

recordbooleanCapture video + console/network/DOM events, downloadable as a tar.gz. Not supported when cdp is true.
dombooleanAlso record an rrweb-style DOM track. Not supported when cdp is true.
no_videobooleanSkip the mp4 (events only). Not supported when cdp is true.
cdpbooleanRaw-CDP session: allocate a dedicated, isolated browser you drive over the Chrome DevTools Protocol (Playwright/Puppeteer connectOverCDP). Node-enforced public-only egress remains active. The response includes cdp_url; the act verb surface does not apply, and record/dom/no_video are rejected.
regionstringPreferred render region (best-effort). The plane routes to a node in this region when one has capacity, else the least-loaded node anywhere.

Responses

200

Session created.

FieldTypeDescription
session_idstring
cdp_urlstringPresent when cdp:true — the preferred complete wss:// URL carrying a short-lived, session-scoped ticket; hand it to connectOverCDP unchanged. Alternatively connect to /api/sessions/{id}/cdp and send the workspace gbk_ API key in an Authorization: Bearer header. Never put a reusable API key in a query string.

400

Invalid options, including caller proxy/bypass settings or hosted recorder options combined with cdp:true.

503

No render node available.

POST /api/sessions/{id}/act

Drive the session with a verb.

Operation ID: act

Path parameters

ParamInType
idpathstringrequired

Request body (required)

FieldTypeDescription
verb requiredstringThe full canonical verb set, kept in sync with cmd/gb-noded's action switch by this repo's internal/conformance conformance check (P2-210) — a go test failure blocks any release that lets this list drift from what the node/MCP/SDK surfaces actually support.

navigate snapshot click type select check hover press back forward reload scroll read_page extract extract_all evaluate wait_for screenshot pdf get_cookies set_cookies click_at move_to drag mark login set_file_input wait_for_download get_download list_downloads cancel_download wait_for_dialog handle_dialog get_dialog list_tabs current_tab switch_tab new_tab close_tab wait_for_popup wait_for_response get_response_body block_requests set_header_overrides unblock_requests request_human_takeover resume_from_takeover export_storage_state import_storage_state

urlstringfor navigate, new_tab
refstringan [e#] ref from snapshot (click/type)
selectorstringCSS selector (click/type/extract)
fieldsobject (map of string → string)Object mapping result names to CSS selectors for extract_all; response values use the same names and are null when no element matches.
textstringtext to type
expressionstringJS to evaluate
predicatestringJS predicate for wait_for
secretstringvault secret name (login)
cookiesarray of objectsChrome DevTools Protocol CookieParam objects passed to Network.setCookies for set_cookies.
xnumberviewport x px (click_at/move_to/drag)
ynumberviewport y px (click_at/move_to/drag)
to_xnumberdrag end x px
to_ynumberdrag end y px
valuestringoption to choose (select)
checkedbooleandesired state (check)
keystringkey to press, e.g. Enter (press)
dxintegerhorizontal scroll px (scroll)
dyintegervertical scroll px (scroll)
file_data_base64stringbase64 file bytes for set_file_input (selector/ref pick the input)
download_guidstringfor wait_for_download/get_download/cancel_download; empty waits for the next download
timeout_msintegerfor wait_for_download/wait_for_dialog/wait_for_popup/wait_for_response/cancel_download
acceptbooleanaccept (true) or dismiss (false) the pending dialog (handle_dialog)
prompt_textstringtext to answer a JS prompt() with (handle_dialog)
tab_idstringfor switch_tab/close_tab
tab_indexinteger0-based tab index, alternative to tab_id (switch_tab)
url_patternstringURL substring match (wait_for_response)
methodstringHTTP method filter, e.g. POST (wait_for_response)
request_idstringnetwork request id from wait_for_response (get_response_body)
patternsarray of stringURL substrings to block (block_requests) — matches either patterns or resource_types.
resource_typesarray of stringCDP Network.ResourceType values to block, e.g. image, stylesheet, font (block_requests).
overridesarray of objectsReplaces the session's full request-header-override rule list (set_header_overrides). Reliable for ordinary headers; Chrome recomputes a few browser-managed ones (notably Referer) after request interception regardless of what this call sends, so a remove rule on those is not guaranteed to reach the real outgoing request — a verified Chrome/CDP limitation, not a bug in this API.
FieldTypeDescription
url_patternstringsubstring match, empty matches every request
setobject (map of string → string)headers to add/replace
removearray of stringheaders to delete
reasonstringwhy human takeover is needed (request_human_takeover)
storage_stateobject (free-form)cookies + per-origin localStorage previously returned by export_storage_state (import_storage_state).

Responses

200

Result of the verb (shape depends on the verb).

FieldTypeDescription
okboolean
outlinestringfor snapshot
textstringfor read_page/extract
valueanyfor evaluate
png_base64stringfor screenshot
pdf_base64stringfor pdf

404

Unknown session (or not yours).

DELETE /api/sessions/{id}

Close the session (billed for wall-time held).

Operation ID: closeSession

Path parameters

ParamInType
idpathstringrequired

Responses

200

Closed.

FieldTypeDescription
okboolean
billed_secondsnumber