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

# Link Subtask

> Link an existing task as a subtask of another task.

Raises:
    NotFoundError: If either task not found.
    TaskCycleError: If linking would create a cycle in the subtask graph.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /agents/tasks/{task_id}/subtasks/link
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /agents/tasks/{task_id}/subtasks/link:
    post:
      tags:
        - tasks
      summary: Link Subtask
      description: |-
        Link an existing task as a subtask of another task.

        Raises:
            NotFoundError: If either task not found.
            TaskCycleError: If linking would create a cycle in the subtask graph.
      operationId: tasks-link_subtask
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_tasks-link_subtask'
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_tasks-link_subtask:
      properties:
        child_id:
          type: string
          title: Child Id
          description: Existing task to attach as a subtask
      type: object
      required:
        - child_id
      title: Body_tasks-link_subtask
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````