Skip to main content

API Reference

All requests go to POST https://api.browserworker.app/v1/ with your Bearer token.


Execute Task

POST https://api.browserworker.app/v1/

Headers

HeaderRequiredValue
AuthorizationYesBearer YOUR_BEARER_TOKEN
Content-TypeYesapplication/json or multipart/form-data

Request Body

{
"actions": [ // required — list of actions to run
{ "openNewTab": "https://example.com" },
{ "click": ".submit-btn" },
{ "screenshot": "viewport" }
],
"workerId": "-Om8E6V_dV3w8mb27ikb", // optional — target a specific worker
"timeout": 30000, // optional — task timeout in ms
"config": {
"actionTimeout": 5000, // per-action timeout in ms
"continueOnError": true // keep going if an action fails
},
"session": {
"preserve": true // keep worker reserved after task
}
}

Parameters

FieldTypeDefaultDescription
actionsarrayrequiredActions to execute sequentially
workerIdstringauto-selectTarget a specific worker by ID
timeoutnumber30000Task timeout in ms (30 seconds). Max: 60000 (Free), 120000 (Basic+). For longer tasks, use async: true (Standard+ plans).
config.actionTimeoutnumber10000Per-action timeout in ms (10 seconds)
config.continueOnErrorbooleantrueContinue executing if an action fails
sessionobjectSession options (see Sessions)
asyncbooleanfalseReturn immediately with taskId (Standard+ plans)

Multipart Form-Data

For binary file uploads, send multipart/form-data with two fields:

payload → JSON string: {"actions": [...], "workerId": "..."}
files → binary file attachments (one per field)

Reference uploaded files in actions with $file:0, $file:1, etc. See File Upload.


Response

Success (200)

{
"success": true,
"taskId": "task_eb09bd2804b99ecb_1771839792",
"workerId": "-Om8GAObZSvE8trPMPZF",
"workerName": "My PC",
"data": { "success": true, "url": "https://files.browserworker.app/screenshots/..." },
"duration": 6388,
"sessionId": "ses_..." // only present if session.preserve was set
}
FieldDescription
successtrue if the task completed without errors
taskIdUnique task identifier
workerIdThe worker that executed the task
workerNameHuman-readable worker name
dataResult from the last action (or accumulated results)
durationTotal execution time in milliseconds
sessionIdSession ID (only if session.preserve was set)

Errors

CodeDescription
400Invalid actions or missing required fields
401Invalid or missing bearer token
403Worker doesn't belong to you, or feature not on your plan
404No available workers found
408Task timed out
409Worker is busy, offline, or session mismatch
429Daily task limit reached (Free plan: 50/day)
{
"error": "Task timed out",
"taskId": "task_...",
"workerId": "-Om8GAObZSvE8trPMPZF",
"timeout": 30000
}

Action Format

Each action is an object with a single key (the action name) mapped to its value.

{ "click": "#submit-btn" } // string selector
{ "fill": ["input[name=email]", "user@example.com"] } // array
{ "click": "#submit-btn", "options": { "iframe": "#content" } } // with options
{ "loop": { "each": ".item", "do": [{ "click": "$this" }] } } // nested (control flow)

Selectors

Both CSS selectors and XPath are supported. XPath is auto-detected when the selector starts with / or //.

{ "click": ".my-button" } // CSS
{ "click": "//button[contains(text(), 'Submit')]" } // XPath

Options

Most actions accept an options object for additional configuration:

{
"click": "#submit",
"options": {
"timeout": 5000, // override per-action timeout
"iframe": "#content-frame", // target element inside an iframe
"continueOnError": true // override global continueOnError for this action
}
}

See each action's documentation for its supported options.