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

Chat members as entities

GET /v1/chats/:dialogId/member-entities

Returns who the chat consists of as "type — ID" pairs: users and the departments linked to the chat. Useful for showing the members in a member picker; user cards come from the member list.

Parameters

Parameter Type Required Description
ParameterdialogId (path) Typestring Requiredyes DescriptionDialog identifier: chatXXX for a group chat, a user ID for the personal dialog with that user, or the alias me for the personal dialog with yourself

Query parameters are not accepted: any of them is rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

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

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/chats/chat42/member-entities" \
  -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/chat42/member-entities', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
const userIds = data.memberEntities.filter(([type]) => type === 'user').map(([, id]) => id)

JavaScript — OAuth application

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

const { data } = await res.json()
const userIds = data.memberEntities.filter(([type]) => type === 'user').map(([, id]) => id)

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.memberEntities Typearray Description[type, ID] pairs. user — a member with their ID. department — a linked department: the ID is a number when its subdepartments are included, and a string <ID>:F for the department alone. Bots and guests are not listed
Fielddata.userCount Typenumber DescriptionThe number of members, bots and guests included
Fielddata.areUsersCollapsed Typeboolean Descriptiontrue — the chat has 1000 members or more, and the users are not listed in memberEntities

Response example

JSON
{
  "success": true,
  "data": {
    "memberEntities": [
      ["user", 5],
      ["user", 7],
      ["department", 12]
    ],
    "userCount": 2,
    "areUsersCollapsed": false
  }
}

Error response example

422 — the chat does not exist in the Bitrix24 account:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "CHAT_NOT_FOUND",
    "hint": "dialogId must be a userId (number as string) for DMs or \"chat{N}\" for group chats. Examples: \"1\" for user 1, \"chat123\" for group chat 123. Create a group chat first via POST /v1/bots/:botId/chats if needed.",
    "b24Code": "CHAT_NOT_FOUND"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionA query parameter was sent — the endpoint takes none. Checked before any call to Bitrix24
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the im scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionRead-only key, and the chat is not confirmed: a value other than chatN was passed and the personal dialog was not found in the same employee's recent dialog list — up to 20 pages and 4000 rows — or the alias creates a dialog. Rejected before any call to Bitrix24
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionRead-only key that is not an employee personal key: an application key with a user session, a management key, or a key with an unconfirmed owner
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no Bitrix24 tokens configured
HTTP404 CodeENTITY_NOT_FOUND DescriptionBitrix24 returned "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 chat lands here with the code CHAT_NOT_FOUND
HTTP502 CodeME_ALIAS_RESOLUTION_FAILED DescriptionThe user could not be resolved for the me alias

The full list of common API errors — Errors.

Known specifics

Reading may make you a member. If the chat allows auto-join, Bitrix24 may add the caller as a member. A READONLY key may perform this read under two conditions: it is an employee personal key, and the chat is confirmed — chatN was passed or the personal dialog was found in the same employee's recent dialogs. The read does not mark messages as read. The user's Bitrix24 permissions and the im scope still apply.

See also