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

# Cancel task

> Marks a specified task as cancelled, preventing it from being executed. This also halts the execution of any subsequent tasks in the workflow.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/tasks/{taskId}/cancel
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}/cancel:
    post:
      tags:
        - Task
      summary: Cancel task
      description: >-
        Marks a specified task as cancelled, preventing it from being executed.
        This also halts the execution of any subsequent tasks in the workflow.
      parameters:
        - schema:
            type: string
          in: path
          name: taskId
          required: true
          description: The unique identifier of the task to cancel.
      responses:
        '200':
          description: Task cancelled successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Confirmation message that the task has been cancelled.
                required:
                  - message
                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

````