Skip to main content

Overview

Call POST /v2/tasks/{taskId}/run with input_params matching the task’s input schema. The response includes run_id and status. By default runs are async — poll for the result, or set sync: true to block until completion.

Basic usage

Request parameters

input_params keys must match names from the task’s input schema. Pass cleanup_sessions: false with session_id to keep the session open for follow-up work.
Retries are not a request parameter. retries is stored on the task definition and applies to every run of that task, so it is not accepted in the /run body. Passing session_id does affect it: a run that supplies its own session takes a single attempt regardless of the task’s retries value. See Retries.

Task config vs session config

Browser settings — proxy, viewport, profile, timeouts, CAPTCHA solver — live in a session config: a session block and a browser block, same schema as starting a browser session. A task stores its own copy of that schema as task_default_browser_configuration. This is not sent on each run request. It tells Anchor how to configure the browser when it creates a session for you. Set task defaults once with PATCH /v1/tools/{toolId} (or task_browser_default_configuration on POST /v2/tasks/generate):
Set task_default_browser_configuration to null to clear it. Per-run, the only session-related fields on /run are session_id (use an existing session) and identity_id (authenticate that session). Everything else comes from the task default or the session you created. See Proxy, Session timeout, and CAPTCHA solving for common session and browser options.

Get results

Sync — add "sync": true to the run request. The response includes result on success or error on failure. Async (default) — poll GET /v2/tasks/runs/{runId}/status until status is success, failure, timeout, or cancelled.
node.js
python
Use sync for short tasks and scripts. Poll for long-running production runs.
Tasks with output file only may return the file in the HTTP body when sync: true instead of JSON.

Retries

retries is set on the task, not per run, so every run of that task uses it. It is an integer from 0 to 10 on task create and update (and in the dashboard Settings tab), and from 0 to 3 on POST /v2/tasks/generate. It defaults to 0, and it counts retries rather than attempts: retries: 2 means one initial attempt plus up to two retries, three attempts in total. Every attempt runs on a brand-new browser session. Nothing carries over from the attempt before it: no cookies, no local storage, no open pages. Retrying stops as soon as an attempt succeeds, and the run reports that attempt’s result. A run emits exactly one webhook. A run that fails and then succeeds sends a single task.completed and zero task.failed. Intermediate attempts never reach your endpoint, so retry logic built on task.failed never sees them. See Webhook events. A timed-out or cancelled run has already spent its budget. Identity authentication is excluded because each attempt performs a real login, and repeated failed logins from different IP addresses can lock the account. Passing session_id also forces a single attempt: a retry needs a new browser, and that session belongs to you. GET /v1/executions/{executionId}/metadata returns the run’s metadata, including an attempts array under metadata.attempts ordered by attempt number. It is empty for a run that never retried. Each entry carries its own browserSessionId, so you can open the browser session for any single attempt.
Two things are stored per run rather than per attempt. Logs and artifacts are the final attempt’s; earlier attempts’ logs are not retained. Duration is the final attempt’s execution time rather than the sum across attempts, so use the per-attempt timings when you need the total.

Next steps