For AI agents: markdown of this page — /docs-content-en/chats/management/parent.md documentation index — /llms.txt

Attach to a parent chat

PUT /v1/chats/:dialogId/parent

Makes 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.

Parameters

Parameter Type Required Description
dialogId (path) string yes The chat that becomes a child, as chatN, for example chat42 — the dialogId field of recent dialogs

Request fields (body)

Field Type Required Description
parentChatId number yes ID of the parent chat — the chatId field of recent dialogs. 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

Terminal
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

Terminal
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

javascript
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

javascript
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

JSON
{
  "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:

JSON
{
  "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, or the body is not a JSON object
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
502 BITRIX_UNAVAILABLE Bitrix24 is unavailable or returned a server error
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 returns 403 BITRIX_ACCESS_DENIED.

Where the parent is shown. In the chat card in 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.

See also