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

# Get Task By Id

> Retrieve a task template by its ID.

Returns the complete task configuration including prompt, model, provider, webhook, and other settings.
Only accessible by the user who owns the task.



## OpenAPI

````yaml cloud-api-reference/openapi.json get /tasks/{task_id}
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}:
    get:
      tags:
        - run
      summary: Get Task By Id
      description: >-
        Retrieve a task template by its ID.


        Returns the complete task configuration including prompt, model,
        provider, webhook, and other settings.

        Only accessible by the user who owns the task.
      operationId: get_task_by_id_tasks__task_id__get
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Task'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    Task:
      properties:
        id:
          type: string
          title: Id
          description: The ID of the task
        name:
          type: string
          title: Name
          description: The name of the task
        prompt:
          anyOf:
            - type: string
              minLength: 3
            - type: 'null'
          title: Prompt
          description: The task to be performed by the agent
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: The model to use for the task. Defaults to 'gpt-4.1'.
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
          description: The provider to use for the task. Defaults to 'openai'.
        webhook_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Webhook Url
          description: The webhook URL to send the result to
        response_format:
          anyOf:
            - type: string
            - type: 'null'
          title: Response Format
          description: Whether to return the result as text or JSON
        json_schema:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Json Schema
          description: The JSON schema for the task result
        auth_context_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Auth Context Id
          description: The id of associated auth context
        initial_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Initial Url
          description: The initial URL to navigate to before executing the task
        session_timeout:
          anyOf:
            - type: integer
            - type: 'null'
          title: Session Timeout
          description: The timeout for the task in seconds
      type: object
      required:
        - id
        - name
        - prompt
        - model
        - provider
        - webhook_url
        - response_format
        - json_schema
        - auth_context_id
        - initial_url
        - session_timeout
      title: Task
      description: Represents a Task
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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

````