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

# Run Existing Task

> Create a new run from an existing task template.

Uses the task's saved configuration as defaults (prompt, model, provider, etc.)
but allows overriding any field via the request body.



## OpenAPI

````yaml cloud-api-reference/openapi.json post /tasks/{task_id}/runs
openapi: 3.1.0
info:
  title: Webagent API
  description: API to execute automated tasks on browser using different LLM providers.
  version: 0.1.0
servers:
  - url: https://api.webagent.cloud
    description: Webagent API
security: []
paths:
  /tasks/{task_id}/runs:
    post:
      tags:
        - run
      summary: Run Existing Task
      description: >-
        Create a new run from an existing task template.


        Uses the task's saved configuration as defaults (prompt, model,
        provider, etc.)

        but allows overriding any field via the request body.
      operationId: run_existing_task_tasks__task_id__runs_post
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskRunRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Run'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    TaskRunRequest:
      properties:
        json_schema:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Json Schema
          description: The JSON schema for the task result (overrides task json_schema)
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: The task to be performed by the agent (overrides task prompt)
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: The model to use (overrides task model)
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
          description: The provider to use (overrides task provider)
        webhook_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Webhook Url
          description: The webhook URL to send the result to (overrides task webhook_url)
        response_format:
          anyOf:
            - type: string
            - type: 'null'
          title: Response Format
          description: >-
            Whether to return the result as text or JSON (overrides task
            response_format)
        auth_context_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Auth Context Id
          description: The id of associated auth context (overrides task auth_context_id)
        initial_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Initial Url
          description: >-
            The initial URL to navigate to before executing the task (overrides
            task initial_url)
        session_timeout:
          anyOf:
            - type: integer
            - type: 'null'
          title: Session Timeout
          description: The timeout for the task in seconds
        wait_for_completion:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Wait For Completion
          description: >-
            Whether to wait for the task to complete before returning the
            response. If false, the task will be executed in the background and
            the response will contain only the task ID.
      type: object
      title: TaskRunRequest
      description: >-
        Request model for creating a run from an existing task.

        All fields are optional and override the task's default values if
        provided.
    Run:
      properties:
        id:
          type: string
          title: Id
          description: The ID of the created task run
        task_id:
          type: string
          title: Task Id
          description: The ID of the created task
        status:
          $ref: '#/components/schemas/StatusEnum'
          description: The status of the agent's task
          default: pending
        result:
          anyOf:
            - {}
            - type: 'null'
          title: Result
          description: The final result of the agent's task
        is_done:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Done
          description: Whether the agent has completed its task
        is_successful:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Successful
          description: Whether the agent was successful in completing its task
      type: object
      required:
        - id
        - task_id
      title: Run
      description: Represents a Run.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    StatusEnum:
      type: string
      enum:
        - success
        - failure
        - pending
      title: StatusEnum
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````