For AI agents: markdown of this page — /docs-content-en/entities/tasks/chat.md documentation index — /llms.txt
Task chat
GET /v1/tasks/:taskId/chat/messages
Reads 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.
The 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.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ParametertaskId (path) |
Typenumber | Requiredyes | DescriptionTask ID. List: GET /v1/tasks |
Parameterlimit (query) |
Typenumber | Requiredno | DescriptionMessages per page, 1..200, default 50. For a read-only key, at most 50: a larger value is reduced to 50 |
ParameterlastId (query) |
Typenumber | Requiredno | DescriptionCursor: return messages older than this id. For the next page, pass the smallest id from the current one |
Examples
curl — personal key
curl 'https://vibecode.bitrix24.com/v1/tasks/289/chat/messages?limit=50' \
-H 'X-Api-Key: YOUR_API_KEY'
curl — OAuth application
curl 'https://vibecode.bitrix24.com/v1/tasks/289/chat/messages?limit=50' \
-H 'X-Api-Key: YOUR_APP_KEY' \
-H 'Authorization: Bearer USER_SESSION_TOKEN'
JavaScript — personal key
const response = await fetch('https://vibecode.bitrix24.com/v1/tasks/289/chat/messages?limit=50', {
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const result = await response.json()
console.log(result.data.messages)
JavaScript — OAuth application
const response = await fetch('https://vibecode.bitrix24.com/v1/tasks/289/chat/messages?limit=50', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const result = await response.json()
console.log(result.data.messages)
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on success |
Fielddata.messages |
Typearray | DescriptionMessages on the page, newest to oldest |
Fielddata.messages[].id |
Typenumber | DescriptionMessage ID — use the smallest one on the page as lastId for the next page |
Fielddata.messages[].authorId |
Typenumber | DescriptionAuthor (0 for system messages) |
Fielddata.messages[].text |
Typestring | DescriptionMessage text. May contain Bitrix24 BB-code |
Fielddata.messages[].createdAt |
Typestring | DescriptionCreation date, ISO 8601 |
Fielddata.messages[].isSystem |
Typeboolean | DescriptionSystem message ("task created", "deadline changed", …) — filter on this flag when you only need human replies |
Fielddata.hasNextPage |
Typeboolean | DescriptionWhether there is a next page. When true, pass the smallest id of the current page as lastId |
Response example
{
"success": true,
"data": {
"messages": [
{
"id": 43247,
"authorId": 0,
"text": "[USER=1]John Smith[/USER] started the task.",
"createdAt": "2026-10-19T18:20:03+00:00",
"isSystem": true
},
{
"id": 43241,
"authorId": 0,
"text": "[USER=1]John Smith[/USER] created [URL=/company/personal/user/1/tasks/task/view/289/]this task[/URL].",
"createdAt": "2026-10-19T18:20:00+00:00",
"isSystem": true
}
],
"hasNextPage": false
}
}
Error response example
404 — the task has no chat, or the task does not exist:
{
"success": false,
"error": {
"code": "TASK_CHAT_NOT_FOUND",
"message": "Task 289 has no chat yet (B24 allocates the chat lazily) or the task does not exist."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP200 | CodeWarning: 299 |
DescriptionThe filter is ignored by default; previous data is preserved and the warning is sent in the Warning header. |
| HTTP400 (strict mode only) | CodeUNSUPPORTED_FILTER |
DescriptionThe server mode is disabled by default; until it is enabled, the endpoint preserves HTTP 200 and the previous data. |
| HTTP400 | CodeINVALID_PARAMS |
DescriptiontaskId is not a positive integer: taskId must be a positive integer |
| HTTP400 | CodeINVALID_PARAMS |
Descriptionlimit 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 |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionlastId is not a positive integer: lastId must be a positive integer (message id cursor) |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionX-Api-Key is missing |
| HTTP401 | CodeINVALID_API_KEY |
DescriptionThe key is not found |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no valid Bitrix24 token |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the task scope |
| HTTP404 | CodeTASK_CHAT_NOT_FOUND |
DescriptionThe task has no chat (or the task does not exist) |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 error: insufficient_scope (no im), ACCESS_ERROR (not a chat member) |
Full list of common API errors — Errors.
Known specifics
- The
imscope is required on the Bitrix24 side. The endpoint reads the chat through Bitrix24im.*methods — the key's webhook or OAuth grant must include theimscope in addition totask; otherwise Bitrix24 returnsinsufficient_scope. - 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,hasNextPagemeans the page is full: if the last page holds exactly as many messages as fit on it, you gettrue, and the next request returns an empty page withfalse. Page through with thelastIdcursor untilhasNextPage: false. Up to 200 messages per page are returned to a key with write access — see access rights. - Messages come newest-first. The first element is the most recent message. Cursor pagination via
lastIdgoes back through history. - 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). - Older Bitrix24 accounts. On Bitrix24 accounts without the modern
im.v2surface, the API transparently switches to the legacy method: the page there is capped at 50 messages, andhasNextPageis inferred from whether the page is full. - Comments vs chat.
GET /v1/tasks/:taskId/commentsreturns only user comments. This endpoint returns the raw chat feed in full, including system messages.