Skip to main content

Async Execution

By default, BrowserWorker waits for the task to finish before responding. In async mode the server replies immediately with a taskId — the worker continues running in the background and the result is saved when done.

Plan Requirement

Async execution is available on Standard and Pro plans only.

How It Works​

  1. Send a request with "async": true
  2. Server responds immediately with taskId and workerId
  3. Worker executes all actions in the background
  4. Poll GET /v1/get-result with the taskId to retrieve the result

Send an Async Task​

Add "async": true to any request body.

curl -X POST https://api.browserworker.app/v1/ \
-H "Authorization: Bearer <YOUR_BEARER_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"actions": [
{ "open": "https://example.com" },
{ "screenshot": "viewport" }
],
"async": true
}'

Response:

{
"success": true,
"async": true,
"taskId": "task_abc123...",
"workerId": "-Om8E6V_dV3w8mb27ikb",
"workerName": "My Worker"
}

Get the Result​

Poll GET /v1/get-result?taskId=... until success is true. A polling interval of 3–5 seconds is recommended.

curl -X GET "https://api.browserworker.app/v1/get-result?taskId=task_abc123..." \
-H "Authorization: Bearer <YOUR_BEARER_TOKEN>"

When complete:

{
"success": true,
"taskId": "task_abc123...",
"workerId": "-Om8E6V_dV3w8mb27ikb",
"workerName": "My Worker",
"data": { "success": true, "url": "https://files.browserworker.app/screenshots/..." },
"duration": 5234
}

When still pending:

{
"success": false,
"status": "pending"
}
note

Results are cached for 1 hour after completion. After that, they are automatically deleted.