# Cancel a Task

To stop a task that is in progress, use the `cancelTask()` method to stop all processing of the task. DT does not provide any notifications on task cancellations.

{% code title="Kotlin" %}

```kotlin
fun cancelTask(
taskId: String,
metadata: Bundle = Bundle()
)
```

{% endcode %}

| PARAMETER  | STATUS   | TYPE   | DESCRIPTION                                                                                                                                                       |
| ---------- | -------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `taskId`   | Required | String | Unique ID for the task you want to cancel. DT assigns a task ID to every task. Obtain the task ID from either a callback or broadcast about the task in progress. |
| `metadata` | Optional | Bundle | Additional metadata to pass to Ignite.                                                                                                                            |

## Example <a href="#h_01k2j950mprmtvc5mcrpz20tt6" id="h_01k2j950mprmtvc5mcrpz20tt6"></a>

{% code title="Kotlin" %}

```kotlin
// Initialization

// Specify task id received previously in broadcast or callbacks onScheduled() method

IgniteServiceSdk.instance().cancelTask(taskId)
// ...
```

{% endcode %}
