CancelTask

This method initiates task cancellation based on the task’s current state:

  • If the task has not been sent to an agent, it cancels immediately and transitions the task to a terminal state (STATUS_DONE_NOT_OK with ERROR_CODE_CANCELLED).
  • If the task has already been sent to an agent, the cancellation request is routed to the agent. The agent is then responsible for deciding whether cancellation is possible or not:
    • If the task can be cancelled, the agent must use UpdateStatus and set the task status to STATUS_DONE_NOT_OK.
    • If the task cannot be cancelled, the agent must use UpdateStatus to attach a TaskError to the task with the error code ERROR_CODE_REJECTED and a message explaining why the task cannot be cancelled.

CancelTaskRequest

Request
This endpoint expects an object.
task_idstring
The ID of the Task being cancelled.
authorobject
Who or what is requesting to cancel this task.
delivery_constraintsobject

Optional delivery constraints for only this cancel request, superseding the delivery constraints on the original task. Each field set here supersedes that task's; fields left unset keep the task's value. A running task's deliver_before is usually long past by the time it is cancelled, so inheriting it would leave nothing to bound delivery of the cancel itself.

CancelTaskResponse

Response
This endpoint returns an object.
taskobject
The updated task, regardless of whether the cancellation request was confirmed or denied by the agent.