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

# Mark task as completed

> Complete a task (also completes all its subtasks)



## OpenAPI

````yaml /api-reference/openapi/EvoAI-CRM-Service/pipeline-tasks.yaml post /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/complete
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}/complete:
    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: Mark task as completed
      description: Complete a task (also completes all its subtasks)
      operationId: complete-task
      responses:
        '200':
          description: Task completed successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                  - meta
                  - message
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    allOf:
                      - $ref: '#/components/schemas/pipeline_task'
                      - type: object
                        properties:
                          descendants_completed_count:
                            type: integer
                            description: Number of subtasks completed
                            example: 3
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                        description: Response timestamp
                        example: '2024-01-15T10:30:00Z'
                  message:
                    type: string
                    example: Pipeline task completed successfully
              examples:
                success:
                  value:
                    success: true
                    data:
                      id: aa0e8400-e29b-41d4-a716-446655440005
                      pipeline_id: 550e8400-e29b-41d4-a716-446655440000
                      pipeline_item_id: 990e8400-e29b-41d4-a716-446655440004
                      title: Follow up call
                      description: Call customer to discuss proposal
                      task_type: call
                      status: completed
                      priority: high
                      due_date: '2024-01-20T14:00:00Z'
                      assigned_to_id: 660e8400-e29b-41d4-a716-446655440001
                      parent_task_id: null
                      metadata: {}
                      descendants_completed_count: 3
                      created_at: '2024-01-15T10:30:00Z'
                      updated_at: '2024-01-15T10:35:00Z'
                    meta:
                      timestamp: '2024-01-15T10:35:00Z'
                    message: Pipeline task completed successfully
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid task ID format
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/complete
                  method: POST
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/complete
                  method: POST
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: You do not have permission to complete this task
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/complete
                  method: POST
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Pipeline task not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/complete
                  method: POST
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: VALIDATION_ERROR
                  message: Task is already completed
                  details:
                    status:
                      - Task is already in completed status
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/complete
                  method: POST
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/pipelines/{pipeline_id}/pipeline_tasks/{id}/complete
                  method: POST
      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
    ErrorResponse:
      type: object
      required:
        - success
        - error
        - meta
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
              example: Validation failed
            details:
              type: object
              additionalProperties: true
              nullable: true
        meta:
          type: object
          required:
            - timestamp
            - path
            - method
          properties:
            timestamp:
              type: string
              format: date-time
              example: '2024-01-15T10:30:00Z'
            path:
              type: string
              example: /public/api/v1/inboxes/{inbox_identifier}/contacts
            method:
              type: string
              example: POST
    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
  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.