For AI agents: markdown of this page — /docs-content-en/chats/members/managers-set.md documentation index — /llms.txt
Replace managers
PUT /v1/chats/:dialogId/managers
Replaces the chat's entire list of managers with the given one: a manager missing from the list loses the role. The owner stays the owner whatever the list. To add managers without touching the others, use Add managers.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ParameterdialogId (path) |
Typestring | Requiredyes | DescriptionGroup chat identifier chatXXX. A personal dialog is refused |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
FielduserIds |
Typenumber[] | Requiredyes | DescriptionThe managers after the call — from 1 to 50 chat member IDs. Each element is a positive integer: a number or a string of decimal digits without leading zeros or spaces, up to 2^53−1. Members: GET /v1/chats/:dialogId/users |
Other body fields and any query parameters are rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl -X PUT "https://vibecode.bitrix24.com/v1/chats/chat42/managers" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "userIds": [7] }'
curl — OAuth application
curl -X PUT "https://vibecode.bitrix24.com/v1/chats/chat42/managers" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "userIds": [7] }'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/managers', {
method: 'PUT',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ userIds: [7] }),
})
const { success, data } = await res.json()
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/managers', {
method: 'PUT',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ userIds: [7] }),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata |
Typeboolean | Descriptiontrue — the list was saved |
Response example
{
"success": true,
"data": true
}
Error response example
400 — an empty list:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "`userIds` is required: a non-empty array of Bitrix24 user ids. An empty list changes nothing on the portal — to remove managers use DELETE /v1/chats/:dialogId/managers?userIds=…."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionuserIds is absent, empty, not an array, longer than 50 or holds something other than a positive integer — the index and type are named in message; an extra body field or a query parameter; the body is not a JSON object. Checked before any call to Bitrix24 |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionNo right to change the managers, or dialogId is a personal dialog |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe API key does not have the im scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only — see access rights |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no Bitrix24 tokens configured |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionBitrix24 returned "not found"; the portal code is in error.b24Code |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 did not save the list; the portal code is in error.b24Code. A list made only of users outside the chat lands here too: Bitrix24 answers with an internal error and changes nothing |
| HTTP502 | CodeME_ALIAS_RESOLUTION_FAILED |
DescriptionThe user could not be resolved for the me alias |
The full list of common API errors — Errors.
Known specifics
An empty list does not remove the managers. Bitrix24 would accept it as a success and change nothing, so an empty userIds is rejected. To take the role away from everyone, pass their IDs to Remove managers.
Users outside the chat are skipped as long as the list holds at least one member: the others get the role, and the response is true.