[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmessages\u002Fviewers":3,"docs-tabs-chats\u002Fmessages\u002Fviewers":6},{"content":4,"lastmod":5},"## Who viewed a message\n\n`GET \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Fviewers`\n\nReturns the views of a message — who saw it and when. The chat is determined from the message, so no `dialogId` is needed.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|----------|-----|:-----:|-----------|---------|\n| `messageId` (path) | number | yes | — | Message ID, a positive integer — from the [chat feed](\u002Fdocs\u002Fchats\u002Fmessages\u002Flist) (`GET \u002Fv1\u002Fchats\u002F:dialogId\u002Fmessages`) or from the [send](\u002Fdocs\u002Fchats\u002Fmessages\u002Fsend) response |\n| `lastId` (query) | number | no | — | Cursor: the `id` of the last view on the previous page. The bound is exclusive |\n| `order` (query) | string | no | `desc` | `desc` — from newest views to oldest, `asc` — from oldest to newest |\n| `limit` (query) | number | no | 50 | Views per page. From 1 to 200: an out-of-range value is clamped; the passed and applied values are in `meta.requestedLimit` and `meta.appliedLimit` |\n| `includeViewedCount` (query) | string | no | — | `Y` requests the total message view count in the optional `viewedCount` field, independently of page size. `N` does not request it. Omitting the parameter preserves the existing response |\n\nAny other parameter or a repeated parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fviewers?limit=20\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fviewers?limit=20\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\"\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fviewers?limit=20', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconsole.log('Viewed by:', data.views.map((v) => v.userId))\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Fviewers?limit=20', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Viewed by:', data.views.map((v) => v.userId))\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.views` | array | Views on the current page |\n| `data.views[].id` | number | View ID — the `lastId` cursor for the next page |\n| `data.views[].messageId` | number | Message ID |\n| `data.views[].userId` | number | ID of the user who viewed the message |\n| `data.views[].dateView` | string | View time (ISO 8601) |\n| `data.users` | array | Profiles of the users in `views` |\n| `data.hasNextPage` | boolean | `false` — no more views in the chosen direction |\n| `data.viewedCount` | number | Total message view count. Optional when `includeViewedCount=Y`, if Bitrix24 supplies the count |\n| `meta.requestedLimit` | number | The passed `limit` value, present when it falls outside the range from 1 to 200 |\n| `meta.appliedLimit` | number | The applied `limit` value — only when it was clamped to a bound |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"views\": [\n      {\n        \"id\": 9001,\n        \"messageId\": 1002,\n        \"userId\": 5,\n        \"dateView\": \"2026-09-20T10:05:00+00:00\"\n      }\n    ],\n    \"users\": [\n      {\n        \"id\": 5,\n        \"active\": true,\n        \"name\": \"John Smith\",\n        \"firstName\": \"John\",\n        \"lastName\": \"Smith\",\n        \"type\": \"user\"\n      }\n    ],\n    \"hasNextPage\": false\n  }\n}\n```\n\n## Error response example\n\n422 — the message does not exist in the Bitrix24 account:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"MESSAGE_NOT_FOUND\",\n    \"b24Code\": \"MESSAGE_NOT_FOUND\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `messageId` is not a positive integer, or the request has a parameter outside the allowed set (`lastId`, `order`, `limit`, `includeViewedCount`), a repeated parameter or an invalid value. `includeViewedCount` accepts only `Y` and `N`. Checked before any call to Bitrix24 |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned the `NOT_FOUND` code. The Bitrix24 code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code`. A missing message lands here too: `MESSAGE_NOT_FOUND` |\n| 403 | `BITRIX_ACCESS_DENIED` | The user has no access to the message's chat — Bitrix24 refused with the `ACCESS_DENIED` code |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | A `READONLY` key is refused before the Bitrix24 call because this operation may add the caller to the chat |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**The call may make you a member.** Like [message context](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcontext), it may conditionally add the caller to the chat. For this reason, `READONLY` keys receive `403 WRITE_BLOCKED_READONLY_KEY` before Bitrix24 is called. The call itself does not mark the message as read. The user's Bitrix24 permissions and the `im` scope requirement still apply.\n## See also\n\n- [Messages around a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcontext)\n- [Mark as read](\u002Fdocs\u002Fchats\u002Fmessages\u002Fread)\n","2026-10-15",{},1794739551062]