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 |
|---|---|---|---|
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 |
userIds (query) |
string | yes | From 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 50 |
Other parameters and repeated ones are rejected with 400 INVALID_PARAMS.
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/chats/chat42/users/relations?userIds=5,7,12" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
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
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
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 |
|---|---|---|
success |
boolean | Always true on success |
data.relations |
array | The membership records of the named users who are in the chat. A user outside the chat is not listed |
data.relations[].id |
number | Membership record ID |
data.relations[].userId |
number | User ID |
data.relations[].chatId |
number | Chat ID |
data.relations[].role |
string | The role: owner, manager or member |
data.relations[].isHidden |
boolean | Whether the membership is hidden |
Response example
{
"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:
{
"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 |
|---|---|---|
| 400 | INVALID_PARAMS |
userIds is absent, holds more than 50 IDs or an ID that is not a positive integer; another parameter or a repeated parameter. 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.