[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fdiscovery\u002Frecent-collabs":3,"docs-tabs-chats\u002Fdiscovery\u002Frecent-collabs":6},{"content":4,"lastmod":5},"## Collab list\n\n`GET \u002Fv1\u002Fchats\u002Frecent\u002Fcollabs`\n\nReturns the current user's collab chats page by page: pinned ones first, then by last activity time. Use it for a separate collab tab in the dialog list.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|----------|-----|:-----:|-----------|---------|\n| `limit` (query) | integer | no | 50 | Rows per page, 50 to 200. A smaller value is raised to 50 and a larger one is clamped to 200, and both adjustments are echoed in `meta` |\n| `lastMessageDate` (query) | string | no | — | Cursor of the next page: the smallest `dateLastActivity` among the unpinned rows of the previous page. Format `YYYY-MM-DDTHH:MM:SS` with an offset or `Z`, without fractional seconds. Not passed on the first page |\n\nOther parameters and repeated parameters are rejected with `400 INVALID_PARAMS`.\n\n**Pagination** — as in [recent dialogs in the v2 mode](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent). The cursor of the next page is the smallest non-empty `dateLastActivity` among the **unpinned** rows; compare instants, not strings. The bound is inclusive, and pinned chats appear at the top of every page, so deduplicate by `chatId`. The list ends only at `hasNextPage: false`. If `hasNextPage` is `true` but there is no cursor or it equals the previous one, repeat the request with a larger `limit`, up to 200. Do not discard response rows: the cursor is computed over the whole response.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Frecent\u002Fcollabs?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\u002Fchats\u002Frecent\u002Fcollabs?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 rows = new Map()\nlet limit = 50\nlet cursor\nfor (;;) {\n  const url = new URL('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Frecent\u002Fcollabs')\n  url.searchParams.set('limit', String(limit))\n  if (cursor) url.searchParams.set('lastMessageDate', cursor)\n  const res = await fetch(url, { headers: { 'X-Api-Key': 'YOUR_API_KEY' } })\n  const { data } = await res.json()\n  for (const item of data.recentItems) rows.set(item.chatId, item)\n  if (!data.hasNextPage) break\n  const dates = data.recentItems.filter((i) => !i.pinned && i.dateLastActivity).map((i) => i.dateLastActivity)\n  const next = dates.length ? dates.reduce((a, b) => (Date.parse(a) \u003C= Date.parse(b) ? a : b)) : undefined\n  if (!next || (cursor && Date.parse(next) >= Date.parse(cursor))) {\n    if (limit === 200) throw new Error('Recent-list cursor did not advance; restart with a full refresh')\n    limit = Math.min(limit * 2, 200)\n    continue\n  }\n  cursor = next\n  limit = 50\n}\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst rows = new Map()\nlet limit = 50\nlet cursor\nfor (;;) {\n  const url = new URL('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Frecent\u002Fcollabs')\n  url.searchParams.set('limit', String(limit))\n  if (cursor) url.searchParams.set('lastMessageDate', cursor)\n  const res = await fetch(url, {\n    headers: {\n      'X-Api-Key': 'YOUR_APP_KEY',\n      'Authorization': 'Bearer USER_SESSION_TOKEN',\n    },\n  })\n  const { data } = await res.json()\n  for (const item of data.recentItems) rows.set(item.chatId, item)\n  if (!data.hasNextPage) break\n  const dates = data.recentItems.filter((i) => !i.pinned && i.dateLastActivity).map((i) => i.dateLastActivity)\n  const next = dates.length ? dates.reduce((a, b) => (Date.parse(a) \u003C= Date.parse(b) ? a : b)) : undefined\n  if (!next || (cursor && Date.parse(next) >= Date.parse(cursor))) {\n    if (limit === 200) throw new Error('Recent-list cursor did not advance; restart with a full refresh')\n    limit = Math.min(limit * 2, 200)\n    continue\n  }\n  cursor = next\n  limit = 50\n}\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.recentItems` | array | List rows in the order Bitrix24 returns them: pinned first, then by activity |\n| `data.recentItems[].dialogId` | string | Dialog ID of the collab, `chatXXX` |\n| `data.recentItems[].chatId` | number | Chat ID, the deduplication key |\n| `data.recentItems[].messageId` | number | ID of the last message |\n| `data.recentItems[].pinned` | boolean | The chat is pinned for the current user |\n| `data.recentItems[].unread` | boolean | The chat is manually marked as unread |\n| `data.recentItems[].dateLastActivity` | string\\|null | Instant of the last activity. The smallest value among the unpinned rows is the cursor of the next page |\n| `data.chats` | array | Collab chat cards: `id`, `dialogId`, `name`, `type` with the value `collab`, `entityType` with the value `SONET_GROUP`, `entityId` — the group ID, the current user's `role` and other chat fields |\n| `data.messages` | array | The chats' last messages |\n| `data.users` | array | Authors of the last messages |\n| `data.files` | array | Files of the last messages |\n| `data.recentConfigs` | array | List sections in which each chat is counted: `chatId` and `sections` |\n| `data.hasNextPage` | boolean | `false` — the end of the list |\n| `meta.requestedLimit` | number | The `limit` passed. It arrives together with `appliedLimit`, only when the value was outside the range of 50 to 200 |\n| `meta.appliedLimit` | number | The `limit` applied — only when it was clamped to a bound |\n\n## Response example\n\nThe main fields are shown; `limit=10` is raised to 50:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"recentItems\": [\n      {\n        \"dialogId\": \"chat53\",\n        \"chatId\": 53,\n        \"messageId\": 413,\n        \"type\": \"chat\",\n        \"pinned\": false,\n        \"unread\": false,\n        \"dateUpdate\": \"2026-06-15T12:31:26+00:00\",\n        \"dateLastActivity\": \"2026-04-21T10:55:53+00:00\"\n      }\n    ],\n    \"chats\": [\n      {\n        \"id\": 53,\n        \"dialogId\": \"chat53\",\n        \"name\": \"Partner program launch\",\n        \"type\": \"collab\",\n        \"entityType\": \"SONET_GROUP\",\n        \"entityId\": \"3\",\n        \"owner\": 1,\n        \"role\": \"owner\"\n      }\n    ],\n    \"recentConfigs\": [\n      { \"chatId\": 53, \"sections\": [\"default\", \"collab\"] }\n    ],\n    \"hasNextPage\": false\n  },\n  \"meta\": {\n    \"requestedLimit\": 10,\n    \"appliedLimit\": 50\n  }\n}\n```\n\n## Error response example\n\n400 — the cursor has no offset:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"`lastMessageDate` must be a datetime YYYY-MM-DDTHH:MM:SS with a UTC offset (+03:00) or Z and no fractional seconds — the smallest `dateLastActivity` among the unpinned rows of the previous page.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A parameter other than `limit` and `lastMessageDate`, a repeated parameter, a non-numeric `limit`, or a `lastMessageDate` that is not in the `YYYY-MM-DDTHH:MM:SS` format with an offset or `Z` or that has a nonexistent date or time (`2026-02-30`, `24:00`). Checked before the Bitrix24 call |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the Bitrix24 code is in `error.b24Code` |\n| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**The `limit` floor is 50.** A user can have up to 45 pinned chats, and they repeat on every page. A page smaller than 50 rows could consist of repeats only and give no cursor.\n\n**Pagination does not give a snapshot.** A collab that new activity lifts above the cursor during pagination does not appear in the results. Re-read the first page after pagination.\n\n## See also\n\n- [Recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent)\n- [Channel list](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent-channels)\n- [External chats of a section](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent-external)\n- [Chat discovery](\u002Fdocs\u002Fchats\u002Fdiscovery)\n","2026-10-07",{},1794739535519]