---
title: "Delete a task"
---

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

# Delete a task

Path: Nicer API › Notes and tasks

`DELETE /crm/tasks/{taskId}`

URL: `https://api.nicer.travel/crm/tasks/{taskId}`

Deletes a task for good, taking it off its assignee's list and its day's reminders, and publishes crm.task-changed.v1 with action DELETED. Answers the task's id with deleted set to true; deleting it again answers 404. To close a task that was done, mark it completed with PUT /crm/tasks/{taskId} instead. Errors: 404 ERROR_ITEM_NOT_FOUND for a task there is not, or about a traveler or trip the caller may not see.

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Path parameters

- `taskId` (`crm.tasks.delete.path.taskId`; string, required)

## Header parameters

- `x-nicer-company` (`crm.tasks.delete.header.x-nicer-company`; string, required) — Company context. Authentication and tenant membership are validated by the API.
- `X-Nicer-CRM-Contract` (`crm.tasks.delete.header.X-Nicer-CRM-Contract`; string, required)
  - one of `"resource"` · example: `"resource"`

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
  headers: { "x-nicer-company": process.env.NICER_COMPANY },
});

await nicer.crm.tasks.delete({
  "taskId": "string"
});
```

### Nicer CLI

```bash
nicer crm tasks delete --task-id 'string' --company "$NICER_COMPANY"
```

### cURL

```bash
curl --request DELETE \
  --url 'https://api.nicer.travel/crm/tasks/<taskId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'X-Nicer-CRM-Contract: resource' \
  --header 'x-nicer-company: string'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/crm/tasks/<taskId>';
const options = {
  method: 'DELETE',
  headers: {
    'x-nicer-company': 'string',
    'X-Nicer-CRM-Contract': 'resource',
    Authorization: 'Bearer <token>'
  }
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/crm/tasks/<taskId>"

headers = {
    "x-nicer-company": "string",
    "X-Nicer-CRM-Contract": "resource",
    "Authorization": "Bearer <token>"
}

response = requests.delete(url, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "deleted": true,
  "id": "string"
}
```

- `deleted` (`crm.tasks.delete.response.200.deleted`; boolean, required) — Always true: the record no longer exists.
- `id` (`crm.tasks.delete.response.200.id`; string, required) — The id of the record deleted.

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`crm.tasks.delete.response.400.errorCode`; string, required)
- `errorMessage` (`crm.tasks.delete.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`crm.tasks.delete.response.401.errorCode`; string, required)
- `errorMessage` (`crm.tasks.delete.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`crm.tasks.delete.response.403.errorCode`; string, required)
- `errorMessage` (`crm.tasks.delete.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/Notes-and-tasks/crm.tasks.delete/index.md
