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

Membership records

GET /v1/chats/:dialogId/users/relations

Returns the membership records of the named users: which of them are in the chat and with what role — owner, manager or member. Useful for checking the result of adding members or adding managers without fetching all members.

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
ParameteruserIds (query) Typestring Requiredyes DescriptionFrom 1 to 50 user IDs separated by commas, for example 5,7. Each is a positive integer without spaces or leading zeros. A repeated ID is allowed and counts toward the limit of 50

Other parameters and repeated ones are rejected with 400 INVALID_PARAMS.

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/chats/chat42/users/relations?userIds=5,7,12" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/chats/chat42/users/relations?userIds=5,7,12" \
  -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/users/relations?userIds=5,7,12', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
const inChat = new Set(data.relations.map((r) => r.userId))

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/users/relations?userIds=5,7,12', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
const inChat = new Set(data.relations.map((r) => r.userId))

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.relations Typearray DescriptionThe membership records of the named users who are in the chat. A user outside the chat is not listed
Fielddata.relations[].id Typenumber DescriptionMembership record ID
Fielddata.relations[].userId Typenumber DescriptionUser ID
Fielddata.relations[].chatId Typenumber DescriptionChat ID
Fielddata.relations[].role Typestring DescriptionThe role: owner, manager or member
Fielddata.relations[].isHidden Typeboolean DescriptionWhether the membership is hidden

Response example

JSON
{
  "success": true,
  "data": {
    "relations": [
      {
        "id": 71,
        "userId": 5,
        "chatId": 42,
        "isHidden": false,
        "role": "owner"
      },
      {
        "id": 77,
        "userId": 7,
        "chatId": 42,
        "isHidden": false,
        "role": "member"
      }
    ]
  }
}

Error response example

400 — no userIds:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "`userIds` is required: 1-50 Bitrix24 user ids separated by commas (4,7), each a positive integer without spaces or leading zeros."
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionuserIds is absent, holds more than 50 IDs or an ID that is not a positive integer, or another parameter or a repeated parameter is passed. 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's 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's 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 access and the im scope still apply.

See also