---
title: "Update 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.

# Update a task

Path: Nicer API › Notes and tasks

`PUT /crm/tasks/{taskId}`

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

Changes a task: its title, notes, date or assignee, or marks it done. Errors: 400 ERROR_BODY_VALIDATION, 404 ERROR_ITEM_NOT_FOUND.

## Authentication

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

## Path parameters

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

## Header parameters

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

## Request body

_Required._

- `assignedUserId` (`crm.tasks.update.assignedUserId`; any of, optional) — The user id of the advisor or admin who should do it; null assigns nobody.
  - any of the following: `string`, `null`
- `completed` (`crm.tasks.update.completed`; boolean, optional) — True marks the task done, false reopens it.
- `notes` (`crm.tasks.update.notes`; any of, optional) — More about it, 1 to 2,000 characters once trimmed; null clears it.
  - any of the following: `string`, `null`
- `tentativeDate` (`crm.tasks.update.tentativeDate`; any of, optional) — When it should be done, as YYYY-MM-DD; null leaves it undated.
  - any of the following: `string`, `null`
- `title` (`crm.tasks.update.title`; string, optional) — What to do, in a few words: 1 to 255 characters once trimmed.
  - maxLength: `255` · minLength: `1`

## Example request

```json
{
  "assignedUserId": "string",
  "completed": true,
  "notes": "string",
  "tentativeDate": "2019-08-24",
  "title": "string"
}
```

## 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.update({
  "taskId": "string"
});
```

### Nicer CLI

```bash
nicer crm tasks update --task-id 'string' --company "$NICER_COMPANY" --input - <<'JSON'
{}
JSON
```

### cURL

```bash
curl --request PUT \
  --url 'https://api.nicer.travel/crm/tasks/<taskId>' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Nicer-CRM-Contract: resource' \
  --header 'x-nicer-company: string' \
  --data '
{
  "assignedUserId": "string",
  "completed": true,
  "notes": "string",
  "tentativeDate": "2019-08-24",
  "title": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/crm/tasks/<taskId>';
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'x-nicer-company': 'string',
    'X-Nicer-CRM-Contract': 'resource',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({
    assignedUserId: 'string',
    completed: true,
    notes: 'string',
    tentativeDate: '2019-08-24',
    title: 'string'
  })
};

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>"

payload = {
    "assignedUserId": "string",
    "completed": True,
    "notes": "string",
    "tentativeDate": "2019-08-24",
    "title": "string"
}
headers = {
    "Content-Type": "application/json",
    "x-nicer-company": "string",
    "X-Nicer-CRM-Contract": "resource",
    "Authorization": "Bearer <token>"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "assignedUserId": "string",
  "associatedTripItineraryId": "string",
  "companyName": "string",
  "completed": true,
  "completedAt": "2019-08-24T14:15:22Z",
  "createdAt": "2019-08-24T14:15:22Z",
  "createdBy": "string",
  "lastModifiedBy": "string",
  "notes": "string",
  "origin": "ANNIVERSARY",
  "taskId": "string",
  "tentativeDate": "2019-08-24",
  "title": "string",
  "travelerId": "string",
  "travelerName": "string",
  "travelersTripId": "string",
  "tripName": "string",
  "updatedAt": "2019-08-24T14:15:22Z"
}
```

- `assignedUserId` (`crm.tasks.update.response.200.assignedUserId`; any of, required) — The advisor or admin who should do it; null when nobody is assigned.
  - any of the following: `string`, `null`
- `associatedTripItineraryId` (`crm.tasks.update.response.200.associatedTripItineraryId`; any of, required) — The itinerary (TI…) of the trip the task is about, when it has one; null otherwise.
  - any of the following: `string`, `null`
- `companyName` (`crm.tasks.update.response.200.companyName`; string, required) — The agency the task belongs to.
- `completed` (`crm.tasks.update.response.200.completed`; boolean, required) — Whether the task is done.
- `completedAt` (`crm.tasks.update.response.200.completedAt`; any of, required) — When the task was marked done; null while it is open.
  - any of the following: `string`, `null`
- `createdAt` (`crm.tasks.update.response.200.createdAt`; string, required) — When the task was created.
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`
- `createdBy` (`crm.tasks.update.response.200.createdBy`; string, required) — The user id of who created it, or SYSTEM for the CRM.
- `lastModifiedBy` (`crm.tasks.update.response.200.lastModifiedBy`; string, required) — The user id of who changed it last, or SYSTEM for the CRM.
- `notes` (`crm.tasks.update.response.200.notes`; any of, required) — More about it; null when there is none.
  - any of the following: `string`, `null`
- `origin` (`crm.tasks.update.response.200.origin`; string, required) — How the task was made.
  - one of `"ANNIVERSARY"`, `"BIRTHDAY"`, `"DOCUMENT_EXPIRY"`, `"MANUAL"`, `"TEMPLATE"`
- `taskId` (`crm.tasks.update.response.200.taskId`; string, required) — The task's id: what updateTask and deleteTask take.
- `tentativeDate` (`crm.tasks.update.response.200.tentativeDate`; any of, required) — When it should be done, as a date; null when undated.
  - any of the following: `string`, `null`
- `title` (`crm.tasks.update.response.200.title`; string, required) — What to do, in a few words.
- `travelerId` (`crm.tasks.update.response.200.travelerId`; any of, required) — The traveler the task is about; null for a task about a trip. A task is about one traveler or one trip.
  - any of the following: `TravelerId`, `null`
- `travelerName` (`crm.tasks.update.response.200.travelerName`; any of, required) — The traveler's name as the agency knows them, read when the task is answered; null for a task about a trip.
  - any of the following: `string`, `null`
- `travelersTripId` (`crm.tasks.update.response.200.travelersTripId`; any of, required) — The trip (TT…) the task is about; null for a task about a traveler.
  - any of the following: `string`, `null`
- `tripName` (`crm.tasks.update.response.200.tripName`; any of, required) — The trip's name, read when the task is answered; null for a task about a traveler or a trip without a name.
  - any of the following: `string`, `null`
- `updatedAt` (`crm.tasks.update.response.200.updatedAt`; string, required) — When the task last changed.
  - format: `date-time` · pattern: `^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$`

### 400

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

#### Example

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

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

### 401

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

#### Example

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

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

### 403

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

#### Example

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

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


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