## Load the chat's right panel

`POST /v1/chats/:dialogId/sidebar`

Loads the chat's right panel — members, files, your individual chat link, links from messages and favorites — in one Bitrix24 batch call instead of seven separate requests.

List only the blocks you need in the body: the response carries exactly those. Each block returns the same data as its own method: [list of members](/docs/chats/members/list) in the v2 mode, [chat file list](/docs/chats/files/list), [individual chat link](/docs/chats/sharing/individual-link), [a chat's links](/docs/chats/messages/links) and [their number](/docs/chats/messages/links-count), [favorite messages](/docs/chats/messages/favorites) and [their number](/docs/chats/messages/favorites-count). The request takes one place in the Bitrix24 account queue however many blocks it carries. The blocks your platform version accepts are in the `data.sidebarBlocks` field of the [chat configuration](/docs/chats/discovery/configuration).

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `dialogId` (path) | string | yes | Dialog ID: `chatXXX` for a group chat, a numeric user ID for a private dialog, `me` for your own private dialog. List — [`GET /v1/chats/recent`](/docs/chats/discovery/recent) |

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

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `blocks` | object | yes | Panel blocks, one to seven of them: `members`, `files`, `inviteLink`, `links`, `linksCounter`, `favorites`, `favoritesCount`. The value of each block is an object. Send only the blocks listed in `data.sidebarBlocks` of the [chat configuration](/docs/chats/discovery/configuration) |
| `blocks.members` | object | no | Chat members — the first page of the [list of members](/docs/chats/members/list) in the v2 mode |
| `blocks.members.limit` | number | no | How many members to return, 1 to 200. Defaults to 50. A value outside the range is set to the nearest bound, and the block then carries `meta.requestedLimit` and `meta.appliedLimit` |
| `blocks.files` | object | no | Chat files — the first page of the [chat file list](/docs/chats/files/list) |
| `blocks.files.chatId` | number | yes | Required in the `files` block. Numeric chat ID — the `data.chat.id` field of [loading the chat](/docs/chats/messages/load). For a group chat `chatXXX` it is the number `XXX`; for a private dialog it cannot be taken from `dialogId` |
| `blocks.files.group` | string[] | yes | Required in the `files` block. Panel tabs: `MEDIA` — Media, `FILE` — Files, `AUDIO` — Voice, each once |
| `blocks.files.limit` | number | no | How many `list` entries to return, 1 to 200. A value outside the range is set to the nearest bound, and the block then carries `meta.requestedLimit` and `meta.appliedLimit` |
| `blocks.inviteLink` | object | no | Your individual chat link. It takes no fields — pass `{}`. The link is only read and never created |
| `blocks.links` | object | no | Links from the chat's messages — the first page of [a chat's links](/docs/chats/messages/links) |
| `blocks.links.chatId` | number | yes | Required in the `links` block. Numeric chat ID — the `data.chat.id` field of [loading the chat](/docs/chats/messages/load) |
| `blocks.links.limit` | number | no | How many links to return, 1 to 200. Defaults to 50. A value outside the range is set to the nearest bound, and the block then carries `meta.requestedLimit` and `meta.appliedLimit` |
| `blocks.linksCounter` | object | no | The [number of links](/docs/chats/messages/links-count) in the chat |
| `blocks.linksCounter.chatId` | number | yes | Required in the `linksCounter` block. Numeric chat ID — the `data.chat.id` field of [loading the chat](/docs/chats/messages/load) |
| `blocks.favorites` | object | no | Your favorite messages of the chat — the first page of [favorite messages](/docs/chats/messages/favorites) |
| `blocks.favorites.chatId` | number | yes | Required in the `favorites` block. Numeric chat ID — the `data.chat.id` field of [loading the chat](/docs/chats/messages/load) |
| `blocks.favorites.limit` | number | no | How many entries to return, 1 to 50. Defaults to 50. A value outside the range is set to the nearest bound, and the block then carries `meta.requestedLimit` and `meta.appliedLimit` |
| `blocks.favoritesCount` | object | no | The [number of your favorite messages](/docs/chats/messages/favorites-count) in the chat |
| `blocks.favoritesCount.chatId` | number | yes | Required in the `favoritesCount` block. Numeric chat ID — the `data.chat.id` field of [loading the chat](/docs/chats/messages/load) |

Other body fields and block fields are refused with `400 INVALID_PARAMS`. The check runs before any Bitrix24 call.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat1945/sidebar" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"blocks": {"members": {"limit": 50}, "files": {"chatId": 1945, "group": ["MEDIA", "FILE", "AUDIO"], "limit": 50}, "inviteLink": {}, "links": {"chatId": 1945, "limit": 50}, "linksCounter": {"chatId": 1945}, "favorites": {"chatId": 1945, "limit": 50}, "favoritesCount": {"chatId": 1945}}}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/chats/chat1945/sidebar" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"blocks": {"members": {"limit": 50}, "files": {"chatId": 1945, "group": ["MEDIA", "FILE", "AUDIO"], "limit": 50}, "inviteLink": {}, "links": {"chatId": 1945, "limit": 50}, "linksCounter": {"chatId": 1945}, "favorites": {"chatId": 1945, "limit": 50}, "favoritesCount": {"chatId": 1945}}}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat1945/sidebar', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    blocks: {
      members: { limit: 50 },
      files: { chatId: 1945, group: ['MEDIA', 'FILE', 'AUDIO'], limit: 50 },
      inviteLink: {},
      links: { chatId: 1945, limit: 50 },
      linksCounter: { chatId: 1945 },
      favorites: { chatId: 1945, limit: 50 },
      favoritesCount: { chatId: 1945 },
    },
  }),
})

const { data } = await res.json()
for (const [name, block] of Object.entries(data)) {
  if (!block.ok) console.log(`Block ${name} not loaded:`, block.error.code)
}
console.log('Chat link:', data.inviteLink.ok ? data.inviteLink.data?.sharingLink.url ?? 'none' : '—')
console.log('Links in the chat:', data.linksCounter.ok ? data.linksCounter.data.counter : '—')
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat1945/sidebar', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    blocks: {
      members: { limit: 50 },
      files: { chatId: 1945, group: ['MEDIA', 'FILE', 'AUDIO'], limit: 50 },
      inviteLink: {},
      links: { chatId: 1945, limit: 50 },
      linksCounter: { chatId: 1945 },
      favorites: { chatId: 1945, limit: 50 },
      favoritesCount: { chatId: 1945 },
    },
  }),
})

const { data } = await res.json()
for (const [name, block] of Object.entries(data)) {
  if (!block.ok) console.log(`Block ${name} not loaded:`, block.error.code)
}
console.log('Chat link:', data.inviteLink.ok ? data.inviteLink.data?.sharingLink.url ?? 'none' : '—')
console.log('Links in the chat:', data.linksCounter.ok ? data.linksCounter.data.counter : '—')
```

## Response fields

`*` in the table is the block name: `members`, `files`, `inviteLink`, `links`, `linksCounter`, `favorites` or `favoritesCount`.

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` even when a block failed to load |
| `data` | object | Block responses in the order `members`, `files`, `inviteLink`, `links`, `linksCounter`, `favorites`, `favoritesCount`. Only the requested blocks are present |
| `data.*.ok` | boolean | `true` — the block loaded, `false` — this block was refused. A refused block does not affect the others |
| `data.*.data` | object \| null | With `ok: true` — the same as the `data` field of the block's own method: [members](/docs/chats/members/list), [files](/docs/chats/files/list), [chat link](/docs/chats/sharing/individual-link), [chat links](/docs/chats/messages/links), [number of links](/docs/chats/messages/links-count), [favorites](/docs/chats/messages/favorites), [number of favorites](/docs/chats/messages/favorites-count). For `inviteLink` with no link — `null` |
| `data.*.meta` | object | Only when the block's `limit` was set to a bound: `requestedLimit` — the value sent, `appliedLimit` — the value applied |
| `data.*.error.code` | string | With `ok: false` — the refusal code: a Bitrix24 code such as `ACCESS_DENIED`, or a platform code — `BLOCK_NOT_RETURNED`, a read-only key refusal `WRITE_BLOCKED_READONLY_KEY` or `COWORK_READONLY`, a limit code `RATE_LIMITED` or `OPERATION_TIME_LIMIT`, an authorization code `TOKEN_EXPIRED` or `PORTAL_CREDENTIALS_REJECTED` — as on [Errors](/docs/errors) |
| `data.*.error.message` | string | Refusal text |
| `data.*.error.hint` | string | Only with the platform codes `RATE_LIMITED`, `OPERATION_TIME_LIMIT`, `TOKEN_EXPIRED`, `PORTAL_CREDENTIALS_REJECTED`, `COWORK_READONLY`: what to do next. `COWORK_READONLY` in the `inviteLink` block has no such field: that refusal is made before the call to Bitrix24 and carries `details.method` |
| `data.*.error.retryAfter` | number | Only with `RATE_LIMITED` and `OPERATION_TIME_LIMIT`: seconds to wait before retrying. A block has no `Retry-After` header of its own |
| `data.*.error.scope` | string | Only with the limit codes and `PORTAL_CREDENTIALS_REJECTED`: what the refusal applies to — `portal` or `apiKey` |
| `data.*.error.details` | object | With `WRITE_BLOCKED_READONLY_KEY`: `method`, `keyName`, `currentMode`, `switchUrl`. With `COWORK_READONLY` in the `inviteLink` block — only `method` |

## Response example

All seven blocks loaded. The file, employee, link and message cards are shortened; the full set of fields is on the pages of the blocks' own methods:

```json
{
  "success": true,
  "data": {
    "members": {
      "ok": true,
      "data": {
        "relations": [
          { "id": 71, "chatId": 1945, "userId": 1, "role": "owner" },
          { "id": 77, "chatId": 1945, "userId": 4, "role": "member" }
        ],
        "users": [
          { "id": 1, "name": "John Brown", "firstName": "John" },
          { "id": 4, "name": "Anna Grey", "firstName": "Anna" }
        ],
        "nextCursor": { "role": "member", "relationId": 77 }
      }
    },
    "files": {
      "ok": true,
      "data": {
        "list": [
          { "id": 3101, "messageId": 1003, "chatId": 1945, "authorId": 5, "dateCreate": "2026-11-09T10:00:00+00:00", "fileId": 7701, "subType": "AUDIO", "group": "AUDIO" }
        ],
        "files": [
          { "id": 7701, "chatId": 1945, "type": "audio", "name": "voice.ogg", "size": 2048, "isVoiceNote": true, "duration": 12 }
        ],
        "users": [
          { "id": 5, "active": true, "name": "John Brown", "type": "user", "bot": false }
        ],
        "tariffRestrictions": { "isHistoryLimitExceeded": false }
      }
    },
    "inviteLink": {
      "ok": true,
      "data": {
        "sharingLink": {
          "id": 18,
          "entityId": "1945",
          "entityType": "chat",
          "code": "Xk9pQ2mZ7rT4vB1c",
          "type": "individual",
          "dateCreate": "2026-09-25T10:00:00+00:00",
          "dateExpire": null,
          "requireApproval": false,
          "url": "https://example.bitrix24.com/online/?IM_CODE=Xk9pQ2mZ7rT4vB1c"
        }
      }
    },
    "links": {
      "ok": true,
      "data": {
        "users": [
          { "id": 6, "active": true, "name": "Anna Smith", "type": "user", "bot": false }
        ],
        "tariffRestrictions": { "isHistoryLimitExceeded": false },
        "list": [
          {
            "id": 12,
            "messageId": 34213,
            "chatId": 1945,
            "authorId": 6,
            "dateCreate": "2026-03-03T11:44:09+00:00",
            "url": { "source": "https://example.com/page", "richData": { "id": null, "type": null, "name": null, "description": null, "previewUrl": null, "link": null } }
          }
        ]
      }
    },
    "linksCounter": { "ok": true, "data": { "counter": 1 } },
    "favorites": {
      "ok": true,
      "data": {
        "list": [
          {
            "id": 15,
            "messageId": 846,
            "chatId": 1945,
            "authorId": 7,
            "dateCreate": "2026-11-17T10:05:00+00:00",
            "message": { "id": 846, "chatId": 1945, "authorId": 12, "date": "2026-11-16T09:30:00+00:00", "text": "The report is ready" }
          }
        ],
        "users": [{ "id": 12, "active": true, "name": "Anna Smith", "type": "user" }],
        "files": []
      }
    },
    "favoritesCount": { "ok": true, "data": { "counter": 1 } }
  }
}
```

A read-only key requested files and the link, and Bitrix24 denied access to the files. Both blocks are refused, the response status is 200:

```json
{
  "success": true,
  "data": {
    "files": {
      "ok": false,
      "error": { "code": "ACCESS_DENIED", "message": "You do not have access to this chat" }
    },
    "inviteLink": {
      "ok": false,
      "error": {
        "code": "WRITE_BLOCKED_READONLY_KEY",
        "message": "Key is in read-only mode. Switch the key to read and write in /keys to allow Bitrix24 data changes.",
        "details": {
          "method": "im.v2.Chat.SharingLink.getIndividual",
          "keyName": "Reports dashboard",
          "currentMode": "READONLY",
          "switchUrl": "/keys"
        }
      }
    }
  }
}
```

## Error response example

400 — `blocks` names a block the panel does not have. Checked before any Bitrix24 call:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "`blocks.avatar` is not a panel block. Accepted: members, files, inviteLink, links, linksCounter, favorites, favoritesCount."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `blocks` is missing or empty, a block other than `members`, `files`, `inviteLink`, `links`, `linksCounter`, `favorites`, `favoritesCount`, a block that is not an object, an extra field in the body or in a block, a `limit` that is not a JSON integer, a `chatId` of the `files`, `links`, `linksCounter`, `favorites`, `favoritesCount` blocks that is missing or not a positive integer, a `files.group` that is not a list of `MEDIA`, `FILE`, `AUDIO` without repeats, or a query parameter. Checked before any Bitrix24 call |
| 200 | `WRITE_BLOCKED_READONLY_KEY` | Inside a block, not for the whole response: the key is read-only (a Cowork service chat key in read-only mode is refused with a different code — `COWORK_READONLY`, the row below). The `inviteLink` block is always refused and is not sent to Bitrix24. The `members` block is refused on the same conditions as the [list of members](/docs/chats/members/list) in the v2 mode: an application key with a user session, a management key, a key whose owner is unconfirmed, or a private dialog not found among the same employee's recent dialogs. The `links`, `linksCounter`, `favorites`, `favoritesCount` blocks only read and load for such a key, as do the other blocks |
| 200 | `COWORK_READONLY` | Inside the `members` block: a Cowork service chat key in read-only mode. A retry does not help: the chat stays in this mode. The `inviteLink` block of such a key gets the same `COWORK_READONLY` code — that refusal is made before the call to Bitrix24 and carries `details.method`, but no `hint`. The `files`, `links`, `linksCounter`, `favorites`, `favoritesCount` blocks still load |
| 200 | `BLOCK_NOT_RETURNED` | Inside a block: the Bitrix24 response for this block is empty or could not be read |
| 200 | `ERROR_METHOD_NOT_FOUND` | Inside the `favorites` and `favoritesCount` blocks: the account's Bitrix24 version does not support favorite messages. The other blocks still load |
| 200 | `RATE_LIMITED` | Inside a block: Bitrix24 limited the request rate on this batch command. The wait is in the block's `retryAfter` |
| 200 | `OPERATION_TIME_LIMIT` | Inside a block: Bitrix24 paused this block's method for your key — the method used up its operating-time budget. The wait is in the block's `retryAfter` |
| 403 | `SCOPE_DENIED` | The API key lacks the `im` scope |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |
| 422 | `BITRIX_ERROR` | Bitrix24 refused the whole batch call. No block is loaded |
| 429 | `QUEUE_TIMEOUT` | The batch call did not get a place in the Bitrix24 account queue in time. The response carries a `Retry-After` header; no block is loaded |
| 502 | `ME_ALIAS_RESOLUTION_FAILED` | The user for the `me` alias could not be determined |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not answer within the time limit. No block is loaded |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**One call instead of several, but longer than each.** Bitrix24 runs the batch commands one after another, so the request takes about as long as that many separate calls in a row. The time allowed for the answer grows with the number of blocks. If Bitrix24 does not answer the batch in time, no block arrives. Retry the request or load the blocks with their own methods.

**The block list depends on the platform version.** An unknown block refuses the whole request with `400 INVALID_PARAMS`, so do not probe for a block with a test request. Read `data.sidebarBlocks` of the [chat configuration](/docs/chats/discovery/configuration). If the field is absent, the platform accepts only `members`, `files` and `inviteLink`. If the method answers `404`, load the blocks with their own methods.

**First page only.** Load further pages with the blocks' own methods: members with `cursorRole` and `cursorRelationId` from `data.members.data.nextCursor`, files with `lastId` of the last entry of `data.files.data.list`, [links](/docs/chats/messages/links) with `offset` equal to the number of links already received, [favorites](/docs/chats/messages/favorites) with `lastId` equal to the `id` of the last entry of `data.favorites.data.list`. Search in links and favorites is available only through their own methods.

**The link is not created.** The `inviteLink` block only reads the link. With no link the block comes back as `{ "ok": true, "data": null }`. To create one, use the [individual chat link](/docs/chats/sharing/individual-link) method. Chat links exist for group chats and channels — request the block there. A private dialog has no link, and the block comes back as `{ "ok": true, "data": null }`.

**A Bitrix24 refusal in a block carries the Bitrix24 code.** The block's data matches the response of its own method; refusal codes do not. The standalone method responds with `422 BITRIX_ERROR` and puts the Bitrix24 code in `error.b24Code`, while the block puts that code directly in `error.code`, for example `ACCESS_DENIED`. Limits and authorization keep the platform codes — `RATE_LIMITED`, `OPERATION_TIME_LIMIT`, `TOKEN_EXPIRED`, `PORTAL_CREDENTIALS_REJECTED` — with a `hint`, and the limits also with a `retryAfter` wait.

**The members block can make you a member.** As with the list of members in the v2 mode: if the chat allows auto-join — a comment chat, a collab or a task chat, for example — the request adds the current user to the members.

## See also

- [List members](/docs/chats/members/list)
- [Chat file list](/docs/chats/files/list)
- [Get an individual chat link](/docs/chats/sharing/individual-link)
- [List a chat's links](/docs/chats/messages/links)
- [Number of a chat's links](/docs/chats/messages/links-count)
- [Get favorite messages](/docs/chats/messages/favorites)
- [Count favorite messages](/docs/chats/messages/favorites-count)
- [Get chat configuration](/docs/chats/discovery/configuration)
- [Load a chat](/docs/chats/messages/load)
- [Chats and messages](/docs/chats)
