[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-chats\u002Fdiscovery\u002Fshared":3,"docs-tabs-chats\u002Fdiscovery\u002Fshared":6},{"content":4,"lastmod":5},"## Shared chats with a user\n\n`GET \u002Fv1\u002Fchats\u002Fshared`\n\nReturns the chats in which both the current user and the given employee are members. Use it for a \"Shared chats\" block in the other person's profile card.\n\n## Parameters\n\n| Parameter | Type | Required | Default | Description |\n|----------|-----|:-----:|-----------|---------|\n| `userId` (query) | integer | yes | — | Employee ID, `1` or more. List: [`GET \u002Fv1\u002Fusers`](\u002Fdocs\u002Fentities\u002Fusers) |\n| `limit` (query) | integer | no | 50 | Chats per page, 1 to 200. A smaller value is raised to 1 and a larger one is clamped to 200, both echoed in `meta` |\n| `offset` (query) | integer | no | 0 | How many chats to skip, `0` or more |\n\nOther parameters and repeated parameters are rejected with `400 INVALID_PARAMS`.\n\n**Pagination.** Request the next page with `offset` increased by the applied `limit`. The list ends at an **empty** page, `data.chats` with no items. A short page is not the end: a page can be shorter than `limit` while more chats follow.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fshared?userId=4&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\u002Fshared?userId=4&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 shared = []\nfor (let offset = 0; ; offset += 50) {\n  const url = `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fshared?userId=4&limit=50&offset=${offset}`\n  const res = await fetch(url, { headers: { 'X-Api-Key': 'YOUR_API_KEY' } })\n  const { data } = await res.json()\n  if (data.chats.length === 0) break\n  shared.push(...data.chats)\n}\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst shared = []\nfor (let offset = 0; ; offset += 50) {\n  const url = `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fshared?userId=4&limit=50&offset=${offset}`\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  if (data.chats.length === 0) break\n  shared.push(...data.chats)\n}\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.chats` | array | Shared chats. An empty array is the end of the list |\n| `data.chats[].id` | number | Chat ID |\n| `data.chats[].dialogId` | string | Dialog ID, `chatXXX`, for the message endpoints |\n| `data.chats[].name` | string | Chat name |\n| `data.chats[].type` | string | Chat type: `chat`, `general`, `openChannel`, `collab`, `calendar` and others |\n| `data.chats[].owner` | number | ID of the chat owner |\n| `data.chats[].role` | string | The current user's role: `owner`, `manager`, `member` |\n| `data.chats[].dateMessage` | string | Time of the chat's last message |\n| `meta.requestedLimit` | number | The `limit` passed. It arrives together with `appliedLimit`, only when the value was outside the range of 1 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:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"chats\": [\n      {\n        \"id\": 1,\n        \"dialogId\": \"chat1\",\n        \"name\": \"General chat\",\n        \"type\": \"general\",\n        \"owner\": 0,\n        \"role\": \"member\",\n        \"dateMessage\": \"2026-09-24T18:02:11+00:00\"\n      },\n      {\n        \"id\": 264431,\n        \"dialogId\": \"chat264431\",\n        \"name\": \"Release preparation\",\n        \"type\": \"chat\",\n        \"owner\": 1,\n        \"role\": \"owner\",\n        \"dateMessage\": \"2026-09-24T21:10:22+00:00\"\n      }\n    ]\n  }\n}\n```\n\n## Error response example\n\n400 — no `userId`:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"`userId` is required: the user whose shared chats to list.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | No `userId`, `userId` less than `1`, `offset` less than `0`, a non-numeric `limit`, a parameter other than `userId`, `limit`, `offset`, or a repeated parameter. 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 response has no next-page flag.** Pagination runs until an empty page, so the last request always returns an empty `data.chats`.\n\n## See also\n\n- [Recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent)\n- [Dialog details](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Fget)\n- [Chat discovery](\u002Fdocs\u002Fchats\u002Fdiscovery)\n","2026-10-07",{},1794739535958]