## Mark an item complete with its sub-items

`POST /v1/tasks/:taskId/checklist/:itemId/complete-all`

Marks a task checklist item complete together with all its sub-items in one call. A top-level item is the checklist name, and marking it complete closes the whole checklist.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `taskId` (path) | number | yes | Task ID, a positive integer. List: [`GET /v1/tasks`](/docs/entities/tasks/list) |
| `itemId` (path) | number | yes | Item ID, a positive integer. List: [`GET /v1/tasks/:taskId/checklist`](/docs/entities/tasks/checklist/list) |

No request body is needed.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/4218/checklist/268/complete-all" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/4218/checklist/268/complete-all" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4218/checklist/268/complete-all', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Items marked:', data?.length)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4218/checklist/268/complete-all', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` if the request succeeded |
| `data` | array | Items marked complete: sub-items first, the `itemId` item itself last. For an item without sub-items, the array contains just that item |
| `data[].id` | number | Item ID |
| `data[].taskId` | number | Task ID |
| `data[].parentId` | number | Parent item ID. `0` means a top-level item, which is also the checklist name |
| `data[].title` | string | Item text |
| `data[].sortIndex` | number | Position of the item among items with the same parent. The smaller the value, the higher the item |
| `data[].displaySortIndex` | string | Display number of the item. An empty string in the response |
| `data[].isComplete` | boolean | Whether the item is complete. After the call, it is `true` for every item in the array |
| `data[].isImportant` | boolean | Whether the item is marked important |
| `data[].completedCount` | number | Arrives as `0` even when sub-items are complete. A sub-item's own `isComplete` shows whether it is complete |
| `data[].members` | array | Item members. An empty array if there are none. Member roles — see [key fields](/docs/entities/tasks/checklist-actions#key-fields) |
| `data[].attachments` | array \| object | Item attachments. An empty array if there are none. Object format — see [key fields](/docs/entities/tasks/checklist-actions#key-fields) |
| `data[].createdBy` | number | Item author ID. List: [`GET /v1/users`](/docs/entities/users/list) |
| `data[].userId` | number | ID of the employee on whose behalf the call is made. List: [`GET /v1/users`](/docs/entities/users/list) |
| `data[].copiedId` | number \| null | ID of the source item if the item was created by copying. Otherwise `null` |
| `data[].nodeId` | string \| null | Internal node key. `null` in the response |

## Response example

A top-level item with two sub-items is marked complete:

```json
{
  "success": true,
  "data": [
    {
      "id": 276,
      "copiedId": null,
      "userId": 1295,
      "createdBy": 1295,
      "parentId": 268,
      "title": "Check the build",
      "sortIndex": 1,
      "displaySortIndex": "",
      "isComplete": true,
      "isImportant": true,
      "completedCount": 0,
      "members": [],
      "attachments": [],
      "nodeId": null,
      "taskId": 4218
    },
    {
      "id": 274,
      "copiedId": null,
      "userId": 1295,
      "createdBy": 1295,
      "parentId": 268,
      "title": "Agree on the date",
      "sortIndex": 2,
      "displaySortIndex": "",
      "isComplete": true,
      "isImportant": false,
      "completedCount": 0,
      "members": [],
      "attachments": [],
      "nodeId": null,
      "taskId": 4218
    },
    {
      "id": 268,
      "copiedId": null,
      "userId": 1295,
      "createdBy": 1295,
      "parentId": 0,
      "title": "Launch preparation",
      "sortIndex": 0,
      "displaySortIndex": "",
      "isComplete": true,
      "isImportant": false,
      "completedCount": 0,
      "members": [],
      "attachments": [],
      "nodeId": null,
      "taskId": 4218
    }
  ]
}
```

## Error response example

422 — no item with this `itemId`:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Access to task was denied",
    "b24Code": "0"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `taskId` is not a positive integer. Message `taskId must be a positive integer` |
| 400 | `INVALID_PARAMS` | `itemId` is not a positive integer. Message `itemId must be a positive integer` |
| 400 | `FST_ERR_CTP_EMPTY_JSON_BODY` | The `Content-Type: application/json` header is passed with an empty body. Call the method without this header |
| 401 | `MISSING_API_KEY` | `X-Api-Key` is not passed |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key lacks the `task` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode. `error.details.switchUrl` contains the URL of the section where the mode is changed |
| 415 | `FST_ERR_CTP_INVALID_MEDIA_TYPE` | A body with a `Content-Type` the API does not parse, such as `application/xml` |
| 422 | `BITRIX_ERROR` | The task or item does not exist, or the employee on whose behalf the call is made cannot see the task. The message is in the Bitrix24 account language; on an English-language account it is `Access to task was denied`. The API specification declares `404 TASK_NOT_FOUND` and `404 NOT_FOUND` for this case, but the Bitrix24 accounts we tested return this response instead |
| 429 | `RATE_LIMITED` | Request rate exceeded. The effective cap is in the `x-ratelimit-limit` header |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**A repeated call returns no error.** If the item and its sub-items are already complete, the method again returns `200` with the same array of items.

## See also

- [Checklist actions and task file](/docs/entities/tasks/checklist-actions)
- [Save a task checklist](/docs/entities/tasks/checklist-actions/tree)
- [Move an item before another](/docs/entities/tasks/checklist-actions/move-before)
- [Move an item after another](/docs/entities/tasks/checklist-actions/move-after)
- [Mark an item complete](/docs/entities/tasks/checklist/complete)
- [Reopen an item](/docs/entities/tasks/checklist/renew)
- [List checklist items](/docs/entities/tasks/checklist/list)
- [Task checklist](/docs/entities/tasks/checklist)
