## Add checklist item members

`POST /v1/tasks/:taskId/checklist/:itemId/members`

Adds employees as members of a task checklist item, and each of them becomes a member of the task itself in the same role — participant or observer.

## 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 | Checklist item ID, a positive integer. List: [`GET /v1/tasks/:taskId/checklist`](/docs/entities/tasks/checklist/list) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `members` | object | yes | Who to add: the key is the employee ID, the value is the employee's role in the item. Employee list: [`GET /v1/users`](/docs/entities/users/list). An empty object `{}` changes nothing |
| `members.<userId>` | string \| object | no | Employee role — the string `A` or `U`, or the object `{ "TYPE": "U" }`. The object key is `TYPE` in uppercase, unlike `type` when [updating an item](/docs/entities/tasks/checklist/update). `A` — participant, `U` — observer |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/members" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "members": { "1295": "A" } }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/members" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "members": { "1295": "A" } }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/members', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ members: { '1295': 'A' } }),
})

const { success, data } = await res.json()
console.log('Item members:', data?.checkListItem?.members)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/4218/checklist/276/members', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ members: { '1295': 'A' } }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` if the request succeeded |
| `data.checkListItem` | object | The item after the members are added |
| `data.checkListItem.id` | number | Item ID |
| `data.checkListItem.taskId` | number | Task ID |
| `data.checkListItem.parentId` | number | Parent item ID. `0` means a top-level item |
| `data.checkListItem.title` | string | Item text |
| `data.checkListItem.sortIndex` | number | Sort index among items with the same parent |
| `data.checkListItem.displaySortIndex` | string | Item display number. The method does not populate it; an empty string is returned |
| `data.checkListItem.isComplete` | boolean | Whether the item is complete |
| `data.checkListItem.isImportant` | boolean | Whether the item is marked important |
| `data.checkListItem.completedCount` | number | Number of completed sub-items. The method does not recalculate it; `0` is returned |
| `data.checkListItem.createdBy` | number | Item author ID. List: [`GET /v1/users`](/docs/entities/users/list) |
| `data.checkListItem.userId` | number | ID of the employee on whose behalf the call is made |
| `data.checkListItem.copiedId` | number \| null | ID of the source item if the item was copied. Otherwise `null` |
| `data.checkListItem.members` | array | Item members. Employees from the request body are returned with only `type` and `id`. Existing members are returned as full objects |
| `data.checkListItem.members[].type` | string | Role: `A` — participant, `U` — observer |
| `data.checkListItem.members[].id` | number \| string | Employee ID. A number for employees from the request body, a string for existing members |
| `data.checkListItem.members[].name` | string | Employee's first and last name. Existing members only |
| `data.checkListItem.members[].personalPhoto` | string \| null | ID of the profile photo file. Existing members only |
| `data.checkListItem.members[].personalGender` | string \| null | Gender from the profile. An empty string means the gender is not specified. Existing members only |
| `data.checkListItem.members[].image` | string | Profile photo URL. Existing members only |
| `data.checkListItem.members[].isCollaber` | boolean | `true` if this is an external collab member rather than a company employee. Existing members only |
| `data.checkListItem.attachments` | array \| object | Item attachments. An empty array if there are none. For the object format, see [Key fields](/docs/entities/tasks/checklist-actions#key-fields) |
| `data.checkListItem.nodeId` | null | Node key from saving the checklist. `null` in this method's response |

## Response example

A participant is added; the item had no other members:

```json
{
  "success": true,
  "data": {
    "checkListItem": {
      "id": 276,
      "copiedId": null,
      "userId": 1295,
      "createdBy": 1295,
      "parentId": 268,
      "title": "Check the build",
      "sortIndex": 1,
      "displaySortIndex": "",
      "isComplete": true,
      "isImportant": true,
      "completedCount": 0,
      "members": [
        {
          "type": "A",
          "id": 1295
        }
      ],
      "attachments": [],
      "nodeId": null,
      "taskId": 4218
    }
  }
}
```

The body `{ "members": {} }` for an item that already has an observer: the members do not change, and the existing member is returned as a full object:

```json
{
  "success": true,
  "data": {
    "checkListItem": {
      "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": [
        {
          "id": "1295",
          "type": "U",
          "name": "John Smith",
          "personalPhoto": "33093",
          "personalGender": "",
          "image": "https://example.bitrix24.com/...",
          "isCollaber": false
        }
      ],
      "attachments": [],
      "nodeId": null,
      "taskId": 4218
    }
  }
}
```

## Error response example

422 — the role is neither `A` nor `U`:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Unknown user type passed [X]",
    "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 | `INVALID_PARAMS` | The body is missing or is not a JSON object. Message `JSON object body is required` |
| 400 | `INVALID_PARAMS` | `members` is missing or is not an object, for example an array. Message `members must be an object` |
| 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 role is neither `A` nor `U`. The message is in the Bitrix24 account language, for example "Unknown user type passed [X]", where the brackets hold the passed role |
| 422 | `BITRIX_ERROR` | The role is passed as an object without the `TYPE` key, for example `{ "type": "U" }`. The message is in the Bitrix24 account language, for example "Unknown user type passed []" with empty brackets |
| 404 | `TASK_NOT_FOUND` | The task is missing or inaccessible and the core returned the legacy named task-not-found signature |
| 404 | `NOT_FOUND` | The `itemId` item is missing, belongs to another task or is inaccessible. This also covers an unnamed task access denial in Russian, English, German or Kazakh; this denial does not distinguish a missing task from denied access |
| 422 | `BITRIX_ERROR` | Another Bitrix24 error, including an unrecognized core denial |
| 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 member can be removed by updating the item.** The member removal method does not work for this: it finds a member by position in the list, not by ID. Details — [What to know before you start](/docs/entities/tasks/checklist-actions#what-to-know-before-you-start).

**An employee with a low ID can displace another member.** If the ID of the employee being added matches a member's position in the item's `members` list — positions are counted from `0` — the new employee takes that position and the previous member drops out of the item. The response is still `200`. For example, an employee with ID `1` added to an item with two members displaces the second one. When the item already has members, check the member list with [Get a checklist item](/docs/entities/tasks/checklist/get) after the call, or set the full list with [Update a checklist item](/docs/entities/tasks/checklist/update) using the `members` field.

**A repeated call with a different role adds a second role instead of changing the first one.** If the employee already has the participant role on the item, a call with role `U` leaves them in the item with both roles, and in the task they become both a participant and an observer. A repeated call with the same role does not duplicate the member, although the response lists the employee once more as a short object.

**The employee ID is not checked.** A nonexistent ID with role `A` is accepted with a `200` response and is added both to the item members and to the task participants. Check the ID with [`GET /v1/users`](/docs/entities/users/list) before the call.

## See also

- [Checklist actions and task file](/docs/entities/tasks/checklist-actions)
- [Update a checklist item](/docs/entities/tasks/checklist/update)
- [List checklist items](/docs/entities/tasks/checklist/list)
- [Save a task checklist](/docs/entities/tasks/checklist-actions/tree)
- [Get task](/docs/entities/tasks/get)
- [List employees](/docs/entities/users/list)
