
## Add managers

`POST /v1/bots/:botId/chats/:dialogId/managers`

Assigns users as chat managers. Managers have extended rights: they can manage participants and settings. The bot must be the chat owner.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `botId` (path) | number | yes | Bot ID. List: [`GET /v1/bots`](/docs/bots/management/list) |
| `dialogId` (path) | string | yes | Group chat ID in the form `chatXXX`. It arrives in the `data.chat.dialogId` field of the [`POST /v1/bots/:botId/chats`](/docs/bots/chats/create) response and in the `chat.dialogId` field of [bot events](/docs/bots/events/bot-events) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `userIds` | number[] | yes | Array of user IDs to assign as managers. Chat participant list: [`GET /v1/bots/:botId/chats/:dialogId/users`](/docs/bots/chats/user-list), field `data[].id` |

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/chats/chat456/managers \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "userIds": [5, 12] }'
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/chats/chat456/managers \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "userIds": [5, 12] }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/chats/chat456/managers', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ userIds: [5, 12] }),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/chats/chat456/managers', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ userIds: [5, 12] }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `data.result` | boolean | `true` on a successful assignment |

## Response example

```json
{
  "success": true,
  "data": {
    "result": true
  }
}
```

## Error response example

403 — the bot lacks rights to manage the chat:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ACCESS_DENIED",
    "message": "Access denied"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_BOT_ID` | `botId` is not a number |
| 404 | `BOT_NOT_FOUND` | No bot found with this ID |
| 403 | `BOT_ACCESS_DENIED` | The bot belongs to another API key |
| 403 | `BITRIX_ACCESS_DENIED` | The bot is not a participant of the chat or lacks rights — the owner role is required |
| 422 | `BITRIX_ERROR` | Another Bitrix24 error, text in `message` |
| 403 | `SCOPE_DENIED` | The API key does not have the `imbot` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](/docs/access-rights) |
| 410 | `BOT_DISABLED` | The bot is disabled and does not process API calls. How to restore it — [Bot disabled](/docs/bots/troubleshooting#bot-disabled-bot_disabled) |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## Known specifics

**Additive operation:** new managers are added to the existing ones rather than replacing them.

**Users not in the chat are ignored:** if `userIds` contains IDs of users who are not chat participants, they are skipped without an error.

## See also

- [Remove managers](/docs/bots/chats/manager-delete)
- [List participants](/docs/bots/chats/user-list)
- [Assign an owner](/docs/bots/chats/set-owner)
- [Bot platform](/docs/bots)
- [Limits and optimization](/docs/optimization)
