Run Task
Tasks
Run Task
Run a scripted sequence of browser actions (navigate, click, type, scroll, evaluate, upload, authenticate, etc.) and optionally return a screenshot, PDF, or page content in the same response.
POST
Run Task
Overview
The task runner is the workhorse of the Browser Session API. A single request can:- Navigate to a
url(optional) - Execute a sequential list of
actionsagainst the active page - Capture output artifacts —
screenshot,pdf, and/orcontent— at the end
Path Parameters
string
required
Browser session ID (UUID).
Body
string
Optional URL to navigate to before running
actions.string
default:"load"
Wait condition for the initial navigation. One of
domcontentloaded, load, networkidle.object[]
Sequential list of actions to execute. See Action schema below.
object
When present, a screenshot is taken after all actions complete. Supports
{ fullPage?: boolean, selector?: string }.object
When present, renders a PDF after all actions complete. Accepts the same options as
POST /browser/sessions/{id}/pdf (format, landscape, margin, etc.). Returned base64-encoded.boolean
When true, returns
{ html, url } of the final page in the response.Action schema
Every action has atype field. The remaining fields depend on the type.
Key per-field notes:
string
For
uploadFile: must match a filename previously uploaded via POST /browser/sessions/{id}/files.string
For
authenticate when mode is vault or vault_then_prompt: UUID of a credential from POST /browser/credentials. Never pass raw username/password.string
For
authenticate: one of vault, prompt_user, vault_then_prompt.object
For
authenticate: { username, password, submit?, totp? } — CSS selectors pointing at each login form field.object
For
authenticate: how to detect login success. { condition: "url" | "selector" | "text" | "networkIdle", value: string, timeoutMs?: integer }.integer
default:"300000"
For
authenticate with mode: prompt_user: max time to wait for the end-user to complete login via the live view.Example Request
Response
Success Response (201)
string
Effective URL of the active tab after all actions.
string
Base64-encoded PNG, present when the request included
screenshot.string
Base64-encoded PDF bytes, present when the request included
pdf.object
{ html, url }, present when the request had content: true.object[]
One entry per action, in order. Shape depends on the action type (e.g.
evaluate returns { value }, authenticate returns { success, reason }).Error Responses
Notes
- Actions run sequentially. Order matters — put
waitbetween flaky interactions. screenshot,pdf, andcontentare all independent and can be combined in a single task.- For long-running login flows, prefer
authenticateover scriptedtype/clickpairs — it handles common anti-bot consent banners and supports vault-stored credentials. filenameinuploadFilemust be uploaded first viaPOST /browser/sessions/{id}/files.