---
title: "Cancel a task"
method: POST
path: "/v1/projects/{project_id}/tasks/{id}/cancel"
tags: ["Task"]
---

# Cancel a task

`POST /v1/projects/{project_id}/tasks/{id}/cancel`

## Request

- Base URL: `https://api.telerivet.com`
- URL: `https://api.telerivet.com/v1/projects/{project_id}/tasks/{id}/cancel`
- Auth: one of:
  - HTTP basic
  - OAuth 2 (authorization code, authorization URL `https://telerivet.com/oauth/authorize`, token URL `https://api.telerivet.com/oauth/token`)

Cancels a task that is not yet complete.

## Path parameters

- `project_id` string, required
- `id` string, required

## Response `200`

Successful response

- Task: Represents an asynchronous task that is applied to all entities matching a filter. Tasks include services applied to contacts, messages, or data rows; adding or removing contacts from a group; blocking or unblocking sending messages to a contact; updating a custom variable; deleting contacts, messages, or data rows; or exporting data to CSV.
  - `id` string: ID of the task
  - `task_type` string: The task type
  - `task_params` object: Parameters applied to all matching rows (specific to `task_type`). See project.createTask.
  - `filter_type` string: Type of filter defining the rows that the task is applied to
  - `filter_params` object: Parameters defining the rows that the task is applied to (specific to `filter_type`). See project.createTask.
  - `time_created` integer: Time the task was created in Telerivet
  - `time_active` integer, nullable: Time Telerivet started executing the task
  - `time_complete` integer, nullable: Time Telerivet finished executing the task
  - `total_rows` integer, nullable: The total number of rows matching the filter (null if not known)
  - `current_row` integer, nullable: The number of rows that have been processed so far
  - `status` 'created' | 'queued' | 'active' | 'complete' | 'failed' | 'cancelled': The current status of the task
  - `error_message` string, nullable: Error message if the task failed
  - `vars` object: Custom variables stored for this task. Variable names may be up to 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _. Values may be strings, numbers, or boolean (true/false). String values may be up to 4096 bytes in length when encoded as UTF-8. Up to 100 variables are supported per object. Setting a variable to null will delete the variable.
  - `table_id` string: ID of the data table this task is applied to (if applicable)
  - `user_id` string: ID of the Telerivet user who created the task (if applicable)
  - `project_id` string: ID of the project this task belongs to

## Other responses

- `400`: Invalid request parameters
- `401`: Invalid or missing API key or Bearer token
- `404`: Resource not found

---

[API](https://skmtc.dev/telerivet/apis/telerivet-api.md) · [All operations](https://skmtc.dev/telerivet/apis/telerivet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/telerivet/apis/telerivet-api/revisions/4e14b1c8d917?raw)
