> For the complete documentation index, see [llms.txt](https://docs.tasksource.io/api-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tasksource.io/api-documentation/tasks/cancel-task.md).

# Cancel Task

A task creator should have the option to cancel a task as long as he **has not accepted the developer's estimation**.&#x20;

### Input parameters

* TaskID

### How to call from app

```
import { httpsCallable } from 'firebase/functions';

await httpsCallable(functions, 'cancelTask')({ taskId })
```

### Logic

1. Move the task back to drafts (We should maybe build a function for this so we don't have redundant logic)
2. Remove developer from project members (projects/members) array if no other task with same projectId found
3. We should send an email to the developer if There is someone assigned-
4. Send First Email:
   * to\_email\_adress = email\_of\_assigned\_person
   * template\_name = "tasks-canceled-by-creator->developer"
   * data = {taskData: taskData, taskId: taskId}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tasksource.io/api-documentation/tasks/cancel-task.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
