For AI agents: markdown of this page — /docs-content-en/chats.md documentation index — /llms.txt
Documentation articles are currently available in English.
Chats and messages
Work with the Bitrix24 messenger on behalf of the authorized user: find CRM entity chats, read and send messages, manage members, upload files, and receive events via polling.
Scope: im | Base URL: https://vibecode.bitrix24.com/v1 | Authorization: X-Api-Key
Quick start | Full example | Endpoint reference | Error codes
Documentation sections
- Chat discovery — recent dialogs, unread counters, chat folders and access checks, channels, collabs and external chats, shared chats, changes since a moment, CRM entity chats, search and dialog details
- Messages — reading, loading, context, sending, editing, deleting, marking as read, "read later", bulk loading
- Chat management — group chats, ownership, notifications, the unread mark, joining and leaving, parent chats, deletion, pinning, reading all chats or a list section, leaving
- Members — members, mentionable users, membership checks and managers, adding and removing
- Files — uploading files to a chat, saving them to Drive, transcribing audio, file metadata, the chat folder on Drive
- CoPilot — the CoPilot draft chat, the assistant's model and role, regenerating and rating answers
- Stickers — sticker packs, adding other users' packs, deletion, recent stickers
- Messenger settings — the user's general settings, status
- Service methods — task and flow forms, context for bots, Zoom, update state, plan restrictions, promo hints, the user's department, desktop app logout
- Links and guests — chat links for employees, joining by code, guest links and invitations by email and SMS
- Events — subscribing, polling messenger events, unsubscribing
Message formatting
References for formatting text when sending and editing messages:
Chat identifiers
Two kinds of identifiers appear in requests:
dialogId— the dialog identifier: a number (user ID) for a private conversation, or a string of the formchatN(for examplechat123) for group chats.chatId— the numeric chat ID without thechatprefix. Required for managing the chat, members, and files.
Instead of your own identifier you can pass the literal me — it is replaced with the ID of the current user who owns the key. This lets you send a message to yourself without requesting your own ID with a separate call. The literal is written in lowercase and works everywhere dialogId is accepted: dialog details, reading and sending messages, list of members.
Example — send yourself a notification:
curl -X POST "https://vibecode.bitrix24.com/v1/chats/me/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "Quarterly report is ready"}'
Direct message to a user
To send a direct message to a specific user, pass their numeric Bitrix24 user ID as the dialogId. No separate lookup or dialog creation is needed — POST /v1/chats/:dialogId/messages with a numeric dialogId delivers the message to a private conversation with that user. The chat lookup GET /v1/chats/find finds CRM entity chats and is not required for a private dialog.
A user's numeric ID comes from the user list GET /v1/users.
curl -X POST "https://vibecode.bitrix24.com/v1/chats/42/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "Sales digest for today is ready"}'
Quick start
Find the chat of a CRM deal, read the messages, and send a reply.
1. Find the deal chat
curl -H "X-Api-Key: YOUR_API_KEY" \
"https://vibecode.bitrix24.com/v1/chats/find?entityType=CRM&entityId=DEAL|123"
Response:
{
"success": true,
"data": {
"id": 2741
}
}
data.id is the numeric chatId. To build the dialogId when calling the message endpoints, add the chat prefix: chat2741.
2. Read the messages
curl -H "X-Api-Key: YOUR_API_KEY" \
"https://vibecode.bitrix24.com/v1/chats/chat2741/messages?limit=5"
Response:
{
"success": true,
"data": {
"chatId": 253,
"messages": [
{
"id": 9357,
"chatId": 253,
"authorId": 1,
"date": "2026-04-26T18:10:54+00:00",
"text": "Team, the proposal is approved. We can issue the invoice.",
"unread": false
}
],
"users": [
{
"id": 1,
"name": "John Brown",
"firstName": "John",
"lastName": "Brown"
}
],
"files": []
}
}
3. Send a reply
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat2741/messages" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message": "Invoice issued. Number: INV-2026-0458"}'
Response:
{
"success": true,
"data": 36889
}
data is the ID of the sent message.
Full example
An end-to-end scenario: create a group chat, send a greeting, mark the conversation as read, rename the chat, and leave it.
const VIBE_KEY = process.env.VIBE_KEY
const BASE = 'https://vibecode.bitrix24.com/v1'
async function api(method, path, body = null) {
const opts = { method, headers: { 'X-Api-Key': VIBE_KEY } }
if (body) {
opts.headers['Content-Type'] = 'application/json'
opts.body = JSON.stringify(body)
}
const res = await fetch(`${BASE}${path}`, opts)
return res.json()
}
// 1. Create a group chat
const created = await api('POST', '/chats', {
title: 'Working group',
users: [1, 5, 12],
})
const chatId = created.data // numeric chatId
const dialogId = `chat${chatId}` // dialogId for the message endpoints
console.log('Chat created, ID:', chatId)
// 2. Send a greeting
const sent = await api('POST', `/chats/${dialogId}/messages`, {
message: 'Welcome to the working group!',
})
console.log('Message sent, ID:', sent.data)
// 3. Mark the conversation as read
const read = await api('POST', `/chats/${dialogId}/read`, {})
console.log('Unread remaining:', read.data.counter)
// 4. Rename the chat — management calls use the numeric chatId, without the chat prefix
await api('PATCH', `/chats/${chatId}`, {
title: 'Project: Equipment delivery',
})
// 5. Leave the chat
await api('POST', `/chats/${chatId}/leave`, {})
console.log('Done')
If you are the chat owner, first transfer ownership via
POST /v1/chats/:chatId/owner, then leave the chat — otherwise you will leave the chat but remain its owner.
Endpoint reference
All 142 endpoints in this section:
| Method | Path | Bitrix24 method | Description |
|---|---|---|---|
| GET | /v1/chats/recent | im.recent.list; with format=v2 — im.v2.Recent.load, im.v2.Recent.tail |
Recent dialogs |
| GET | /v1/chats/counters | im.v2.Counter.get | Unread counters |
| GET | /v1/chats/recent/channels | im.v2.Recent.Channel.tail | Channel list |
| GET | /v1/chats/recent/collabs | im.v2.Recent.Collab.tail | Collab list |
| GET | /v1/chats/recent/external | im.v2.Recent.ExternalChat.tail | External chats of a section |
| GET | /v1/chats/shared | im.v2.Chat.listShared | Shared chats with a user |
| GET | /v1/chats/sync | im.v2.Sync.list | Chat changes since a moment |
| GET | /v1/chats/find | im.chat.get | Find a CRM entity chat |
| GET | /v1/chats/search | im.search.chat.list | Search chats by text |
| GET | /v1/chats/folders | im.v2.Folder.list | Chat folders |
| GET | /v1/chats/folders/:folderId/recent | im.v2.Folder.Recent.tail | Folder chats |
| GET | /v1/chats/:dialogId | im.dialog.get | Dialog details |
| GET | /v1/chats/:dialogId/messages | im.dialog.messages.get; with format=v2 — im.v2.Chat.Message.tail |
Read messages |
| GET | /v1/chats/:dialogId/load | im.v2.Chat.load | Load a chat |
| GET | /v1/chats/messages/:messageId/context | im.v2.Chat.Message.getContext | Messages around a message |
| GET | /v1/chats/:dialogId/messages/initial | im.v2.Chat.Message.list | First page of a chat |
| GET | /v1/chats/messages/:messageId/viewers | im.v2.Chat.Message.tailViewers | Who viewed a message |
| POST | /v1/chats/:dialogId/messages | im.message.add; with format=v2 — im.v2.Chat.Message.send |
Send a message |
| PATCH | /v1/chats/:dialogId/messages/:messageId | im.message.update; with format=v2 — im.v2.Chat.Message.update |
Edit a message |
| DELETE | /v1/chats/:dialogId/messages/:messageId | im.message.delete; with format=v2 — im.v2.Chat.Message.delete |
Delete a message |
| POST | /v1/chats/messages/:messageId/disappear | im.v2.Chat.Message.disappear | Disappearing message |
| POST | /v1/chats/messages/:messageId/inform | im.v2.Chat.Message.inform | Notify a recipient in Do Not Disturb |
| DELETE | /v1/chats/messages/:messageId/url-preview | im.v2.Chat.Message.deleteRichUrl | Remove a link preview |
| POST | /v1/chats/:dialogId/read | im.dialog.read; with format=v2 — im.v2.Chat.read |
Mark as read |
| POST | /v1/chats/messages/read | im.v2.Chat.Message.read | Mark messages as read |
| POST | /v1/chats/messages/:messageId/mark | im.v2.Chat.Message.mark | Read later |
| POST | /v1/chats/messages/bulk | batch (im.dialog.messages.get) | Bulk loading from several dialogs |
| GET | /v1/chats/:dialogId/messages/search | im.v2.Chat.Message.search | Search messages in a chat |
| POST | /v1/chats/:dialogId/forward | im.v2.Chat.Message.send | Forward messages |
| GET | /v1/chats/messages/:messageId/reactions | im.v2.Chat.Message.Reaction.tail | List reactions |
| POST | /v1/chats/messages/:messageId/reactions | im.v2.Chat.Message.Reaction.add | Add a reaction |
| DELETE | /v1/chats/messages/:messageId/reactions/:reaction | im.v2.Chat.Message.Reaction.delete | Remove a reaction |
| GET | /v1/chats/:dialogId/pins | im.v2.Chat.Pin.tail | List pins |
| POST | /v1/chats/messages/:messageId/pin | im.v2.Chat.Message.pin | Pin a message |
| DELETE | /v1/chats/messages/:messageId/pin | im.v2.Chat.Message.unpin | Unpin a message |
| GET | /v1/chats/:dialogId/pins/count | im.v2.Chat.Pin.count | Number of pinned messages |
| POST | /v1/chats/:dialogId/typing | im.v2.Chat.InputAction.notify | Typing indicator |
| POST | /v1/chats/:dialogId/anchors/read | im.v2.Chat.Anchor.read | Remove chat anchors |
| POST | /v1/chats/anchors/read | im.v2.Anchor.read | Remove message anchors |
| GET | /v1/chats/messages/comments | im.v2.Chat.Message.CommentInfo.list | Comment summary for posts |
| POST | /v1/chats/:dialogId/comments/read-all | im.v2.Chat.Comment.readAll | Mark all channel comments as read |
| POST | /v1/chats/messages/:messageId/comments/subscription | im.v2.Chat.Comment.subscribe | Follow post comments |
| DELETE | /v1/chats/messages/:messageId/comments/subscription | im.v2.Chat.Comment.unsubscribe | Stop following post comments |
| POST | /v1/chats/messages/:messageId/blocks | im.v2.Chat.Message.Block.Element.append | Add a message block |
| PATCH | /v1/chats/messages/:messageId/blocks/:blockId | im.v2.Chat.Message.Block.Element.update | Replace a message block |
| DELETE | /v1/chats/messages/:messageId/blocks/:blockId | im.v2.Chat.Message.Block.Element.delete | Delete a message block |
| POST | /v1/chats | im.chat.add | Create a group chat |
| PATCH | /v1/chats/:chatId | im.chat.updateTitle | Rename a chat |
| POST | /v1/chats/:chatId/owner | im.chat.setOwner; with format=v2 — im.v2.Chat.setOwner |
Transfer ownership |
| POST | /v1/chats/:chatId/leave | im.chat.leave | Leave a chat |
| POST | /v1/chats/:chatId/mute | im.chat.mute | Mute or unmute chat notifications |
| PUT | /v1/chats/:dialogId/description | im.v2.Chat.setDescription | Change a chat description |
| PUT | /v1/chats/:dialogId/color | im.v2.Chat.setColor | Change a chat color |
| PUT | /v1/chats/:dialogId/avatar | im.v2.Chat.setAvatar, with the avatarId field — im.v2.Chat.setAvatarId |
Change a chat avatar |
| PUT | /v1/chats/:dialogId/permissions/messages | im.v2.Chat.setManageMessages | Who posts messages |
| PUT | /v1/chats/:dialogId/permissions/guest-invites | im.v2.Chat.setManageGuestInvites | Who invites guests |
| PUT | /v1/chats/:dialogId/permissions/settings | im.v2.Chat.setManageSettings | Who changes chat permissions |
| PUT | /v1/chats/:dialogId/permissions/ui | im.v2.Chat.setManageUI | Who changes the chat's appearance |
| PUT | /v1/chats/:dialogId/permissions/users-add | im.v2.Chat.setManageUsersAdd | Who adds members |
| PUT | /v1/chats/:dialogId/permissions/users-delete | im.v2.Chat.setManageUsersDelete | Who removes members |
| PUT | /v1/chats/:dialogId/auto-delete | im.v2.Chat.setMessagesAutoDeleteDelay | Configure message auto-delete |
| GET | /v1/chats/:dialogId/users | im.dialog.users.list; with format=v2 — im.v2.Chat.Member.tail |
List of members |
| POST | /v1/chats/:chatId/users | im.chat.user.add; with format=v2 — im.v2.Chat.addUsers |
Add members |
| DELETE | /v1/chats/:chatId/users | im.chat.user.delete; with format=v2 — im.v2.Chat.deleteUser |
Remove a member |
| POST | /v1/chats/:dialogId/managers | im.v2.Chat.addManagers | Add managers |
| PUT | /v1/chats/:dialogId/managers | im.v2.Chat.setManagers | Replace managers |
| DELETE | /v1/chats/:dialogId/managers | im.v2.Chat.deleteManagers | Remove managers |
| GET | /v1/chats/:dialogId/member-entities | im.v2.Chat.MemberEntities.list | Chat members as entities |
| GET | /v1/chats/:dialogId/users/active | im.v2.Chat.User.list | Active members |
| GET | /v1/chats/:dialogId/users/relations | im.v2.Chat.Member.filterUsersByParticipation | Membership records |
| GET | /v1/chats/access | im.v2.Access.check | Check access to a chat or message |
| POST | /v1/chats/dialog-id | im.v2.Chat.getDialogId | Dialog ID by external identifier |
| GET | /v1/chats/messages/:messageId/load | im.v2.Chat.loadInContext | Load around a message |
| POST | /v1/chats/:dialogId/join | im.v2.Chat.join | Join a chat |
| PUT | /v1/chats/:dialogId/parent | im.v2.Chat.attachToParent | Attach to a parent chat |
| DELETE | /v1/chats/:dialogId/parent | im.v2.Chat.detachFromParent | Detach from the parent chat |
| DELETE | /v1/chats/:dialogId | im.v2.Chat.delete | Delete a chat — irreversible |
| POST | /v1/chats/:dialogId/unread | im.v2.Chat.unread | Set the "unread" mark |
| DELETE | /v1/chats/:dialogId/unread | im.v2.Chat.read | Clear the "unread" mark |
| POST | /v1/chats/folders | im.v2.Folder.add | Create a chat folder |
| GET | /v1/chats/folders/:folderId | im.v2.Folder.get | A folder with its chats |
| PATCH | /v1/chats/folders/:folderId | im.v2.Folder.update | Rename a folder, replace its contents |
| DELETE | /v1/chats/folders/:folderId | im.v2.Folder.delete | Delete a folder |
| PUT | /v1/chats/folders/order | im.v2.Folder.sort | Folder order |
| POST | /v1/chats/folders/:folderId/chats | im.v2.Folder.addChats | Add chats to a folder |
| DELETE | /v1/chats/folders/:folderId/chats | im.v2.Folder.deleteChats | Remove chats from a folder |
| PUT | /v1/chats/:dialogId/folders | im.v2.Folder.setChatFolders | The folders of one chat |
| GET | /v1/chats/folders/:folderId/sources | im.v2.Folder.getSources | Sources of the "All" folder (rolling out) |
| PUT | /v1/chats/folders/:folderId/sources | im.v2.Folder.updateSources | Set the sources of the "All" folder (rolling out) |
| POST | /v1/chats/:dialogId/pin | im.v2.Chat.pin | Pin a chat |
| PUT | /v1/chats/:dialogId/pin | im.v2.Chat.sortPin | Pinned chat order |
| DELETE | /v1/chats/:dialogId/pin | im.v2.Chat.unpin | Unpin a chat |
| POST | /v1/chats/read-all | im.v2.Chat.readAll | Read all chats |
| POST | /v1/chats/recent/read | im.v2.Chat.readByRecentSection | Read a list section |
| GET | /v1/chats/:dialogId/users/mentionable | im.v2.Chat.Mention.list | Users to mention |
| GET | /v1/chats/:dialogId/users/membership | im.v2.Chat.Member.checkMembership | Membership check |
| POST | /v1/chats/:chatId/files | im.disk.folder.get + disk.folder.uploadfile + im.disk.file.commit; with format=v2 — im.v2.File.upload |
Upload a file to a chat |
| GET | /v1/chats/files/:fileId | disk.file.get | File metadata |
| GET | /v1/chats/:chatId/folder | im.disk.folder.get | Chat folder on Drive |
| POST | /v1/chats/:dialogId/sharing-links/primary | im.v2.Chat.SharingLink.getPrimary | Get the primary chat link |
| POST | /v1/chats/:dialogId/sharing-links/individual | im.v2.Chat.SharingLink.getIndividual | Get an individual chat link |
| POST | /v1/chats/:dialogId/sharing-links/individual/regenerate | im.v2.Chat.SharingLink.regenerateIndividual | Regenerate an individual link |
| GET | /v1/chats/sharing-links/:code | im.v2.SharingLink.get | Get a link by code |
| DELETE | /v1/chats/sharing-links/:code | im.v2.Chat.SharingLink.revoke | Revoke a link by code |
| POST | /v1/chats/join-by-code | im.v2.Chat.joinByCode | Join a chat by code |
| POST | /v1/chats/:dialogId/guest-links | im.v2.Guest.Link.generate | Get a guest link |
| POST | /v1/chats/:dialogId/guest-links/regenerate | im.v2.Guest.Link.regenerate | Regenerate a guest link |
| DELETE | /v1/chats/:dialogId/guest-links | im.v2.Guest.Link.revoke | Revoke a guest link |
| POST | /v1/chats/:dialogId/guest-invites/email | im.v2.Guest.Link.inviteByEmail | Invite guests by email |
| POST | /v1/chats/:dialogId/guest-invites/phone | im.v2.Guest.Link.inviteByPhoneNumber | Invite guests by SMS |
| GET | /v1/chats/stickers/packs | im.v2.Sticker.Pack.load; with a cursor — im.v2.Sticker.Pack.tail | List sticker packs |
| GET | /v1/chats/stickers/packs/:packId | im.v2.Sticker.Pack.get | Sticker pack |
| PATCH | /v1/chats/stickers/packs/:packId | im.v2.Sticker.Pack.rename | Rename a pack |
| DELETE | /v1/chats/stickers/packs/:packId | im.v2.Sticker.Pack.delete | Delete a pack |
| POST | /v1/chats/stickers/packs/:packId/link | im.v2.Sticker.Pack.link | Add a pack to my list |
| DELETE | /v1/chats/stickers/packs/:packId/link | im.v2.Sticker.Pack.unlink | Remove a pack from my list |
| DELETE | /v1/chats/stickers/packs/:packId/stickers | im.v2.Sticker.delete | Delete stickers of a pack |
| DELETE | /v1/chats/stickers/recent | im.v2.Sticker.Recent.deleteAll | Clear recent stickers |
| DELETE | /v1/chats/stickers/recent/:stickerId | im.v2.Sticker.Recent.delete | Remove a recent sticker |
| POST | /v1/chats/files/save | im.v2.Disk.File.save | Save files to Drive |
| POST | /v1/chats/files/:fileId/transcribe | im.v2.Disk.File.transcribe | Transcribe an audio file |
| POST | /v1/chats/copilot/draft | im.v2.Copilot.DraftChat.get | CoPilot draft chat |
| PUT | /v1/chats/:dialogId/copilot/engine | im.v2.Chat.Copilot.updateEngine | Change the CoPilot model |
| PUT | /v1/chats/:dialogId/copilot/role | im.v2.Chat.Copilot.updateRole | Change the CoPilot role |
| POST | /v1/chats/messages/:messageId/regenerate | im.v2.Copilot.Message.regenerate | Regenerate a CoPilot answer |
| POST | /v1/chats/messages/:messageId/vote | im.v2.Chat.Message.Vote.send | Rate an answer |
| GET | /v1/chats/settings | im.v2.Settings.General.list | General messenger settings |
| PATCH | /v1/chats/settings | im.v2.Settings.General.update | Change a setting |
| PUT | /v1/chats/settings/status | im.v2.Settings.Status.update | Set the status |
| GET | /v1/chats/:dialogId/task-form | im.v2.Chat.Task.prepare | Task form for a chat |
| POST | /v1/chats/messages/:messageId/task-form | im.v2.Chat.Task.prepare | Task form for a message |
| GET | /v1/chats/:dialogId/flow-form | im.v2.Chat.Flow.prepare | Collab flow form |
| POST | /v1/chats/:dialogId/bot-context | im.v2.Chat.Bot.sendContext | Context for chat bots |
| POST | /v1/chats/:dialogId/zoom | im.v2.Call.Zoom.create | Zoom meeting |
| GET | /v1/chats/state | im.v2.UpdateState.getStateData | Update state |
| GET | /v1/chats/tariff-restrictions | im.v2.Tariff.Restriction.get | Plan restrictions |
| GET | /v1/chats/promotions | im.v2.Promotion.listActive | Promo hints |
| GET | /v1/chats/users/:userId/department | im.v2.User.getDepartment | User department |
| POST | /v1/chats/desktop/logout | im.v2.Desktop.logout | Desktop app logout |
| POST | /v1/chats/events/subscribe | im.v2.Event.subscribe | Subscribe to events |
| POST | /v1/chats/events/unsubscribe | im.v2.Event.unsubscribe | Unsubscribe from events |
| GET | /v1/chats/events | im.v2.Event.get | Get events |
Error codes
Codes specific to working with chats:
| Code | HTTP | Description |
|---|---|---|
SCOPE_DENIED |
403 | The API key does not have the im scope |
TOKEN_MISSING |
401 | The API key has no Bitrix24 tokens configured |
MISSING_PARAMS |
400 | Required parameters were not passed (entityType/entityId when searching, filename/content when uploading a file) |
INVALID_REQUEST |
400 | Malformed request body (for example, an empty dialogs array in bulk loading) |
BATCH_LIMIT_EXCEEDED |
400 | Bulk loading exceeds the limit of 50 dialogs |
INVALID_CHAT_ID |
400 | chatId is not a positive integer |
INVALID_PARAMS |
400 | Invalid messageId or fileId; for format=v2, load, counters, context, links and guests, folders, unread and read-later marks, mentions, membership checks, list sections, shared chats, sync, chat pinning, settings and service methods — an unknown, repeated or invalid query parameter or body field. CoPilot, file saving and transcription also reject missing or invalid body fields. Checked before calling Bitrix24. |
TITLE_EMPTY |
400 | Empty title when renaming a chat |
INVALID_OFFSET |
400 | Invalid offset when polling events |
INVALID_LIMIT |
400 | limit is out of the allowed range |
PAYLOAD_TOO_LARGE |
413 | The request body exceeds 1 MiB — when setting an avatar from an image |
BITRIX_ACCESS_DENIED |
403 | Bitrix24 refused to change the chat settings: the user is not a chat member, or a chat permission does not allow it |
CHAT_NOT_FOUND_OR_NO_ACCESS |
404 | The chat does not exist or you do not have permission for the operation |
DIALOG_NOT_FOUND_OR_NO_ACCESS |
404 | The dialog does not exist or you do not have access to it |
ENTITY_NOT_FOUND |
404 | The requested object was not found |
FILE_NOT_FOUND |
404 | A file with the given fileId was not found |
FOLDER_NOT_FOUND |
404 | The chat folder on Drive was not found |
UPLOAD_FAILED |
500 | Failed to upload the file to Drive |
ME_ALIAS_RESOLUTION_FAILED |
502 | Failed to resolve the current user for the me alias |
BITRIX_ERROR |
422 | Bitrix24 returned an error (text in the message field) |
FOLDER_PINS_LIMIT_EXCEEDED |
422 | Bitrix24 code in error.b24Code when pinning a chat: 45 chats are already pinned |
INVALID_PIN_POSITION |
422 | Bitrix24 code in error.b24Code when changing the pinned chat order: position is greater than 45 |
BITRIX_UNAVAILABLE |
502 | The Bitrix24 portal is unavailable or returned a server error |
General codes for authorization, keys, and limits are on the Errors page.