# Update Task

Source: https://help.zira.us/developers/api-reference/update-task
Summary: Update existing task data.
Updated: 2026-08-06

## `PATCH /task/{id}`

Use this endpoint to update an existing task through the integration-facing task pipeline.

## Authentication

```http
x-api-key: <your-api-key>
Content-Type: application/json
```

See [API Authentication](/developers/api-reference/api-authentication) for how to create a key.

## Path parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | ID of the task to update. This is where the task ID belongs — a body `id` is ignored when both are sent. |

## Request body

Send only the fields you want to change. The task ID goes in the URL path, not in the body.

```json
{
  "statusId": "20",
  "priorityId": "15",
  "description": "Filter replaced, awaiting verification."
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `statusId` | string | no | New status. Setting it to `"25"` (Cancelled) also removes the task’s post from the feed. |
| `priorityId` | string | no | New priority — `5` Low, `10` Medium, `15` High. |
| `name` | string | no | New task name. |
| `description` | string | no | New plain-text description. |
| `dueDate` | string | no | New due date. |
| `siteId` | string | no | Move the task to another site. |
| `toChannelId` | string | no | Move the task’s feed post to another channel. |
| `fileIds` | string[] | no | Files to attach. |
| `formattedDescription` | object[] | no | Rich-text description as an array of nodes. |
| `timeSpentMandatory` | boolean | no | Require time to be logged before completion. |
| `id` | string | no | Optional and redundant — the path parameter is what identifies the task, and it wins if you send both. |

## Response

`200 OK`

Applies your changes and returns a number — the ID of the change-log comment Zira posted on the task. If nothing actually changed, you get the string `"SUCCESS"` instead. Handle both shapes; neither contains the updated task.

```json
{
  "data": 90214
}
```

| Field | Type | Description |
| --- | --- | --- |
| `data` | number | string | A number (the ID of the change-log comment that was posted) when something changed, or the string `"SUCCESS"` when nothing changed — or when the task has no feed post to comment on. It is never the task ID. |

### Good to know

- The response never contains the updated task. Call `GET /tasks` afterwards if you need the new state.
- The task ID comes from the URL path. An `id` in the body is optional, and if you send both, the path wins.
- A `PATCH` with no body is valid and simply reports no change.
- Any change that actually alters the task is written as a readable comment on its feed post — "changed status to Done", "assigned to …" — and broadcast to anyone watching. A request that changes nothing is silent.
- Setting `statusId` to `"25"` (Cancelled) hides the task’s post for anyone currently viewing the feed instead of updating it in place.
- The `typeId` / `deviceId` pairing rule that applies when creating a task does not apply here — both are accepted freely.
- The body is strict: `imageIds`, `mentions` and `ctas` are rejected with `400`. `fileIds` and `formattedDescription` are accepted.
- Reassigning through this endpoint is unreliable — `assigneeId` is not converted the way it is on create. Verify the result before depending on it.

## Errors

Failures return a JSON body with a `message` and an `internalErrorCode`, at the status shown below. Whenever the underlying error carries structured detail — which every schema-validation failure does — the body is replaced with a generic `Internal server error.` / `02-001` pair while the real status code is kept. Branch on the HTTP status and on `internalErrorCode`; never parse the message text.

```json
{
  "message": "Internal server error.",
  "internalErrorCode": "02-001"
}
```

| Status | Meaning |
| --- | --- |
| `400` | The request failed validation — a missing required field, a field the schema does not allow, an unparseable body, a value out of range, or a malformed `lastValue`. |
| `401` | The API key resolved to a user context that is not allowed to read or write the record you asked for. |
| `403` | The `x-api-key` header is missing or is not a recognised key. API Gateway rejects the call before the endpoint runs, so the body is only `{"message":"Forbidden"}`. |
| `409` | The write conflicts with an existing record, or it references a record that does not exist. |
| `429` | The API key exceeded the rate limit or quota on its usage plan. Also returned by API Gateway rather than the endpoint. |
| `500` | Unexpected server error, or the database returned no result where one was required. |
