[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-bots\u002Fchats\u002Fset-owner":3,"docs-tabs-bots\u002Fchats\u002Fset-owner":6},{"content":4,"lastmod":5},"\n## Assign an owner\n\n`POST \u002Fv1\u002Fbots\u002F:botId\u002Fchats\u002F:dialogId\u002Fowner`\n\nTransfers chat ownership to another user. The bot must be the current chat owner.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `botId` (path) | number | yes | Bot ID. List: [`GET \u002Fv1\u002Fbots`](\u002Fdocs\u002Fbots\u002Fmanagement\u002Flist) |\n| `dialogId` (path) | string | yes | Group chat ID in the form `chatXXX`. Returned in the `data.chat.dialogId` field of [`POST \u002Fv1\u002Fbots\u002F:botId\u002Fchats`](\u002Fdocs\u002Fbots\u002Fchats\u002Fcreate) and in the `chat.dialogId` field of [bot events](\u002Fdocs\u002Fbots\u002Fevents\u002Fbot-events) |\n\n## Request fields (body)\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `userId` | number | yes | ID of the new owner |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fbots\u002F42\u002Fchats\u002Fchat456\u002Fowner \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"userId\": 5 }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fbots\u002F42\u002Fchats\u002Fchat456\u002Fowner \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"userId\": 5 }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fbots\u002F42\u002Fchats\u002Fchat456\u002Fowner', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ userId: 5 }),\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\u002Fbots\u002F42\u002Fchats\u002Fchat456\u002Fowner', {\n  method: 'POST',\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({ userId: 5 }),\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` | object | Result of the ownership transfer |\n| `data.result` | boolean | `true` if ownership was transferred successfully |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"result\": true\n  }\n}\n```\n\n## Error response example\n\n403 — the bot is not the chat owner:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ACCESS_DENIED\",\n    \"message\": \"Access denied\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_BOT_ID` | `botId` is not a number |\n| 404 | `BOT_NOT_FOUND` | No bot found with this ID |\n| 403 | `BOT_ACCESS_DENIED` | The bot belongs to another API key |\n| 403 | `BITRIX_ACCESS_DENIED` | The bot is not a participant of the chat or is not its owner |\n| 422 | `BITRIX_ERROR` | Another Bitrix24 error, text in `message` |\n| 403 | `SCOPE_DENIED` | The API key does not have the `imbot` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 410 | `BOT_DISABLED` | The bot is disabled and does not process API calls. How to restore it — [Bot disabled](\u002Fdocs\u002Fbots\u002Ftroubleshooting#bot-disabled-bot_disabled) |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Add managers](\u002Fdocs\u002Fbots\u002Fchats\u002Fmanager-add)\n- [Get a chat](\u002Fdocs\u002Fbots\u002Fchats\u002Fget)\n- [Bot platform](\u002Fdocs\u002Fbots)\n- [Limits and optimization](\u002Fdocs\u002Foptimization)\n","2026-10-09",{},1794739445863]