[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ftasks\u002Fchat":3,"docs-tabs-entities\u002Ftasks\u002Fchat":6},{"content":4,"lastmod":5},"# Task chat\n\n`GET \u002Fv1\u002Ftasks\u002F:taskId\u002Fchat\u002Fmessages`\n\nReads the task's chat feed — newest messages first. Every task in Bitrix24 has a group chat, and the endpoint itself resolves the chat from the task ID, so you do not need to know the chat ID. A typical scenario is exporting the final messages of a closed task.\n\nThe generic `filter` parameter is not applied by this endpoint. By default, the API preserves the previous HTTP 200 response and data, adds `Warning: 299 - \"filter is not supported on this endpoint and was ignored\"`, and records unsupported-filter use in the server log.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `taskId` (path) | number | yes | Task ID. List: [`GET \u002Fv1\u002Ftasks`](\u002Fdocs\u002Fentities\u002Ftasks\u002Flist) |\n| `limit` (query) | number | no | Messages per page, 1..200, default 50. For a read-only key, at most 50: a larger value is reduced to 50 |\n| `lastId` (query) | number | no | Cursor: return messages older than this `id`. For the next page, pass the smallest `id` from the current one |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl 'https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\u002F289\u002Fchat\u002Fmessages?limit=50' \\\n  -H 'X-Api-Key: YOUR_API_KEY'\n```\n\n### curl — OAuth application\n\n```bash\ncurl 'https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\u002F289\u002Fchat\u002Fmessages?limit=50' \\\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\u002Ftasks\u002F289\u002Fchat\u002Fmessages?limit=50', {\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n  },\n})\nconst result = await response.json()\nconsole.log(result.data.messages)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst response = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\u002F289\u002Fchat\u002Fmessages?limit=50', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\nconst result = await response.json()\nconsole.log(result.data.messages)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | `true` on success |\n| `data.messages` | array | Messages on the page, newest to oldest |\n| `data.messages[].id` | number | Message ID — use the smallest one on the page as `lastId` for the next page |\n| `data.messages[].authorId` | number | Author (`0` for system messages) |\n| `data.messages[].text` | string | Message text. May contain Bitrix24 BB-code |\n| `data.messages[].createdAt` | string | Creation date, ISO 8601 |\n| `data.messages[].isSystem` | boolean | System message (\"task created\", \"deadline changed\", …) — filter on this flag when you only need human replies |\n| `data.hasNextPage` | boolean | Whether there is a next page. When `true`, pass the smallest `id` of the current page as `lastId` |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"messages\": [\n      {\n        \"id\": 43247,\n        \"authorId\": 0,\n        \"text\": \"[USER=1]John Smith[\u002FUSER] started the task.\",\n        \"createdAt\": \"2026-10-19T18:20:03+00:00\",\n        \"isSystem\": true\n      },\n      {\n        \"id\": 43241,\n        \"authorId\": 0,\n        \"text\": \"[USER=1]John Smith[\u002FUSER] created [URL=\u002Fcompany\u002Fpersonal\u002Fuser\u002F1\u002Ftasks\u002Ftask\u002Fview\u002F289\u002F]this task[\u002FURL].\",\n        \"createdAt\": \"2026-10-19T18:20:00+00:00\",\n        \"isSystem\": true\n      }\n    ],\n    \"hasNextPage\": false\n  }\n}\n```\n\n## Error response example\n\n404 — the task has no chat, or the task does not exist:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"TASK_CHAT_NOT_FOUND\",\n    \"message\": \"Task 289 has no chat yet (B24 allocates the chat lazily) or the task does not exist.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 200 | `Warning: 299` | The filter is ignored by default; previous data is preserved and the warning is sent in the `Warning` header. |\n| 400 (strict mode only) | `UNSUPPORTED_FILTER` | The server mode is disabled by default; until it is enabled, the endpoint preserves HTTP 200 and the previous data. |\n| 400 | `INVALID_PARAMS` | `taskId` is not a positive integer: `taskId must be a positive integer` |\n| 400 | `INVALID_PARAMS` | `limit` is not a positive integer: `limit must be a positive integer (1..200)`. A `limit` above 200 is not an error — it is capped at 200, and at 50 for a read-only key |\n| 400 | `INVALID_PARAMS` | `lastId` is not a positive integer: `lastId must be a positive integer (message id cursor)` |\n| 401 | `MISSING_API_KEY` | `X-Api-Key` is missing |\n| 401 | `INVALID_API_KEY` | The key is not found |\n| 401 | `TOKEN_MISSING` | The key has no valid Bitrix24 token |\n| 403 | `SCOPE_DENIED` | The key lacks the `task` scope |\n| 404 | `TASK_CHAT_NOT_FOUND` | The task has no chat (or the task does not exist) |\n| 422 | `BITRIX_ERROR` | Bitrix24 error: `insufficient_scope` (no `im`), `ACCESS_ERROR` (not a chat member) |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **The `im` scope is required on the Bitrix24 side.** The endpoint reads the chat through Bitrix24 `im.*` methods — the key's webhook or OAuth grant must include the `im` scope in addition to `task`; otherwise Bitrix24 returns `insufficient_scope`.\n- **Access follows chat membership.** Bitrix24 returns messages only when the user the key acts on behalf of is a member of the task chat (creator, assignee, observer) or a Bitrix24 account administrator. A read-only key reads the feed in a different way that does not make the user a member of the chat, so its page holds at most 50 messages whatever the `limit`. For such a key, `hasNextPage` means the page is full: if the last page holds exactly as many messages as fit on it, you get `true`, and the next request returns an empty page with `false`. Page through with the `lastId` cursor until `hasNextPage: false`. Up to 200 messages per page are returned to a key with write access — see [access rights](\u002Fdocs\u002Faccess-rights).\n- **Messages come newest-first.** The first element is the most recent message. Cursor pagination via `lastId` goes back through history.\n- **404 when there is no chat yet.** Bitrix24 does not create the task chat right away — a task without a single message may have no chat (`TASK_CHAT_NOT_FOUND`).\n- **Older Bitrix24 accounts.** On Bitrix24 accounts without the modern `im.v2` surface, the API transparently switches to the legacy method: the page there is capped at 50 messages, and `hasNextPage` is inferred from whether the page is full.\n- **Comments vs chat.** [`GET \u002Fv1\u002Ftasks\u002F:taskId\u002Fcomments`](..\u002Ftask-comments.md) returns only user comments. This endpoint returns the raw chat feed in full, including system messages.\n\n## See also\n\n- [Tasks](\u002Fdocs\u002Fentities\u002Ftasks)\n- [Task comments](\u002Fdocs\u002Fentities\u002Ftask-comments)\n- [Scrum](\u002Fdocs\u002Fscrum)\n","2026-10-23",{},1794739429802]