For AI agents: markdown of this page — /docs-content-en/chats/management/parent.md documentation index — /llms.txt
Parent chat
A chat can be made a child of another chat — a collab, for example — and detached again. The v2 messenger methods are im.v2.Chat.attachToParent and im.v2.Chat.detachFromParent.
Attach to a parent chat
PUT /v1/chats/:dialogId/parent
Makes the chat a child of the parentChatId chat. 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.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dialogId (path) |
string | yes | The chat that becomes a child, as chatN, for example chat42 |
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
parentChatId |
number | yes | ID of the parent chat — a positive integer: a number or a digit string without leading zeros |
Other body fields and query parameters are rejected with 400 INVALID_PARAMS before any call to Bitrix24.
Examples
curl — personal key
curl -X PUT https://vibecode.bitrix24.com/v1/chats/chat42/parent \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "parentChatId": 40 }'
curl — OAuth application
curl -X PUT https://vibecode.bitrix24.com/v1/chats/chat42/parent \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "parentChatId": 40 }'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/parent', {
method: 'PUT',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ parentChatId: 40 }),
})
const { success, data } = await res.json()
console.log('Attached:', data.result) // true
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/parent', {
method: 'PUT',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ parentChatId: 40 }),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.result |
boolean | true — the chat is attached |
Response example
{
"success": true,
"data": {
"result": true
}
}
Error response example
403 — the parent does not accept child chats, or the caller has no permission to invite members to it:
{
"success": false,
"error": {
"code": "BITRIX_ACCESS_DENIED",
"message": "ACCESS_DENIED"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | MISSING_PARAMS |
The parentChatId field is missing; a request without a body lands here too |
| 400 | INVALID_PARAMS |
parentChatId is not a positive integer, or another body field or a query parameter was sent |
| 403 | BITRIX_ACCESS_DENIED |
The parent does not accept child chats, or the caller has no permission to invite members to it |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 returned "not found"; the portal code is in error.b24Code |
| 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 |
| 502 | ME_ALIAS_RESOLUTION_FAILED |
Failed to resolve the user when using the me alias |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The key is read-only — see access rights |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
Detach from the parent chat
DELETE /v1/chats/:dialogId/parent
The chat stops being a child and becomes standalone. Detaching does not remove the members that attaching added to the parent chat. A chat can be detached by whoever has that permission in the chat; otherwise the answer is 403 BITRIX_ACCESS_DENIED.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dialogId (path) |
string | yes | The child chat as chatN, for example chat42 |
The endpoint accepts no query parameters and no request body: any parameter or body field is rejected with 400 INVALID_PARAMS before any call to Bitrix24.
Examples
curl — personal key
curl -X DELETE https://vibecode.bitrix24.com/v1/chats/chat42/parent \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X DELETE https://vibecode.bitrix24.com/v1/chats/chat42/parent \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/parent', {
method: 'DELETE',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { success, data } = await res.json()
console.log('Detached:', data.result) // true
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/parent', {
method: 'DELETE',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
success |
boolean | Always true on success |
data.result |
boolean | true — the chat is detached |
Response example
{
"success": true,
"data": {
"result": true
}
}
Error response example
422 — the chat has no parent:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "CHAT_HAS_NO_PARENT",
"b24Code": "CHAT_HAS_NO_PARENT"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
A query parameter or a body field was sent — the endpoint accepts neither |
| 403 | BITRIX_ACCESS_DENIED |
The caller has no permission to detach this chat |
| 404 | ENTITY_NOT_FOUND |
Bitrix24 returned "not found"; the portal code is in error.b24Code |
| 422 | BITRIX_ERROR |
Bitrix24 returned an error; the portal code is in error.b24Code. CHAT_HAS_NO_PARENT — the chat has no parent, CHAT_NOT_FOUND — the chat does not exist on the portal |
| 502 | ME_ALIAS_RESOLUTION_FAILED |
Failed to resolve the user when using the me alias |
| 403 | SCOPE_DENIED |
The API key does not have the im scope |
| 403 | WRITE_BLOCKED_READONLY_KEY |
The key is read-only — see access rights |
| 401 | TOKEN_MISSING |
The API key has no Bitrix24 tokens configured |
The full list of common API errors — Errors.
Known specifics
A regular group chat is never a parent. A group chat, even an open one, does not accept child chats: attaching to it answers 403 BITRIX_ACCESS_DENIED.
Where the parent is shown. In the chat card in the v2 mode, 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.