[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fmessages\u002Fcomments-context":3,"docs-tabs-chats\u002Fmessages\u002Fcomments-context":6},{"content":4,"lastmod":5},"## Messages around a channel post by comment chat\n\n`GET \u002Fv1\u002Fchats\u002Fcomments\u002F:chat\u002Fcontext`\n\nReturns the channel post linked to the comment chat and nearby messages from the channel. Use this endpoint to navigate to a channel post when you know the discussion ID. The key requires the `im` scope. Bitrix24 checks access to the post and its channel.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|-----------|------|:--------:|---------|-------------|\n| `chat` (path) | number | yes | — | The positive integer ID of the comment chat. In [comment information](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcomments), use the numeric part of `data.commentInfo[].dialogId` |\n| `range` (query) | integer | no | 50 | The number of messages on each side of the post. Supply an integer of up to 15 digits. The endpoint clamps the value to 0 through 200. Use `range=0` for the post alone |\n\nSend `range` at most once. The request accepts the path and this query parameter.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fcomments\u002F725\u002Fcontext?range=0\" \\\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\u002Fcomments\u002F725\u002Fcontext?range=0\" \\\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 response = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fcomments\u002F725\u002Fcontext?range=0', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\nconst { data } = await response.json()\nconsole.log(data?.messages[0]?.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst response = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fcomments\u002F725\u002Fcontext?range=0', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\nconst { data } = await response.json()\nconsole.log(data?.messages[0]?.id)\n```\n\n## Response fields\n\nThe `data` fields match [messages around a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcontext). The `data.messages[].chatId` field contains the channel ID. When the requested `range` is outside the allowed bounds, `meta.requestedRange` contains the original value and `meta.appliedRange` contains the applied value.\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"messages\": [\n      {\n        \"id\": 1002,\n        \"chatId\": 42,\n        \"authorId\": 7,\n        \"date\": \"2026-09-20T10:01:00+00:00\",\n        \"text\": \"Meeting on Friday\",\n        \"params\": {}\n      }\n    ],\n    \"users\": [],\n    \"files\": [],\n    \"reactions\": [],\n    \"hasPrevPage\": true,\n    \"hasNextPage\": false\n  }\n}\n```\n\n## Error response example\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` | Invalid chat ID, unknown, duplicate or malformed query parameter, or a request body |\n| 401 | `TOKEN_MISSING` | The key needs a Bitrix24 connection |\n| 403 | `SCOPE_DENIED` | The key requires the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | Only an ordinary employee personal key can make this request in `READONLY` mode |\n| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access to the post or channel |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned a generic `NOT_FOUND` or `ERROR_NOT_FOUND` code, or a not-found message |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused the request. The `error.b24Code` field carries the original code, for example `MESSAGE_NOT_FOUND` if the discussion has no linked post |\n\n## Known specifics\n\nThe [message context](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcontext) access rules apply. Bitrix24 updates the user's online presence and may add them to the channel when the channel allows auto-join. This request preserves the read state.\n\n## See also\n\n- [Comment information](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcomments)\n- [Messages around a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcontext)\n","2026-11-24",{},1795766108012]