> ## 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 Task by Name (Legacy)

> Executes a task by its name, always using the latest version. This is a convenience endpoint
for running tasks without needing to know the task ID.

If you are using the new Task Builder, see the non-deprecated Tasks endpoints in this API reference.




## OpenAPI

````yaml /openapi.yaml post /v1/task/run/{taskName}
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:
  /v1/task/run/{taskName}:
    post:
      tags:
        - Tasks (Legacy)
      summary: Run Task by Name (Legacy)
      description: >
        Executes a task by its name, always using the latest version. This is a
        convenience endpoint

        for running tasks without needing to know the task ID.


        If you are using the new Task Builder, see the non-deprecated Tasks
        endpoints in this API reference.
      parameters:
        - name: taskName
          in: path
          required: true
          description: The name of the task to run
          schema:
            type: string
            pattern: ^[a-zA-Z0-9_-]+$
            example: web-scraper
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunTaskByNameRequest'
      responses:
        '200':
          description: Task executed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunTaskResponse'
        '404':
          description: Task not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Task execution failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key_header: []
components:
  schemas:
    RunTaskByNameRequest:
      type: object
      properties:
        sessionId:
          type: string
          format: uuid
          description: Optional existing browser session ID to use for task execution
        async:
          type: boolean
          description: Whether to run the task asynchronously
        overrideBrowserConfiguration:
          $ref: '#/components/schemas/SessionConfig'
          description: Override browser configuration for this execution
        inputs:
          type: object
          additionalProperties:
            type: string
          patternProperties:
            ^ANCHOR_.*$:
              type: string
          description: >-
            Environment variables for task execution (keys must start with
            ANCHOR_)
        cleanupSessions:
          type: boolean
          description: >-
            Whether to cleanup browser sessions after task execution. Defaults
            to true.
          default: true
    RunTaskResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            success:
              type: boolean
              description: Whether the task executed successfully
            async:
              type: boolean
              description: Whether the task was executed asynchronously
            message:
              type: string
              description: Execution result message
            taskId:
              type: string
              format: uuid
              description: Task identifier
            executionTime:
              type: number
              description: Execution duration in milliseconds (only present in sync mode)
            output:
              type: string
              description: Task execution output (only present in sync mode)
            error:
              type: string
              description: Error message if execution failed (only present in sync mode)
            executionResultId:
              type: string
              format: uuid
              description: >-
                Execution result identifier for tracking and polling (present in
                async mode)
          required:
            - success
            - async
            - message
            - taskId
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
    SessionConfig:
      type: object
      description: Session-related configurations.
      properties:
        initial_url:
          type: string
          format: uri
          description: >-
            The URL to navigate to when the browser session starts. If not
            provided, the browser will load an empty page.
        tags:
          type: array
          items:
            type: string
          description: >-
            Custom labels to categorize and identify browser sessions. Useful
            for filtering, organizing, and tracking sessions across your
            workflows.
          example:
            - production
            - scraping
            - customer-123
        recording:
          type: object
          description: Configuration for session recording.
          properties:
            active:
              type: boolean
              description: >-
                Enable or disable video recording of the browser session.
                Defaults to `true`.
        proxy:
          $ref: '#/components/schemas/ProxyConfig'
        timeout:
          type: object
          description: Timeout configurations for the browser session.
          properties:
            max_duration:
              type: integer
              description: >-
                Maximum time (in minutes) the session can run before
                automatically terminating. Defaults to `20`. Set to `-1` to
                disable this limit.
            idle_timeout:
              type: integer
              description: >-
                Time (in minutes) the session waits for new connections after
                all others are closed before stopping. Defaults to `5`. Set to
                `-1` to disable this limit.
        live_view:
          type: object
          description: Configuration for live viewing the browser session.
          properties:
            read_only:
              type: boolean
              description: >-
                Enable or disable read-only mode for live viewing. Defaults to
                `false`.
            one_time_url:
              type: boolean
              description: >-
                Generate a single-use live view URL. After the first viewer
                connects, the link becomes invalid. Requires a headful browser.
                Defaults to `false`.
    ProxyConfig:
      description: |
        Proxy Documentation available at [Proxy Documentation](/advanced/proxy)
      type: object
      oneOf:
        - $ref: '#/components/schemas/AnchorProxy'
        - $ref: '#/components/schemas/CustomProxy'
    AnchorProxy:
      title: Anchor Proxy
      type: object
      properties:
        active:
          type: boolean
        type:
          type: string
          enum:
            - anchor_proxy
          description: >-
            Create a session with a proxy to access websites as if you're
            browsing from a computer in that country.
          title: anchor_proxy
        country_code:
          $ref: '#/components/schemas/AnchorProxyCountryCode'
          description: |
            Supported country codes ISO 2 lowercase
        region:
          type: string
          description: |
            Region code for more specific geographic targeting.
            The city parameter can only be used when region is also provided.
        city:
          type: string
          description: >
            City name for precise geographic targeting. Supported for
            anchor_proxy only.

            Can only be used when region is also provided.
      required:
        - active
    CustomProxy:
      title: Custom Proxy
      type: object
      properties:
        type:
          type: string
          enum:
            - custom
        server:
          type: string
          description: >-
            Proxy address in **PROTOCOL://HOST:PORT** format (e.g.,
            https://proxy.example.com:443). See [proxy
            page](/advanced/proxy#custom-proxy).
        username:
          type: string
          description: Proxy username
        password:
          type: string
          description: Proxy password
        active:
          type: boolean
      required:
        - type
        - server
        - username
        - password
        - active
    AnchorProxyCountryCode:
      type: string
      title: anchor_proxy
      enum:
        - af
        - al
        - dz
        - ad
        - ao
        - as
        - ag
        - ar
        - am
        - aw
        - au
        - at
        - az
        - bs
        - bh
        - bb
        - by
        - be
        - bz
        - bj
        - bm
        - bo
        - ba
        - br
        - bg
        - bf
        - cm
        - ca
        - cv
        - td
        - cl
        - co
        - cg
        - cr
        - ci
        - hr
        - cu
        - cy
        - cz
        - dk
        - dm
        - do
        - ec
        - eg
        - sv
        - ee
        - et
        - fo
        - fi
        - fr
        - gf
        - pf
        - ga
        - gm
        - ge
        - de
        - gh
        - gi
        - gr
        - gd
        - gp
        - gt
        - gg
        - gn
        - gw
        - gy
        - ht
        - hn
        - hu
        - is
        - in
        - ir
        - iq
        - ie
        - il
        - it
        - jm
        - jp
        - jo
        - kz
        - kw
        - kg
        - lv
        - lb
        - ly
        - li
        - lt
        - lu
        - mk
        - ml
        - mt
        - mq
        - mr
        - mx
        - md
        - mc
        - me
        - ma
        - nl
        - nz
        - ni
        - ng
        - 'no'
        - pk
        - pa
        - py
        - pe
        - ph
        - pl
        - pt
        - pr
        - qa
        - ro
        - lc
        - sm
        - sa
        - sn
        - rs
        - sc
        - sl
        - sk
        - si
        - so
        - za
        - kr
        - es
        - sr
        - se
        - ch
        - sy
        - st
        - tw
        - tj
        - tg
        - tt
        - tn
        - tr
        - tc
        - ua
        - ae
        - us
        - uy
        - uz
        - ve
        - ye
      default: us
  securitySchemes:
    api_key_header:
      type: apiKey
      in: header
      name: anchor-api-key
      description: API key passed in the header

````