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

# Cancel Task

> Cancel a pending, queued, or running task

# POST /tasks/{task_id}/cancel

Request cancellation of an in-progress async task. Use this to abort energy model runs, shading computations, or other queued work that is no longer needed.

## Notes

* Only tasks with status `pending`, `queued`, or `running` can be cancelled.
* Attempting to cancel a task that is already `completed`, `failed`, or `cancelled` returns a `409 Conflict` error.
* Returns `404` if the task does not exist in the current workspace.
* Requires a write session (workspace write access).
* The response contains the updated task record with status set to `cancelled`.
* Poll [GET /tasks/{task_id}](/api-reference/endpoints/task-status) to confirm cancellation if the task was mid-execution.

<Warning>
  Cancellation is best-effort for tasks already in `running` state. The worker may complete before the cancellation is processed.
</Warning>
