# Update task

`PATCH /api/task/{taskId}`

URL: https://repsona.com/api/patch-task-taskid

Updates a task in the current space.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `taskId` | path | integer | required | ID of the task. |

## Request body

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `name` | body | string |  | Task name (1 to 255 characters). |
| `parentId` | body | integer \| null |  | ID of the parent task. `null` makes the task top-level. |
| `projectId` | body | integer |  | ID of the project the task belongs to. |
| `responsibleUserId` | body | integer \| null |  | ID of the user assigned to the task. `null` leaves it unassigned. |
| `ballHoldingUserId` | body | integer \| null |  | ID of the user who currently holds the ball, meaning who needs to act next. `null` means nobody. |
| `statusId` | body | integer \| null |  | ID of the status, which must belong to the task's project. `null` clears the status. |
| `milestoneId` | body | integer \| null |  | ID of the milestone, which must belong to the task's project. `null` clears the milestone. |
| `priority` | body | integer \| null |  | Priority: `1` is High, `2` is Mid, `3` is Low. `null` clears the priority. |
| `description` | body | string \| null |  | Task description as Markdown (up to 20,000 characters). `null` clears it. |
| `startDate` | body | number \| null |  | Start date as a Unix timestamp in milliseconds. `null` clears it. |
| `dueDate` | body | number \| null |  | Due date as a Unix timestamp in milliseconds. `null` clears it. |
| `extra` | body | object \| null |  | Extra display settings. Only `color` (a color string such as `#8CC230`, or `null`) is meaningful. |
| `applyToOpenDescendants` | body | boolean |  | When `true`, subtasks that are not completed (including those with no status) also get the new `statusId`. Requires `statusId`. Defaults to `false`. |

## Request

```sh
curl -X PATCH "https://<space>.repsona.com/api/task/{taskId}" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Write release notes for v2.0",
    "statusId": 196,
    "priority": 2,
    "dueDate": 1794614400000
  }'
```

## Responses

- 200: Task updated
- 400: Invalid request payload or move state
- 401: Authentication is required
- 404: Task not found

## Example response

```json
{
  "task": {
    "id": 100442,
    "parentId": null,
    "projectId": 296,
    "responsibleUserId": 1127,
    "ballHoldingUserId": 1127,
    "statusId": 196,
    "milestoneId": 38,
    "sortOrder": null,
    "statusBoardSortOrder": null,
    "priorityBoardSortOrder": null,
    "responsibleUserBoardSortOrder": null,
    "ballHoldingUserBoardSortOrder": null,
    "milestoneBoardSortOrder": null,
    "name": "Write release notes for v2.0",
    "planned": null,
    "actual": null,
    "priority": 2,
    "extra": null,
    "startDate": 1794182400000,
    "dueDate": 1794614400000,
    "createdAt": 1793662651065,
    "updatedAt": 1793662651113,
    "deletedAt": null,
    "tagIds": [
      90
    ]
  },
  "siblings": [],
  "bulk": false,
  "cascaded": null
}
```
