[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmembers\u002Fmanagers-set":3,"docs-tabs-chats\u002Fmembers\u002Fmanagers-set":6},{"content":4,"lastmod":5},"## Replace managers\n\n`PUT \u002Fv1\u002Fchats\u002F:dialogId\u002Fmanagers`\n\nReplaces 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](\u002Fdocs\u002Fchats\u002Fmembers\u002Fmanagers-add).\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `dialogId` (path) | string | yes | Group chat identifier `chatXXX`. A personal dialog is refused |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `userIds` | number[] | yes | The 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 \u002Fv1\u002Fchats\u002F:dialogId\u002Fusers`](\u002Fdocs\u002Fchats\u002Fmembers\u002Flist) |\n\nOther body fields and any query parameters are rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PUT \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fmanagers\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"userIds\": [7] }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PUT \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fmanagers\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"userIds\": [7] }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fmanagers', {\n  method: 'PUT',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ userIds: [7] }),\n})\n\nconst { success, data } = await res.json()\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fmanagers', {\n  method: 'PUT',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ userIds: [7] }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | boolean | `true` — the list was saved |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": true\n}\n```\n\n## Error response example\n\n400 — an empty list:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"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 \u002Fv1\u002Fchats\u002F:dialogId\u002Fmanagers?userIds=….\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `userIds` 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 |\n| 403 | `BITRIX_ACCESS_DENIED` | No right to change the managers, or `dialogId` is a personal dialog |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\"; the portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 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 |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | The user could not be resolved for the `me` alias |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**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](\u002Fdocs\u002Fchats\u002Fmembers\u002Fmanagers-remove).\n\n**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`.\n\n## See also\n\n- [Add managers](\u002Fdocs\u002Fchats\u002Fmembers\u002Fmanagers-add)\n- [Remove managers](\u002Fdocs\u002Fchats\u002Fmembers\u002Fmanagers-remove)\n- [Membership records](\u002Fdocs\u002Fchats\u002Fmembers\u002Frelations)\n- [Chat members](\u002Fdocs\u002Fchats\u002Fmembers)\n","2026-10-15",{},1794739544109]