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

# Complete task

> Marks a specified task as complete, providing the result of its execution. This may trigger the next task in the workflow.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/tasks/{taskId}/complete
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/tasks/{taskId}/complete:
    post:
      tags:
        - Task
      summary: Complete task
      description: >-
        Marks a specified task as complete, providing the result of its
        execution. This may trigger the next task in the workflow.
      parameters:
        - schema:
            type: string
          in: path
          name: taskId
          required: true
          description: The unique identifier of the task to complete.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                result:
                  description: The result data from the task's execution.
              additionalProperties: false
      responses:
        '200':
          description: Task completed successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  nextTaskId:
                    type: string
                    nullable: true
                    description: The ID of the next task in the workflow, if any, or null.
                required:
                  - nextTaskId
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: The error message.
                  message:
                    type: string
                    description: The message.
                  statusCode:
                    type: number
                    description: The status code.
                  details:
                    type: object
                    additionalProperties: {}
                    description: The details of the error
                additionalProperties: true
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Not Found, the task with the specified ID was not found.
                required:
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Internal server error while completing the task.
                required:
                  - error
                additionalProperties: false

````