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
dialogId (path) string yes Dialog 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
success boolean Always true on success
data.memberEntities array [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
data.userCount number The number of members, bots and guests included
data.areUsersCollapsed boolean true — 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",
    "b24Code": "CHAT_NOT_FOUND"
  }
}

Errors

HTTP Code Description
400 INVALID_PARAMS A query parameter was sent — the endpoint takes none. Checked before any call to Bitrix24
403 SCOPE_DENIED The API key does not have the im scope
401 TOKEN_MISSING The API key has no Bitrix24 tokens configured
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. A missing chat lands here with the code CHAT_NOT_FOUND
502 ME_ALIAS_RESOLUTION_FAILED The 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 use this read operation under the narrow exception; it does not mark messages read. The user's Bitrix24 access and the im scope still apply.

See also