Docs
Dashboard
API reference / BrowserBeta

Run browser actions

Runs a list of actions next to the session's browser, in order, and stops at the first failure. A stopped session is not woken by a call (409 session_not_running): resume it first. 409 browser_disabled on a session created with browser: false. A bare string in the list is a plain-English step. step needs the plan's plain-English steps (402 feature_not_in_plan), and model calls count against the monthly model spend cap (402 spend_limit). Mouse and keyboard actions are checked before anything runs: a point outside the viewport is 400 out_of_viewport, a bad shape 400 invalid_request. Coordinates are CSS pixels of the viewport. Screenshots count against 300 per minute per session (shared with /computer).

POST/v1/sessions/{id}/browser/actions

Request

Method and pathPOST/v1/sessions/{id}/browser/actions
Base URLhttps://api.boxline.dev
AuthenticationYour API key in the x-api-key header (or Authorization: Bearer). The examples read it from BOXLINE_API_KEY.
Rate limitYes. See Rate limits for the numbers and headers.

Path parameters

NameTypeDefaultAllowed valuesDescription
idrequiredstring––

Body

JSON with content-type: application/json. Required.

NameTypeDefaultAllowed valuesDescription
actionsrequiredarray––1 to 100 items.
timeoutMsinteger30000–Time limit of each action (ms). From 1000 to 120000.

Each item of actions[] is one of these kinds, picked by action:

action: "goto" Value: {url, title, status}.
NameTypeDefaultAllowed valuesDescription
urlrequiredstring––
waitUntilstringloadload, domcontentloaded, networkidle, commit
action: "click" A selector, or viewport coordinates x and y. count 2 is a double click, 3 a triple click.
NameTypeDefaultAllowed valuesDescription
selectorstring––
xnumber––
ynumber––
buttonstringleftleft, right, middle
countinteger11, 2, 3
modifiersstring[]––Keys held down during the action, e.g. ["Shift"]. Up to 10 items.
action: "fill"
NameTypeDefaultAllowed valuesDescription
selectorrequiredstring––
valuerequiredstring––
action: "type" Types text, or a credential's value without it passing through the caller (credential and, for a password, field). A credential with sites goes only into the field selector names, on one of its sites.
NameTypeDefaultAllowed valuesDescription
textstring––
selectorstring––
delayMsinteger––
credentialstring––A credential (scope "agent" or "all") whose value is typed instead of text.
fieldstring–username, password, otpA password credential's field (left out for a secret); otp waits for a fresh code with codeSource push or url.
allowWithExtensionsbooleanfalse–Allow typing a credential in a session with Chrome extensions.
action: "press"
NameTypeDefaultAllowed valuesDescription
keyrequiredstring––
action: "key" A key combination held together ("Control+A" or ["Control", "A"]); a string may hold several combinations separated by spaces, pressed one after the other. Names are Playwright's; ctrl, cmd, super, Return, Page_Down, ESC, ARROWLEFT and similar spellings are accepted.
NameTypeDefaultAllowed valuesDescription
keysrequiredstring | string[]––
holdMsinteger––Keep the keys down this long. From 0 to 10000.
action: "scroll" Moves the pointer to x/y when given, then turns the wheel (pixels).
NameTypeDefaultAllowed valuesDescription
deltaYnumber––From -50000 to 50000.
deltaXnumber––From -50000 to 50000.
xnumber––
ynumber––
modifiersstring[]––Keys held down during the action, e.g. ["Shift"]. Up to 10 items.
action: "move" Moves the pointer to x/y, or by dx/dy from where it is, in a straight line through steps points. Value: {x, y}.
NameTypeDefaultAllowed valuesDescription
xnumber––
ynumber––
dxnumber––
dynumber––
stepsinteger1–From 1 to 100.
modifiersstring[]––Keys held down during the action, e.g. ["Shift"]. Up to 10 items.
action: "hover" Moves the pointer over an element (selector) or to x/y.
NameTypeDefaultAllowed valuesDescription
selectorstring––
xnumber––
ynumber––
action: "mouse_down" | "mouse_up" Presses or releases a mouse button where the pointer is.
NameTypeDefaultAllowed valuesDescription
buttonstringleftleft, right, middle
action: "drag" Presses at from, moves to to in steps points, releases; or presses at the first point of path and follows it (steps points per segment). Value: {from:{x,y}, to:{x,y}}.
NameTypeDefaultAllowed valuesDescription
fromobject | string––{x, y}, or a selector (the element's centre, scrolled into view).
from.xrequirednumber––At least 0.
from.yrequirednumber––At least 0.
toobject | string––{x, y}, or a selector (the element's centre, scrolled into view).
to.xrequirednumber––At least 0.
to.yrequirednumber––At least 0.
pathobject[]––2 to 200 items.
path[].xrequirednumber––At least 0.
path[].yrequirednumber––At least 0.
stepsinteger––Default 10 for from/to, 1 for a path. From 1 to 100.
buttonstringleftleft, right, middle
modifiersstring[]––Keys held down during the action, e.g. ["Shift"]. Up to 10 items.
action: "cursor" Value: {x, y}, the pointer's position on the tab (the last place the API moved it to; 0, 0 before any move).

No other fields.

action: "wait" Wait for a selector, or a number of milliseconds.
NameTypeDefaultAllowed valuesDescription
selectorstring––
msinteger––
action: "screenshot" Value: {data (base64), mimeType}; with maxWidth or cursor also {width, height, scale} (image pixels per CSS pixel).
NameTypeDefaultAllowed valuesDescription
fullPageboolean––
formatstringpngpng, jpeg
qualityinteger––From 1 to 100.
maxWidthinteger––Scale down to at most this width (aspect ratio kept). Viewport screenshots only. From 100 to 3840.
cursorboolean––Draw the pointer on the image. Viewport screenshots only.
action: "content" Value: {content, url, title}.
NameTypeDefaultAllowed valuesDescription
formatstringmarkdownmarkdown, html, text
action: "evaluate" Value: what the expression returns.
NameTypeDefaultAllowed valuesDescription
expressionrequiredstring––
action: "upload" Sets a file input to a file in the session's workspace.
NameTypeDefaultAllowed valuesDescription
selectorrequiredstring––
pathrequiredstring––A file of the session's workspace (relative to it, or absolute under it). 400 for a path outside the workspace, a missing file, a folder, or a link that leads out of the workspace.
action: "select" Picks an option of a select element by label or value.
NameTypeDefaultAllowed valuesDescription
selectorrequiredstring––
optionrequiredstring––
action: "elements" The page as a model sees it. Value: {url, title, text, elements, count}.

No other fields.

action: "tabs" Value: {current, tabs:[{index, url, title}]}.

No other fields.

action: "newTab" Value: {index}.
NameTypeDefaultAllowed valuesDescription
urlstring––
action: "switchTab"
NameTypeDefaultAllowed valuesDescription
indexrequiredinteger––At least 0.
action: "closeTab" Closes the tab at index, or the current one.
NameTypeDefaultAllowed valuesDescription
indexinteger––At least 0.
action: "back" | "forward" | "reload"

No other fields.

action: "step" One plain-English step ("click Sign in", "type %password% into the password field"): a fast model picks one action and the server runs it. Variable values are substituted on the server and never sent to the model.
NameTypeDefaultAllowed valuesDescription
instructionrequiredstring––
variablesobject––
credentialsstring[]––Credentials usable as placeholders (%NAME%, %NAME.username%, %NAME.password%, %NAME.otp%; scope "agent" or "all"), with their own sites (checked on the field's frame) and shell rule. In a session whose profile links a password credential, its placeholders work too. The step's result never shows their values. Up to 50 items.
allowWithExtensionsbooleanfalse–Allow credentials in a session with Chrome extensions, which can read every typed value (400 variables_with_extensions otherwise; a profile's credential is not offered). Logs a warning in the session's events. Ignored in a script's step(): only the browser/script agreement counts.
providerstring–anthropic, openai, xai, googleAnthropic Claude, OpenAI, Grok (xAI), Google Gemini. Grok and Gemini have no computer use (mode computer is 400).
modelstring––
targetIdstring––A tab's target id.
action: "extract" Structured data from the current page (instruction and/or JSON schema).
NameTypeDefaultAllowed valuesDescription
instructionstring––
schemaobject––A JSON Schema.
providerstring–anthropic, openai, xai, googleAnthropic Claude, OpenAI, Grok (xAI), Google Gemini. Grok and Gemini have no computer use (mode computer is 400).
modelstring––
targetIdstring––
action: "login" Signs the session's browser in with a password credential (default: the one the session's profile links): a short agent run in the session (at most 15 steps, only that credential and its sites, browser tools only). Value {url, title, runId} (url without query or fragment); fails with credential_login_failed (error: the run's last step), credential_code_timeout or credential_link_wrong_site. Counts as an agent run.
NameTypeDefaultAllowed valuesDescription
credentialstring––Pattern: ^[A-Z_][A-Z0-9_]*$.
urlstring––The sign-in page; one of the credential's sites (default its first site).
allowWithExtensionsbooleanfalse–

More examples:

list
{  "actions": [    {      "action": "goto",      "url": "https://example.com"    },    {      "action": "content",      "format": "markdown"    }  ]}
step
{  "action": "step",  "instruction": "type %email% into the email field",  "variables": {    "email": "ada@example.com"  }}
Bare strings are plain-English steps
{  "actions": [    {      "action": "goto",      "url": "https://example.com/login"    },    "click Sign in",    {      "action": "screenshot",      "maxWidth": 1024    }  ]}
Drag a slider, double-click a word, press a shortcut
{  "actions": [    {      "action": "drag",      "from": "#volume-handle",      "to": {        "x": 400,        "y": 200      },      "steps": 20    },    {      "action": "move",      "x": 640,      "y": 360,      "steps": 10    },    {      "action": "click",      "x": 190,      "y": 112,      "count": 2    },    {      "action": "click",      "selector": "#file",      "button": "right"    },    {      "action": "key",      "keys": "Control+A"    },    {      "action": "drag",      "path": [        {          "x": 100,          "y": 100        },        {          "x": 150,          "y": 120        },        {          "x": 200,          "y": 180        }      ]    },    {      "action": "cursor"    },    {      "action": "screenshot",      "maxWidth": 640,      "cursor": true    }  ]}
curl -X POST "https://api.boxline.dev/v1/sessions/$SESSION_ID/browser/actions" \  -H "x-api-key: $BOXLINE_API_KEY" \  -H "content-type: application/json" \  -d '{    "actions": [      {"action": "goto", "url": "https://example.com"},      "click the Sign in link"    ]  }'

Responses

200 OK

One result per action run.

Headers

  • RateLimit-Limit: Requests allowed in the current window of this route's limit. (Rate limits)
  • RateLimit-Remaining: Requests left in the current window. (Rate limits)
  • RateLimit-Reset: Seconds until the window starts again. (Rate limits)

Fields

NameTypeDefaultAllowed valuesDescription
resultsobject[]––
results[].okboolean––
results[].actionstring––
results[].valueany––The action's result (see each action; StepValue for step).
results[].textstring––One line saying what happened ("Dragged from (180, 200) to (400, 200) in 10 steps"); never typed text.
results[].errorstring––
results[].codestring––A stable error code when there is one, e.g. captcha_timeout, out_of_viewport, model_refused (extract), tab_crashed / tab_hung (the tab was replaced by a fresh one on its last address; the action did not run), credential_code_timeout, credential_link_wrong_site, credential_login_failed (login).
results[].runIdstring––login: the agent run that signed in (on success also in value).
results[].msinteger––
Response 200
{  "results": [    {      "ok": false,      "action": "…",      "value": null,      "text": "…",      "error": "…",      "code": "…",      "runId": "…",      "ms": 0    }  ]}

Errors

Errors have a matching HTTP status and the same body. code is stable, so check it in your code; message is for people. See Errors and request ids.

StatusCodesWhen
400 Bad Requestinvalid_request, invalid_json, invalid_cursor, invalid_idempotency_key, invalid_extension, variables_with_extensions, terms_not_accepted, invalid_reset_token, invalid_confirmation_code, wrong_password, no_password, invalid_next, invalid_oauth_tokenThe request is not valid.
401 UnauthorizedunauthorizedMissing or invalid API key.
402 Payment Requiredfeature_not_in_plan, spend_limit, out_of_credit, plan_limit, spend_limit, out_of_credit, organization, project, plan, creditThe plan does not include this, a monthly allowance or spending limit is used up, the organization has no credit left, or the plan allows no more of this. spend_limit and out_of_credit carry error.details.limit: organization, project, plan or credit.
404 Not Foundnot_found, invite_not_found, provider_unavailableNo such thing in this project (or organization), or no such route.
409 Conflictsession_not_running, shell_disabled, browser_disabled, nothing_saved, not_resumable, invalid_state, conflict, email_taken, identity_in_use, provider_already_linked, last_sign_in_method, not_impersonating, machine_too_old, too_many_credential_values, limit_reached, terms_version_mismatch, no_project, last_owner, organization_not_empty, project_has_sessions, already_member, invite_pending, idempotency_in_progressThe current state does not allow it, or a request with this Idempotency-Key is still being answered.
429 Too Many Requestsrate_limited, concurrency_limitToo many requests, or the organization's concurrent sessions (its plan's) or the project's concurrencyCap are in use.
503 Service Unavailableno_capacity, proxy_unavailable, provider_unavailable, search_unavailable, webhooks_unavailable, mail_unavailable, browser_unreachableNo machine free in time, proxies not set up, the model provider is not configured or has no key, or web search is not set up or its provider is not answering, or webhook delivery is not set up, or an email cannot be sent, or the session's browser did not answer in time.
Error body
{  "error": {    "code": "not_found",    "message": "session not found",    "requestId": "req_4fJx0aQm2Lk9Pz7N"  }}

Learn more

These docs describe a beta API. Endpoints, fields and SDK methods may change before general availability; breaking changes will be listed in the changelog.