[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmessages\u002Fread-messages":3,"docs-tabs-chats\u002Fmessages\u002Fread-messages":6},{"content":4,"lastmod":5},"## Mark messages as read\n\n`POST \u002Fv1\u002Fchats\u002Fmessages\u002Fread`\n\nMarks the listed messages as read. All the messages must belong to one chat; the chat is determined from them, so no `dialogId` is needed.\n\n## Request body fields\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `ids` | number[] | yes | From 1 to 100 IDs of messages in one chat — numbers or digit strings. The IDs come from the [chat feed](\u002Fdocs\u002Fchats\u002Fmessages\u002Flist) (`GET \u002Fv1\u002Fchats\u002F:dialogId\u002Fmessages`) |\n\nOther body fields and query parameters are rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002Fread \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"ids\": [1001, 1002] }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002Fread \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"ids\": [1001, 1002] }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002Fread', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ ids: [1001, 1002] }),\n})\n\nconst { data } = await res.json()\nconsole.log('Unread remaining:', data.counter)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002Fread', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ ids: [1001, 1002] }),\n})\n\nconst { data } = await res.json()\nconsole.log('Unread remaining:', data.counter)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.chatId` | number | ID of the chat the messages belong to |\n| `data.lastId` | number | ID of the chat's last message |\n| `data.counter` | number | Number of unread messages remaining after the operation |\n| `data.viewedMessages` | array | IDs of the messages marked by this call |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"chatId\": 42,\n    \"lastId\": 1002,\n    \"counter\": 0,\n    \"viewedMessages\": [1001, 1002]\n  }\n}\n```\n\n## Error response example\n\n422 — the messages belong to different chats:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"MESSAGES_IN_DIFFERENT_CHAT_ERROR\",\n    \"b24Code\": \"MESSAGES_IN_DIFFERENT_CHAT_ERROR\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `ids` is missing or is not an array of 1 to 100 positive integers (the error names the index of the invalid element), or the request has an extra body field or a query parameter. Checked before any call to Bitrix24 |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused; the code is in `error.b24Code`: `MESSAGES_IN_DIFFERENT_CHAT_ERROR` — the messages belong to different chats, `MESSAGE_NOT_FOUND` — a message does not exist |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned the `NOT_FOUND` code; the Bitrix24 code is in `error.b24Code` |\n| 403 | `BITRIX_ACCESS_DENIED` | The user has no access to the chat of the messages — Bitrix24 refused with the `ACCESS_DENIED` code |\n| 403 | `SCOPE_DENIED` | The key is missing the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Mark as read](\u002Fdocs\u002Fchats\u002Fmessages\u002Fread)\n- [Messages](\u002Fdocs\u002Fchats\u002Fmessages)\n- [Read messages](\u002Fdocs\u002Fchats\u002Fmessages\u002Flist)\n- [Chat discovery](\u002Fdocs\u002Fchats\u002Fdiscovery)\n","2026-10-07",{},1795377119711]