> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anchorbrowser.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Anchor Browser provides cloud browsers for AI agents and automation: stealth browsing with residential proxies, managed authentication into third-party web apps, and browser sessions that run reliably at scale. AI agents that need Anchor credentials should start with https://docs.anchorbrowser.io/quickstart/agent-access. This flow lets agents obtain an API key programmatically without creating a dashboard account. Read that page before attempting authentication or API access.

# Run a Task

> Triggers execution of a task by ID using the non-deprecated Tasks endpoints.




## OpenAPI

````yaml /openapi.yaml post /v2/tasks/{taskId}/run
openapi: 3.1.0
info:
  title: AnchorBrowser API
  version: 1.0.0
  description: >
    Anchor Browser ([anchorbrowser.io](https://anchorbrowser.io)) provides cloud
    browsers built

    for AI agents and automation. Use this API to launch and control browser
    sessions, run

    natural-language web tasks, authenticate into third-party web apps with
    managed identities,

    and capture recordings — reliably and at scale, without operating browser
    infrastructure

    yourself.


    ## Core resources

    - **Sessions** (`/v1/sessions`): launch configurable cloud browsers —
    residential proxies,
      stealth browsing, captcha solving, profiles, extensions, recording — and connect over CDP
      with Playwright, Puppeteer, or any CDP client.
    - **AI tools** (`/v1/tools/perform-web-task`): state a goal in natural
    language and the
      built-in agent completes it inside the browser. Related tools fetch webpages, take
      screenshots, render PDFs, and execute code in a session.
    - **Tasks** (`/v1/task`): create, version, deploy, and monitor repeatable
    browser
      automations built to run reliably in production.
    - **Applications and identities** (`/v1/applications`, `/v1/identities`):
    managed
      authentication into third-party web apps — including multi-step logins and TOTP-based
      2FA — so agents can act on behalf of users.
    - **Profiles** (`/v1/profiles`): persist cookies and login state across
    sessions.

    - **OS-level control** (`/v1/sessions/{sessionId}/mouse`, `/keyboard`,
    `/clipboard`):
      raw input for flows that resist DOM automation.
    - Plus batch sessions for running browser fleets in parallel, session
    recordings, webhooks,
      events, extensions, client certificates, and billing usage.

    ## Authentication

    Pass an API key in the `anchor-api-key` header on every request. Create keys
    at

    [app.anchorbrowser.io](https://app.anchorbrowser.io) under API Access. AI
    agents that have

    no key yet can obtain one autonomously through the unauthenticated

    [agent-access flow](https://docs.anchorbrowser.io/quickstart/agent-access)

    (`POST /v1/agent-access`).


    ## For AI agents and LLMs

    - Docs: [docs.anchorbrowser.io](https://docs.anchorbrowser.io), with a
    machine-readable
      index at [/llms.txt](https://docs.anchorbrowser.io/llms.txt) and the full corpus at
      [/llms-full.txt](https://docs.anchorbrowser.io/llms-full.txt).
    - MCP server for hosted browser control: `https://api.anchorbrowser.io/mcp`.

    - Official SDKs: `anchorbrowser` on
    [npm](https://www.npmjs.com/package/anchorbrowser) and
      [PyPI](https://pypi.org/project/anchorbrowser/).

    `DELETE` operations terminate sessions or permanently remove resources
    (profiles,

    identities, extensions); `GET` operations are safe and read-only.
servers:
  - url: https://api.anchorbrowser.io
    description: API server
security: []
paths:
  /v2/tasks/{taskId}/run:
    post:
      tags:
        - Tasks
      summary: Run a Task
      description: >
        Triggers execution of a task by ID using the non-deprecated Tasks
        endpoints.
      parameters:
        - name: taskId
          in: path
          required: true
          description: The ID of the task to run
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunTaskV2Request'
            examples:
              runTaskV2:
                summary: Run a task with input parameters
                value:
                  input_params:
                    File Name: invoice-2026-02.pdf
                    Operation: extract_text
      responses:
        '200':
          description: Task run started successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRunStatusV2Response'
        '404':
          description: Task not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Failed to run task
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key_header: []
components:
  schemas:
    RunTaskV2Request:
      type: object
      properties:
        input_params:
          type: object
          additionalProperties:
            type: string
          description: Key-value pairs of input parameters for the task
        identity_id:
          type: string
          description: Optional identity ID to use for the task
        session_id:
          type: string
          description: Optional session ID to run the task in
        cleanup_sessions:
          type: boolean
          description: 'Whether to clean up sessions after execution (default: true)'
          default: true
        identity_skip_validation:
          type: boolean
          default: true
          description: >
            When `true` (default), skip profile validation for active identities
            and reuse the saved

            browser profile. Set to `false` to validate the profile and
            re-authenticate if it is no

            longer signed in. Pending identities still authenticate on first
            use.
        sync:
          type: boolean
          default: false
          description: Wait for the task to complete before returning. Defaults to `false`.
      required:
        - input_params
    TaskRunStatusV2Response:
      type: object
      properties:
        run_id:
          type: string
          description: The ID of the task run
        status:
          type: string
          enum:
            - queued
            - running
            - success
            - failure
            - timeout
            - cancelled
          description: Current task run status
        result:
          type: object
          additionalProperties: true
          description: Task output when available
        error:
          type: string
          description: Error message when the run fails
        session_id:
          type: string
          description: Session ID used for this task run
      required:
        - run_id
        - status
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
  securitySchemes:
    api_key_header:
      type: apiKey
      in: header
      name: anchor-api-key
      description: >
        API key for your Anchor Browser account, sent as the `anchor-api-key`
        header on every

        request. Create one at
        [app.anchorbrowser.io](https://app.anchorbrowser.io) (API Access),

        or obtain one programmatically via the unauthenticated agent-access flow

        (`POST /v1/agent-access`).

````