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

Dialog details

GET /v1/chats/:dialogId

Returns data about a dialog — a private or a group chat.

Parameters

Parameter Type Required Description
ParameterdialogId (path) Typestring Requiredyes DescriptionDialog identifier. Numeric ID for a private chat (1), chatN for a group chat (chat42), or the literal me — the current user (see Section overview). chatN is the id field of a row in recent dialogs; a user ID comes from the user list
Parameterformat (query) Typestring Requiredno Descriptionv2 turns on the v2 mode — see "The v2 mode" below. Any other value is ignored and the response is unchanged

The v2 mode. format=v2 reads the chat. data carries the object { chat, recentConfig, parentChat, copilot, messagesAutoDeleteConfigs, callInfo } with camelCase keys: chat is the chat card with permissions but without the old counter, restrictions and readedList; the rest is the chat context. The mode accepts only format. Any other parameter or a repeated parameter is rejected with 400 INVALID_PARAMS. The v2 mode may make you a member: when the chat allows auto-join — a comment chat, a collab or a task chat, for example — the call adds the current user as a member, as loading a chat does. In the v2 mode this targeted read operation is available to a READONLY key only when it is an employee's personal key with the im scope. It does not mark messages as read by itself.

Read-only key. In READONLY mode, this request reads an existing chat: pass its chatN, or a numeric peer ID confirmed in the same employee's recent dialogs. For me, the check looks for an existing personal dialog. The check scans at most 4000 raw rows of recent dialogs. If the binding is not confirmed, the request returns 403 WRITE_BLOCKED_READONLY_KEY without calling a method that could create a chat. The check's limits and the permitted read effects are described in access rights.

Examples

curl — personal key

Terminal
curl https://vibecode.bitrix24.com/v1/chats/1 \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl https://vibecode.bitrix24.com/v1/chats/1 \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/1', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log('Dialog:', data.name, 'type:', data.type)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/1', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const { data } = await res.json()

curl — the v2 mode

Terminal
curl "https://vibecode.bitrix24.com/v1/chats/chat42?format=v2" \
  -H "X-Api-Key: YOUR_API_KEY"

Response fields

The main fields are shown. The response contains the full dialog object.

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typeobject DescriptionDialog object
Fielddata.id Typenumber DescriptionDialog identifier
Fielddata.name Typestring DescriptionChat title
Fielddata.description Typestring DescriptionChat description
Fielddata.type Typestring DescriptionDialog type: private — private, chat — group, open — open channel
Fielddata.owner Typenumber DescriptionOwner ID. Source: GET /v1/users
Fielddata.color Typestring DescriptionChat color in #rrggbb format
Fielddata.avatar Typestring DescriptionChat avatar URL
Fielddata.counter Typenumber DescriptionNumber of unread messages for the current user
Fielddata.userCounter Typenumber DescriptionNumber of members
Fielddata.messageCount Typenumber DescriptionTotal number of messages in the chat
Fielddata.lastId Typenumber DescriptionID of the last message. Used as a cursor in GET /v1/chats/:dialogId/messages
Fielddata.dialogId Typestring DescriptionDialog identifier in the format used by Bitrix24
Fielddata.dateCreate Typestring DescriptionCreation date (ISO 8601)
Fielddata.role Typestring DescriptionRole of the current user: owner, manager, member
Fielddata.entityType Typestring DescriptionType of the linked CRM entity (CRM, FAVORITE, etc.) or an empty string
Fielddata.entityId Typestring DescriptionIdentifier of the linked CRM entity or an empty string
Fielddata.restrictions Typeobject DescriptionAction restrictions in the chat (see below)
Fielddata.permissions Typeobject DescriptionChat management permissions (see below)
Fielddata.restrictions.avatar Typeboolean DescriptionThe current user can change the avatar
Fielddata.restrictions.rename Typeboolean DescriptionThe current user can rename the chat
Fielddata.restrictions.extend Typeboolean DescriptionThe current user can invite members
Fielddata.restrictions.call Typeboolean DescriptionThe current user can initiate a call
Fielddata.restrictions.leave Typeboolean DescriptionThe current user can leave the chat
Fielddata.restrictions.send Typeboolean DescriptionThe current user can send messages
Fielddata.permissions.manageUsersAdd Typestring DescriptionWho can add members: owner, manager, member
Fielddata.permissions.manageUsersDelete Typestring DescriptionWho can remove members
Fielddata.permissions.manageSettings Typestring DescriptionWho can change chat settings
Fielddata.permissions.canPost Typestring DescriptionWho can send messages
Fielddata.chat Typeobject DescriptionThe v2 mode: the chat card — id, dialogId, name, type, owner, role, parentChatId, managerList, permissions and other fields
Fielddata.recentConfig Typeobject DescriptionThe v2 mode: which sections of the chat list show the chat — chatId and sections
Fielddata.parentChat Typeobject|null DescriptionThe v2 mode: a short card of the parent chat — see parent chat. null when there is no parent or no access to it
Fielddata.copilot Typeobject|null DescriptionThe v2 mode: the CoPilot roles in the chat. null outside CoPilot chats
Fielddata.messagesAutoDeleteConfigs Typearray DescriptionThe v2 mode: message auto-deletion settings
Fielddata.callInfo Typeobject DescriptionThe v2 mode: call data of the chat — chatId and token, the current user's call token. The endpoint passes it through unchanged. Do not write it to logs

Response example

The "Favorites" dialog requested with dialogId = me:

JSON
{
  "success": true,
  "data": {
    "id": 253,
    "name": "Favorites",
    "description": "",
    "owner": 1,
    "type": "private",
    "color": "#4ba984",
    "avatar": "",
    "counter": 0,
    "userCounter": 1,
    "messageCount": 1,
    "lastId": 9357,
    "dialogId": "1",
    "dateCreate": "2024-03-15T10:30:00+00:00",
    "role": "owner",
    "entityType": "FAVORITE",
    "entityId": "",
    "restrictions": {
      "avatar": true,
      "rename": true,
      "extend": true,
      "call": true,
      "mute": true,
      "leave": true,
      "leaveOwner": true,
      "send": true,
      "userList": true
    },
    "permissions": {
      "manageUsersAdd": "member",
      "manageUsersDelete": "manager",
      "manageUi": "member",
      "manageSettings": "owner",
      "manageMessages": "member",
      "canPost": "member"
    }
  }
}

Error response example

422 — the dialog is unavailable or does not exist:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "You do not have access to the specified dialog"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionThe v2 mode only: a parameter other than format or a repeated parameter. Checked before any call to Bitrix24
HTTP422 CodeBITRIX_ERROR DescriptionWithout format: the dialog is unavailable or does not exist — Bitrix24 returned an access error. In the v2 mode — a non-existent chat: the portal code is in error.b24Code: CHAT_NOT_FOUND
HTTP502 CodeME_ALIAS_RESOLUTION_FAILED DescriptionFailed to resolve the current user ID when using the me alias
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionThe v2 mode only: the user has no access to the chat — Bitrix24 refused with the ACCESS_DENIED code
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionRead-only mode: the existing chat was not confirmed within the limited window of recent dialogs, or a creating or ambiguous alias was passed. The method that would create the chat is not sent to the portal
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the im scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens

The full list of general API errors — Errors.

Known specifics

  • A numeric dialogId equal to the current user's ID opens the "Favorites" dialog.

See also