## Get favorite messages

`GET /v1/chats/:dialogId/favorites`

Returns the current user’s favorite rows in one chat, page by page, together with the messages and their authors.

## Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `dialogId` (path) | string | yes | `chat` followed by the actual chat ID returned when you [load the chat](/docs/chats/messages/load), including a one-to-one chat. The endpoint rejects a numeric user ID and `me`. |
| `limit` (query) | integer | no | Rows per page: 1–50, default 50. For out-of-range values, `meta.requestedLimit` shows the requested limit and `meta.appliedLimit` shows the limit used. |
| `lastId` (query) | integer | no | Exclusive cursor: `id` of the last row of the previous page |
| `search` (query) | string | no | Search in message text |

Requires the `im` scope. The credentials identify the current user. The API rejects parameters that specify the owner and any unknown parameters.

## Examples

### curl — personal key

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/chats/chat1945/favorites" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/chats/chat1945/favorites" \
  -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/chat1945/favorites', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})
const { data } = await res.json()
console.log(data)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/chat1945/favorites', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const { data } = await res.json()
console.log(data)
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `success` | boolean | `true` |
| `data.list` | array | Favorite link rows |
| `data.list[].id` | number | Favorite link id and pagination cursor |
| `data.list[].messageId` | number | Message id |
| `data.list[].chatId` | number | Real chat id |
| `data.list[].authorId` | number | Favorite owner id |
| `data.list[].dateCreate` | string | Date added to favorites |
| `data.list[].message` | object | The message: `id`, `chatId`, `authorId`, `date`, `text`, `isSystem`, `params` and read flags |
| `data.messages, data.additionalMessages` | array | Related messages. Not every response includes them |
| `data.users, data.files` | array | Related users and files |
| `data.usersShort, data.reactions, data.stickers` | array | Short user details, reactions and stickers of the messages in `data.list`. Not every response includes them: an empty page omits them |
| `data.tariffRestrictions.isHistoryLimitExceeded` | boolean | `true` when the plan hides part of the older chat history and its messages are left out of the results |
| `meta.requestedLimit` | number | The `limit` that was sent. Returned together with `appliedLimit`, only when the value was outside the range from 1 to 50 |
| `meta.appliedLimit` | number | The applied `limit` value — only when it was clamped to a bound |

## Response example

Only the main message and user fields are shown.

```json
{
  "success": 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": "Release notes are ready",
          "isSystem": false,
          "params": {"favorite": ["7"]},
          "unread": false,
          "viewed": true
        }
      },
      {
        "id": 14,
        "messageId": 845,
        "chatId": 1945,
        "authorId": 7,
        "dateCreate": "2026-11-17T10:04:00+00:00",
        "message": {
          "id": 845,
          "chatId": 1945,
          "authorId": 12,
          "date": "2026-11-16T09:28:00+00:00",
          "text": "Project update",
          "isSystem": false,
          "params": {"favorite": ["7"]},
          "unread": false,
          "viewed": true
        }
      }
    ],
    "users": [{"id": 12, "active": true, "name": "Anna Smith", "type": "user"}],
    "usersShort": [],
    "files": [],
    "reactions": [],
    "stickers": [],
    "tariffRestrictions": {"isHistoryLimitExceeded": false}
  }
}
```

## Error response example

400 — unexpected parameter:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Query parameter `ownerId` is not accepted by GET /v1/chats/:dialogId/favorites. Accepted: lastId, limit, search."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|------|-------------|
| 400 | `INVALID_PARAMS` | Malformed ID, or an unexpected or repeated parameter or body field |
| 422 | `BITRIX_ERROR` | `error.b24Code` is `ACCESS_ERROR` — the employee has no access to the chat, or there is no such chat |
| 401 | `MISSING_API_KEY` | No API key was provided |
| 401 | `TOKEN_MISSING` | No Bitrix24 credentials are configured |
| 403 | `SCOPE_DENIED` | The key does not have im scope |
| 403 | `BITRIX_ACCESS_DENIED` | The current user has no access |
| 404 | `ENTITY_NOT_FOUND` | The record was not found |
| 422 | `BITRIX_ERROR` | Bitrix24 refused the operation with another code, which is in `error.b24Code` |

[Common API errors](/docs/errors).

## Known specifics

Rows are ordered by favorite link id descending. Stop when a page contains fewer rows than the effective page size. Use 50 by default, the requested size for an in-range `limit`, or `meta.appliedLimit` when the API adjusts the limit. Do not load the list every time a message menu opens.

## See also

- [Chat configuration](/docs/chats/discovery/configuration)
- [Messages](/docs/chats/messages)
