For AI agents: markdown of this page — /docs-content-en/chats/messages/comments-chat.md documentation index — /llms.txt
Open the discussion of a post
POST /v1/chats/messages/:messageId/comments/chat
Opens the comment chat of a channel post in one request. The response is the same as for loading a chat: the chat card, the first page of messages, pinned messages, participants and files. If the post has no comment chat yet, Bitrix24 creates it. You become a participant of this chat.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ParametermessageId (path) |
Typenumber | Requiredyes | Default— | DescriptionID of the channel post, a positive integer. Posts of a channel — Read messages |
ParametermessageLimit (query) |
Typenumber | Requiredno | Default50 | DescriptionHow many messages to take on each side of the pivot message: the page holds up to messageLimit messages before it, the message itself and up to messageLimit after. From 1 to 200: a value outside the range is clamped; the passed and applied values are in meta.requestedMessageLimit and meta.appliedMessageLimit |
ParameterpinLimit (query) |
Typenumber | Requiredno | Default50 | DescriptionHow many pinned messages to return. From 1 to 200; the passed and applied values are in meta.requestedPinLimit and meta.appliedPinLimit |
ParameterignoreMark (query) |
Typeboolean | Requiredno | Defaultfalse |
Descriptiontrue — build the first page from the last read message, ignoring the "unread" mark |
No body is needed. Other parameters, repeated parameters and body fields are rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/845/comments/chat?messageLimit=30" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/chats/messages/845/comments/chat?messageLimit=30" \
-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/messages/845/comments/chat?messageLimit=30', {
method: 'POST',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log('Comment chat:', data.chat.dialogId)
console.log('Comments:', data.messages.length)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/messages/845/comments/chat?messageLimit=30', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { data } = await res.json()
console.log('Comment chat:', data.chat.dialogId)
console.log('Comments:', data.messages.length)
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | DescriptionAlways true on success |
Fielddata.chat |
Typeobject | DescriptionThe comment chat card: id, dialogId, name, type, owner, role and other fields, as for loading a chat |
Fielddata.messages |
Typearray | DescriptionThe first page of messages of the comment chat |
Fielddata.pins |
Typearray | DescriptionPinned messages |
Fielddata.users |
Typearray | DescriptionParticipants mentioned on the page |
Fielddata.files |
Typearray | DescriptionFiles attached to the messages on the page |
Fielddata.reactions |
Typearray | DescriptionReactions to the messages on the page |
Fielddata.hasPrevPage |
Typeboolean | DescriptionWhether there are messages older than the first page |
Fielddata.hasNextPage |
Typeboolean | DescriptionWhether there are messages newer than the first page |
Fieldmeta.requestedMessageLimit |
Typenumber | DescriptionThe passed messageLimit value, present when it falls outside the range from 1 to 200 |
Fieldmeta.appliedMessageLimit |
Typenumber | DescriptionThe applied messageLimit value — only when it was clamped to a bound |
Fieldmeta.requestedPinLimit |
Typenumber | DescriptionThe passed pinLimit value, present when it falls outside the range from 1 to 200 |
Fieldmeta.appliedPinLimit |
Typenumber | DescriptionThe applied pinLimit value — only when it was clamped to a bound |
Response example
{
"success": true,
"data": {
"chat": {
"id": 2001,
"dialogId": "chat2001",
"name": "Post comments",
"type": "comment",
"owner": 5,
"role": "member"
},
"messages": [
{
"id": 3002,
"chatId": 2001,
"authorId": 7,
"date": "2026-10-29T10:01:00+00:00",
"text": "Agreed",
"params": {}
}
],
"pins": [],
"users": [],
"files": [],
"reactions": [],
"hasPrevPage": false,
"hasNextPage": false
}
}
Error response example
403 — a request with a read-only key:
{
"success": false,
"error": {
"code": "WRITE_BLOCKED_READONLY_KEY",
"message": "Key is in read-only mode. Switch the key to read and write in /keys to allow Bitrix24 data changes.",
"details": {
"method": "im.v2.Chat.load",
"keyName": "Reports dashboard",
"currentMode": "READONLY",
"switchUrl": "/keys"
}
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionmessageId is not a positive integer, or the request has a parameter other than messageLimit, pinLimit and ignoreMark, a repeated parameter, an invalid value, a body that is not a JSON object, or a body field. Checked before any call to Bitrix24 |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionBitrix24 returned a generic "not found" code or an error with the text "not found". The portal code is in error.b24Code |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 returned an error, the portal code is in error.b24Code. A missing message lands here too — with MESSAGE_NOT_FOUND, not with a 404 |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionThe user has no access to the chat — Bitrix24 refused with the ACCESS_DENIED code |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe API key does not have the im scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only: opening the discussion can create a chat and make you a participant — see access rights. No request is sent to Bitrix24 |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe API key has no Bitrix24 tokens configured |
The full list of common API errors — Errors.
Known specifics
Opening changes data. Bitrix24 can create the comment chat and add you as a participant. That is why a read-only key gets 403 WRITE_BLOCKED_READONLY_KEY, although the response is the same as for loading a chat.
The request is not retried automatically. On a network failure or a 5xx response the platform does not send the call again. Whether to retry is up to you.
Works for a forwarded post too. A forwarded post has no comment chat; this request creates it. To find the chat without opening it, use the comment summary: a post without a chat does not appear there.