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

# Add a subtask to a task

> Create a subtask under an existing task (max 3 hierarchy levels)



## OpenAPI

````yaml /api-reference/openapi/EvoAI-CRM-Service/pipeline-tasks.yaml post /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/add_subtask
openapi: 3.0.4
info:
  title: Evolution Foundation - CRM Service - Pipeline Tasks
  description: Management of contacts, conversations, inboxes, labels and macros
  version: 1.1.0
servers:
  - url: https://api.evoai.app
    description: Production server
  - url: http://localhost:3000
    description: Development server
    variables:
      port:
        default: '3000'
  - url: '{customUrl}'
    description: Custom server
    variables:
      customUrl:
        default: https://your-instance.com
        description: Enter your server URL
security: []
paths:
  /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/add_subtask:
    parameters:
      - name: pipeline_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      summary: Add a subtask to a task
      description: Create a subtask under an existing task (max 3 hierarchy levels)
      operationId: add-subtask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - task
              properties:
                task:
                  type: object
                  required:
                    - title
                  properties:
                    title:
                      type: string
                    description:
                      type: string
                    task_type:
                      type: string
                      enum:
                        - call
                        - email
                        - meeting
                        - follow_up
                        - note
                        - other
                    due_date:
                      type: string
                      format: date-time
                    assigned_to_id:
                      type: string
                      format: uuid
                    priority:
                      type: string
                      enum:
                        - low
                        - medium
                        - high
                        - urgent
                    metadata:
                      type: object
      responses:
        '201':
          description: Subtask created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/pipeline_task'
                  message:
                    type: string
        '422':
          $ref: '#/components/responses/validation_error'
      security:
        - userApiKey: []
components:
  schemas:
    pipeline_task:
      type: object
      properties:
        id:
          type: string
          format: uuid
        pipeline_item_id:
          type: string
          format: uuid
        account_id:
          type: string
          format: uuid
        title:
          type: string
          maxLength: 255
        description:
          type: string
          nullable: true
        task_type:
          type: string
          enum:
            - call
            - email
            - meeting
            - follow_up
            - note
            - other
        status:
          type: string
          enum:
            - pending
            - completed
            - cancelled
            - overdue
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        due_date:
          type: string
          format: date-time
          nullable: true
        completed_at:
          type: string
          format: date-time
          nullable: true
        created_by_id:
          type: string
          format: uuid
        assigned_to_id:
          type: string
          format: uuid
          nullable: true
        parent_task_id:
          type: string
          format: uuid
          nullable: true
        position:
          type: integer
          description: Position among siblings
        depth:
          type: integer
          description: Hierarchy depth (0=root, 1=subtask, 2=sub-subtask)
        metadata:
          type: object
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        created_by:
          $ref: '#/components/schemas/user'
        assigned_to:
          $ref: '#/components/schemas/user'
          nullable: true
        parent_task:
          $ref: '#/components/schemas/pipeline_task'
          nullable: true
        subtasks:
          type: array
          items:
            $ref: '#/components/schemas/pipeline_task'
        subtask_count:
          type: integer
        overdue:
          type: boolean
        due_soon:
          type: boolean
        days_until_due:
          type: integer
          nullable: true
        hours_until_due:
          type: number
          nullable: true
    user:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        email:
          type: string
        avatar_url:
          type: string
          nullable: true
        available_name:
          type: string
          description: Display name for the user
    error_response:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
        details:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
            - type: object
  responses:
    validation_error:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error_response'
  securitySchemes:
    userApiKey:
      type: apiKey
      in: header
      name: api_access_token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.