[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmanagement\u002Fparent":3,"docs-tabs-chats\u002Fmanagement\u002Fparent":6},{"content":4,"lastmod":5},"## Attach to a parent chat\n\n`PUT \u002Fv1\u002Fchats\u002F:dialogId\u002Fparent`\n\nMakes the chat a child of another chat, the parent. The parent must allow child chats — a collab does — and the caller needs permission to invite members to the parent: attaching adds the chat's members to the parent chat. Bitrix24 itself rejects anything it does not allow.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `dialogId` (path) | string | yes | The chat that becomes a child, as `chatN`, for example `chat42` — the `dialogId` field of [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `parentChatId` | number | yes | ID of the parent chat — the `chatId` field of [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent). A positive integer: a number or a digit string without leading zeros |\n\nOther body fields and query parameters are rejected with `400 INVALID_PARAMS` before any call to Bitrix24.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PUT https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fparent \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"parentChatId\": 40 }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PUT https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fparent \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"parentChatId\": 40 }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fparent', {\n  method: 'PUT',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ parentChatId: 40 }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('Attached:', data.result) \u002F\u002F true\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fparent', {\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({ parentChatId: 40 }),\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.result` | boolean | `true` — the chat is attached |\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 parent does not accept child chats, or the caller has no permission to invite members to it:\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 | `MISSING_PARAMS` | The `parentChatId` field is missing; a request without a body lands here too |\n| 400 | `INVALID_PARAMS` | `parentChatId` is not a positive integer, or another body field or a query parameter was sent, or the body is not a JSON object |\n| 403 | `BITRIX_ACCESS_DENIED` | The parent does not accept child chats, or the caller has no permission to invite members to it |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\"; the portal code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the portal code is in `error.b24Code`. `CHAT_ALREADY_HAS_PARENT` — the chat already has a parent, detach it first; `WRONG_PARENT_CHAT` — the parent chat does not exist or is the chat itself; `CHAT_NOT_FOUND` — the chat does not exist on the portal |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Failed to resolve the user when using the `me` alias |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\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\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**A regular group chat is never a parent.** A group chat, even an open one, does not accept child chats: attaching to it returns `403 BITRIX_ACCESS_DENIED`.\n\n**Where the parent is shown.** In the [chat card in v2 mode](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Fget), a child chat has `chat.parentChatId` set to the parent's ID and `parentChat` set to a short card of the parent if you have access to it. Otherwise `parentChat` is `null`.\n\n## See also\n\n- [Detach from the parent chat](\u002Fdocs\u002Fchats\u002Fmanagement\u002Fparent-delete)\n- [Chat management](\u002Fdocs\u002Fchats\u002Fmanagement)\n- [Dialog details](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Fget)\n- [Add members](\u002Fdocs\u002Fchats\u002Fmembers\u002Fadd)\n","2026-10-05",{},1794739541236]