[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmessages\u002Funread":3,"docs-tabs-chats\u002Fmessages\u002Funread":6},{"content":4,"lastmod":5},"## Unread starting from a message\n\n`POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Funread`\n\nMakes the given message the first unread one in a dialog, without marking the whole chat unread the way the chat-level mark does.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `messageId` (path) | number | yes | Message ID, a positive integer — the `id` field of a message from the [message history](\u002Fdocs\u002Fchats\u002Fmessages\u002Flist) or [chat loading](\u002Fdocs\u002Fchats\u002Fmessages\u002Fload) |\n\nThere are no query parameters: any parameter is refused with `400 INVALID_PARAMS`.\n\n## Request body fields\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|----------|\n| `dialogId` | string \\| number | yes | The dialog that holds the message: `chatXXX` for a group chat, a user ID for a personal one, `me` for the current user's personal dialog. `chatXXX` is the `id` field of a [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) row, a user ID comes from the [user list](\u002Fdocs\u002Fentities\u002Fusers\u002Flist) |\n\nOther body fields are refused 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\u002F1001\u002Funread\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"dialogId\": \"chat42\" }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1001\u002Funread\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"dialogId\": \"chat42\" }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1001\u002Funread', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ dialogId: 'chat42' }),\n})\n\nconst { success } = await res.json()\nconsole.log('Mark set:', success)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1001\u002Funread', {\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({ dialogId: 'chat42' }),\n})\n\nconst { success } = await res.json()\nconsole.log('Mark set:', success)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | boolean | `true` — the mark is set |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": true\n}\n```\n\n## Error response example\n\n404 — the message is not in the given dialog:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Message is not in the specified dialog. Nothing was changed.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `messageId` is not a positive integer or equals `9007199254740991`, `dialogId` is missing or does not look like a user ID, `chatXXX` or `me`, or another body field or a query parameter was sent. Checked before any Bitrix24 call |\n| 401 | `MISSING_API_KEY` | `X-Api-Key` was not sent |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key lacks the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. Checked before any Bitrix24 call |\n| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access |\n| 404 | `ENTITY_NOT_FOUND` | The message is not in the given dialog or belongs to another dialog. The mark is not set |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused the operation. The refusal text is in `error.message` |\n| 429 | `RATE_LIMITED` | The Bitrix24 request limit was exceeded. Retry after the pause in the `Retry-After` header |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | The current user could not be determined for `me` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable, returned a server error or did not confirm the mark |\n| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time, and it is unknown whether the mark was set. Retry after the pause in the `Retry-After` header |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\nMessages and chats have three different marks — pick the one that fits the task:\n\n| Route | Action |\n|---|---|\n| [`POST \u002Fv1\u002Fchats\u002F:dialogId\u002Funread`](\u002Fdocs\u002Fchats\u002Fmanagement\u002Funread-create) | Mark the whole chat unread |\n| [`POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Fmark`](\u002Fdocs\u002Fchats\u002Fmessages\u002Fmark) | A \"read later\" pointer. It does not move an existing mark |\n| `POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Funread` | Make the message the first unread one in the given dialog |\n\n## See also\n\n- [Set the \"unread\" mark](\u002Fdocs\u002Fchats\u002Fmanagement\u002Funread-create)\n- [Read later](\u002Fdocs\u002Fchats\u002Fmessages\u002Fmark)\n- [Messages](\u002Fdocs\u002Fchats\u002Fmessages)\n- [Errors](\u002Fdocs\u002Ferrors)\n","2026-10-07",{},1795415439839]