> ## 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.

# 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: APIs to manage all browser-related actions and configuration.
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
      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 passed in the header

````