[{"data":1,"prerenderedAt":17},["ShallowReactive",2],{"docs-chats\u002Fservice":3,"docs-tabs-chats\u002Fservice":6},{"content":4,"lastmod":5},"# Service methods\n\nMessenger methods that do not belong to a single section: the forms for creating a task or a flow from a chat, context for chat bots, a Zoom meeting, the update state and counters, plan restrictions, promo hints, the user's department and the desktop app logout.\n\n**Scope:** `im` | **Base URL:** `https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1` | **Authorization:** `X-Api-Key`\n\n## Operations\n\n- [Task form](.\u002Fservice\u002Ftask-form.md) — `GET \u002Fv1\u002Fchats\u002F:dialogId\u002Ftask-form`\n- [Task form for a message](.\u002Fservice\u002Ftask-form-message.md) — `POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Ftask-form`\n- [Flow form](.\u002Fservice\u002Fflow-form.md) — `GET \u002Fv1\u002Fchats\u002F:dialogId\u002Fflow-form`\n- [Context for bots](.\u002Fservice\u002Fbot-context.md) — `POST \u002Fv1\u002Fchats\u002F:dialogId\u002Fbot-context`\n- [Zoom meeting](.\u002Fservice\u002Fzoom.md) — `POST \u002Fv1\u002Fchats\u002F:dialogId\u002Fzoom`\n- [Update state](.\u002Fservice\u002Fstate.md) — `GET \u002Fv1\u002Fchats\u002Fstate`\n- [Plan restrictions](.\u002Fservice\u002Ftariff-restrictions.md) — `GET \u002Fv1\u002Fchats\u002Ftariff-restrictions`\n- [Promo hints](.\u002Fservice\u002Fpromotions.md) — `GET \u002Fv1\u002Fchats\u002Fpromotions`\n- [User department](.\u002Fservice\u002Fdepartment.md) — `GET \u002Fv1\u002Fchats\u002Fusers\u002F:userId\u002Fdepartment`\n- [Desktop app logout](.\u002Fservice\u002Fdesktop-logout.md) — `POST \u002Fv1\u002Fchats\u002Fdesktop\u002Flogout`\n\n## Reads that change state\n\nThe task and flow forms return data, but in doing so Bitrix24 may add the caller to a chat that allows auto-join — just as opening the chat in the interface does. A read-only key therefore gets `403 WRITE_BLOCKED_READONLY_KEY` for them before any call to Bitrix24. Details — [Access rights](\u002Fdocs\u002Faccess-rights).\n\nA read-only key also cannot call the other operations that change something: context for bots, Zoom, the desktop app logout and the task form for a message.\n\n## See also\n\n- [Chats and messages](\u002Fdocs\u002Fchats)\n- [Messenger settings](\u002Fdocs\u002Fchats\u002Fsettings)\n","2026-10-06",{"service\u002Ftask-form.md":7,"service\u002Ftask-form-message.md":8,"service\u002Fflow-form.md":9,"service\u002Fbot-context.md":10,"service\u002Fzoom.md":11,"service\u002Fstate.md":12,"service\u002Ftariff-restrictions.md":13,"service\u002Fpromotions.md":14,"service\u002Fdepartment.md":15,"service\u002Fdesktop-logout.md":16},"## Task form\n\n`GET \u002Fv1\u002Fchats\u002F:dialogId\u002Ftask-form`\n\nPrepares the data for the form that creates a task from a chat, but does not create the task itself: the user fills in and saves the form in Bitrix24.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `dialogId` (path) | string | yes | Dialog ID: `chat123` for a group chat, a user ID for a private chat, `me` for the chat with yourself. `chat123` is the `id` field of a [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) row, a user ID comes from the [user list](\u002Fdocs\u002Fentities\u002Fusers\u002Flist) |\n\nThere are no query parameters. `messageId` in the query is rejected with `400` — the form for a message is described on the [Task form for a message](\u002Fdocs\u002Fchats\u002Fservice\u002Ftask-form-message) page.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Ftask-form\" \\\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\u002Fchat42\u002Ftask-form\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Ftask-form', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconsole.log('Form:', data.link, 'assignee:', data.params.responsibleId)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Ftask-form', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Form:', data.link)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | object | Form data |\n| `data.link` | string | Relative link to the task creation form in Bitrix24: to open the form, prepend your Bitrix24 address to it |\n| `data.params` | object | Form fields. Their set depends on the chat — see the paragraph after the table |\n| `data.params.responsibleId` | number | Assignee — the calling user |\n| `data.params.imChatId` | number | Chat ID |\n| `data.params.auditors` | string | Observers — comma-separated IDs of the chat members except the caller, no more than 50. A group or project chat has no observers |\n| `data.params.groupId` | number \\| null | Group or project ID — for a group or project chat |\n| `data.params.isTasksV2` | boolean | `true` — the new version of tasks is enabled in Bitrix24. The response then includes the fields below |\n| `data.params.entityId` | number | Chat ID |\n| `data.params.subEntityId` | null | Message ID. Always `null` in the form for a chat |\n| `data.params.taSec`, `data.params.taEl` | string | Source labels for Bitrix24 analytics |\n| `data.params.description` | null | Task description. Always `null` in the form for a chat |\n\nThe contents of `params` depend on the chat and the Bitrix24 settings: Open Channels chats carry a CRM binding, and with the previous version of tasks the `isTasksV2` field and the fields below it are absent.\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"link\": \"\u002Fcompany\u002Fpersonal\u002Fuser\u002F1\u002Ftasks\u002Ftask\u002Fedit\u002F0\u002F?ta_sec=chat&ta_el=chat_context_menu\",\n    \"params\": {\n      \"responsibleId\": 1,\n      \"imChatId\": 42,\n      \"auditors\": \"4\",\n      \"isTasksV2\": true,\n      \"entityId\": 42,\n      \"subEntityId\": null,\n      \"taSec\": \"chat\",\n      \"taEl\": \"chat_context_menu\",\n      \"description\": null,\n      \"groupId\": null\n    }\n  }\n}\n```\n\n## Error response example\n\n400 — `messageId` was passed:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Query parameter `messageId` is not accepted by GET \u002Fv1\u002Fchats\u002F:dialogId\u002Ftask-form: the task form of a message is POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Ftask-form.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A query parameter was passed — the operation accepts none |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only: the call may make the key owner a chat member |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\". The Bitrix24 code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code`. `TASK_ACCESS_ERROR` — no access to the chat, `TASKS_NOT_INSTALLED` — the tasks module is not installed |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Failed to resolve the current user for `me` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Task form for a message](\u002Fdocs\u002Fchats\u002Fservice\u002Ftask-form-message)\n- [Flow form](\u002Fdocs\u002Fchats\u002Fservice\u002Fflow-form)\n- [Messages around a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcontext)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Task form for a message\n\n`POST \u002Fv1\u002Fchats\u002Fmessages\u002F:messageId\u002Ftask-form`\n\nPrepares the data for the form that creates a task from a chat message, but does not create the task itself: the user fills in and saves the form in Bitrix24.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `messageId` (path) | number | yes | Message ID, a positive integer — the `id` field of a message from the [message history](\u002Fdocs\u002Fchats\u002Fmessages\u002Flist) or [chat loading](\u002Fdocs\u002Fchats\u002Fmessages\u002Fload). The chat is resolved from the message |\n\nThe request has no body and no query parameters: any body field or query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Ftask-form\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Ftask-form\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Ftask-form', {\n  method: 'POST',\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconsole.log('Quote:', data.params.description)\nconsole.log('Files:', data.params.ufTaskWebdavFilesData?.map((f) => f.name))\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fmessages\u002F1002\u002Ftask-form', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Form:', data.link)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | object | Form data |\n| `data.link` | string | Relative link to the task creation form in Bitrix24: to open the form, prepend your Bitrix24 address to it |\n| `data.params` | object | Form fields. The set depends on the chat — see the paragraph after the table |\n| `data.params.responsibleId` | number | Assignee — the calling user |\n| `data.params.imChatId` | number | ID of the message's chat |\n| `data.params.auditors` | string | Observers — comma-separated IDs of the chat members except the caller, no more than 50. A group or project chat has no observers |\n| `data.params.groupId` | number \\| null | Group or project ID — for a group or project chat |\n| `data.params.imMessageId` | number | Message ID |\n| `data.params.ufTaskWebdavFiles` | string[] | IDs of the file copies on Drive in the `n\u003Cid>` format — present only if the message has files |\n| `data.params.ufTaskWebdavFilesSign` | string | Bitrix24 signature over the list of copies — the form sends it back when the task is saved |\n| `data.params.ufTaskWebdavFilesData[]` | object[] | File copies |\n| `data.params.ufTaskWebdavFilesData[].id` | string | Copy ID in the `n\u003Cid>` format, as in `ufTaskWebdavFiles` |\n| `data.params.ufTaskWebdavFilesData[].objectId` | number | Copy ID on Drive |\n| `data.params.ufTaskWebdavFilesData[].name` | string | Copy name |\n| `data.params.ufTaskWebdavFilesData[].type` | string | File type |\n| `data.params.ufTaskWebdavFilesData[].url` | string | Download link of the copy |\n| `data.params.ufTaskWebdavFilesData[].previewUrl` | string | Preview link. An empty string if there is no preview |\n| `data.params.ufTaskWebdavFilesData[].height`, `data.params.ufTaskWebdavFilesData[].width` | number | Image height and width in pixels. `0` for files without dimensions |\n| `data.params.isTasksV2` | boolean | `true` — the new version of tasks is enabled in Bitrix24. The response then includes the fields below |\n| `data.params.entityId` | number | Chat ID |\n| `data.params.subEntityId` | number | Message ID |\n| `data.params.taSec`, `data.params.taEl` | string | Source labels for Bitrix24 analytics |\n| `data.params.description` | string | Message quote with BB codes: the chat name, the author, the text |\n\nThe contents of `params` depend on the chat and the Bitrix24 settings: Open Channels chats carry a CRM binding, and with the previous version of tasks the `isTasksV2` field and the fields below it are absent.\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"link\": \"\u002Fcompany\u002Fpersonal\u002Fuser\u002F1\u002Ftasks\u002Ftask\u002Fedit\u002F0\u002F?ta_sec=chat&ta_el=chat_context_menu\",\n    \"params\": {\n      \"responsibleId\": 1,\n      \"imChatId\": 42,\n      \"auditors\": \"4\",\n      \"imMessageId\": 1002,\n      \"subEntityId\": 1002,\n      \"isTasksV2\": true,\n      \"entityId\": 42,\n      \"taSec\": \"chat\",\n      \"taEl\": \"chat_context_menu\",\n      \"groupId\": null,\n      \"description\": \"[QUOTE][B]Chat:[\u002FB] [URL=\u002Fonline\u002F?IM_DIALOG=chat42&IM_MESSAGE=1002]Project[\u002FURL]\\n[B]Maria Smith[\u002FB]\\nThe report is attached[File: report.txt]\\n[\u002FQUOTE]\",\n      \"ufTaskWebdavFiles\": [\"n6773\"],\n      \"ufTaskWebdavFilesSign\": \"\u003Csignature>\",\n      \"ufTaskWebdavFilesData\": [\n        {\n          \"id\": \"n6773\",\n          \"objectId\": 6773,\n          \"name\": \"report (1).txt\",\n          \"type\": \"txt\",\n          \"url\": \"https:\u002F\u002Fexample.bitrix24.com\u002Fbitrix\u002Fservices\u002Fmain\u002Fajax.php?action=disk.api.file.download&SITE_ID=s1&humanRE=1&fileId=6773&exact=N&fileName=report%20%281%29.txt\",\n          \"height\": 0,\n          \"width\": 0,\n          \"previewUrl\": \"\"\n        }\n      ]\n    }\n  }\n}\n```\n\n## Error response example\n\n400 — `messageId` is not a positive integer:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"messageId must be a positive integer.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `messageId` is not a positive integer, or a body field or query parameter was passed |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\". The Bitrix24 code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code`. `TASK_ACCESS_ERROR` — no access to the message or its chat, `TASKS_NOT_INSTALLED` — the tasks module is not installed |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- If the message has files, every call creates new copies of them in the \"Uploaded files\" folder on the caller's Drive. Copies that do not make it into a task are deleted on a schedule.\n- The operation may make the caller a chat member if the chat allows auto-join (a collab or a comment chat, for example), just as opening the chat in Bitrix24 does.\n\n## See also\n\n- [Task form](\u002Fdocs\u002Fchats\u002Fservice\u002Ftask-form)\n- [Flow form](\u002Fdocs\u002Fchats\u002Fservice\u002Fflow-form)\n- [Messages around a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fcontext)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Flow form\n\n`GET \u002Fv1\u002Fchats\u002F:dialogId\u002Fflow-form`\n\nData for the form that creates a task flow from a collab: the ID of the collab's workgroup. The flow is not created — the user fills in the form in Bitrix24.\n\nWorks for collabs only.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `dialogId` (path) | string | yes | Dialog ID of the collab: `chat123` — the `dialogId` field of a [collab list](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent-collabs) row |\n\nThe operation accepts no query parameters: any query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fflow-form\" \\\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\u002Fchat42\u002Fflow-form\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fflow-form', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconsole.log('Collab group:', data.groupId)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fflow-form', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Collab group:', data.groupId)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.groupId` | number | ID of the collab's workgroup — the flow will be created in it |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": { \"groupId\": 57 }\n}\n```\n\n## Error response example\n\n422 — the chat is not a collab:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"Chat type is not supported\",\n    \"b24Code\": \"CHAT_TYPE_NOT_SUPPORTED\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A query parameter was passed — the operation accepts none |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only: the call may make the key owner a chat member |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\". The Bitrix24 code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code`. `CHAT_TYPE_NOT_SUPPORTED` — the chat is not a collab |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Failed to resolve the current user for `me` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Task form](\u002Fdocs\u002Fchats\u002Fservice\u002Ftask-form)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Context for bots\n\n`POST \u002Fv1\u002Fchats\u002F:dialogId\u002Fbot-context`\n\nPasses an arbitrary context object to the chat's bots. The context is supplemented with chat data and passed to the context handlers of the bots connected to the chat.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `dialogId` (path) | string | yes | Dialog ID: `chat123` for a group chat, a user ID for a private chat, `me` for the chat with yourself. `chat123` is the `id` field of a [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) row; the user ID comes from the [user list](\u002Fdocs\u002Fentities\u002Fusers\u002Flist) |\n\n## Request body fields\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|----------|\n| `context` | object | yes | Data for the bots — any JSON object. Arrays, strings, numbers and `null` are rejected |\n\nAny other body field and any query parameter are rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fbot-context\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"context\": {\"page\": \"deal\", \"dealId\": 128}}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fbot-context\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"context\": {\"page\": \"deal\", \"dealId\": 128}}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fbot-context', {\n  method: 'POST',\n  headers: { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application\u002Fjson' },\n  body: JSON.stringify({ context: { page: 'deal', dealId: 128 } }),\n})\n\nconst { data } = await res.json()\nconsole.log('Context delivered:', data.result)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fbot-context', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ context: { page: 'deal', dealId: 128 } }),\n})\n\nconst { data } = await res.json()\nconsole.log('Context delivered:', data.result)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.result` | boolean | `true` — the context reached the bots' handlers |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": { \"result\": true }\n}\n```\n\n## Error response example\n\n422 — the chat has no bots with a context handler:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"BOT_CONTEXT_ERROR\",\n    \"b24Code\": \"BOT_CONTEXT_ERROR\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `context` is missing or is not a JSON object, or another body field or query parameter was passed |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\". The Bitrix24 code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code`. `BOT_CONTEXT_ERROR` — the chat has no bots that accepted the context |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Failed to resolve the current user for `me` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- `context` is passed to the bots as is: the platform does not rename its keys.\n- The chat type, the caller's ID, the chat author and the entity the chat is bound to are added to the context.\n- The call may make the caller a chat member if the chat allows auto-join.\n\n## See also\n\n- [Bot platform](\u002Fdocs\u002Fbots)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Zoom meeting\n\n`POST \u002Fv1\u002Fchats\u002F:dialogId\u002Fzoom`\n\nCreates a meeting in the caller's Zoom account and, on the caller's behalf, sends an invitation message with the join link to the chat. The caller needs a Zoom account connected to Bitrix24.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `dialogId` (path) | string | yes | Dialog ID: `chat123` for a group chat, a user ID for a private chat, `me` for the chat with yourself. `chat123` is the `id` field of a [recent dialogs](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Frecent) row, a user ID comes from the [user list](\u002Fdocs\u002Fentities\u002Fusers\u002Flist) |\n\nThe operation accepts no body and no query parameters: any body field or query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fzoom\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fzoom\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fzoom', {\n  method: 'POST',\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconsole.log('Join link:', data.link, 'invitation:', data.messageId)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fchat42\u002Fzoom', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Join link:', data.link)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | object | The created meeting |\n| `data.link` | string | Link to join the meeting — the same one as in the invitation |\n| `data.messageId` | number | ID of the invitation message in the chat |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"link\": \"https:\u002F\u002Fus05web.zoom.us\u002Fj\u002F81234567890?pwd=abc\",\n    \"messageId\": 1003\n  }\n}\n```\n\n## Error response example\n\n422 — the Zoom integration is turned off in Bitrix24:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"ZOOM_ACTIVE_ERROR\",\n    \"b24Code\": \"ZOOM_ACTIVE_ERROR\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A body field or query parameter was passed — the operation accepts none |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 403 | `BITRIX_ACCESS_DENIED` | No permission to write to the chat |\n| 404 | `ENTITY_NOT_FOUND` | Bitrix24 returned \"not found\". The Bitrix24 code is in `error.b24Code` |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code`. `ZOOM_ACTIVE_ERROR` — the Zoom integration is turned off, `ZOOM_AVAILABLE_ERROR` — Zoom is not available on the current Bitrix24 plan, `ZOOM_CONNECTED_ERROR` — the caller has not connected a Zoom account |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Failed to resolve the current user for `me` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- The response carries only the participant link: it has neither the host link nor the Zoom token.\n\n## See also\n\n- [Send a message](\u002Fdocs\u002Fchats\u002Fmessages\u002Fsend)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Update state\n\n`GET \u002Fv1\u002Fchats\u002Fstate`\n\nThe messenger state in a single call: revisions, the Bitrix24 user counters, chat counters, the latest notification, whether the desktop app is online, and the server time.\n\nThe call marks the user online and changes their presence status in the Bitrix24 account. A read-only key gets `403 WRITE_BLOCKED_READONLY_KEY` before any Bitrix24 call.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `siteId` (query) | string | no | The Bitrix24 site to count the user counters for — two characters, for example `s1`. Defaults to all sites |\n\nAny other query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fstate\" \\\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\u002Fstate?siteId=s1\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fstate', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconsole.log('Unread in the messenger:', data.chatCounters.type.all)\nconsole.log('Calendar invitations:', data.counters.calendar_invites)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fstate?siteId=s1', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Revision:', data.revision, 'server time:', data.serverTime)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.revision` | number | Revision of the messenger web client |\n| `data.mobileRevision` | number | Revision of the mobile client |\n| `data.counters` | object | Bitrix24 user counters: the key is the counter code (`calendar_invites`, `crm_company_all`, `**` and others), the value is a number. The codes are not renamed |\n| `data.chatCounters` | object | Messenger unread counters: `type` — by chat type (`all`, `chat`, `dialog`, `collab`, `lines`, `copilot`, `notify` and others), `chat` and `dialog` — by chat (the key is the chat ID or the other user's ID), `chatMuted`, `chatUnread`, `dialogUnread` and others — lists of IDs |\n| `data.notifyLastId` | number \\| null | ID of the latest notification |\n| `data.desktopStatus` | boolean | `true` — the user's desktop app is online |\n| `data.serverTime` | number | Bitrix24 server time, Unix time in seconds |\n| `data.lastUpdate` | string | Response time in RFC 3339 format |\n| `data.eventParams` | object \\| array | Data from Bitrix24 modules: the key is the module ID. An empty array if the modules passed nothing |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"revision\": 131,\n    \"mobileRevision\": 29,\n    \"counters\": { \"**\": 0, \"calendar\": 0, \"calendar_invites\": 0, \"crm_company_all\": 0 },\n    \"chatCounters\": {\n      \"type\": { \"all\": 5, \"notify\": 0, \"chat\": 3, \"lines\": 0, \"dialog\": 2, \"copilot\": 0, \"collab\": 0, \"messenger\": 5 },\n      \"chat\": { \"42\": 3 },\n      \"dialog\": { \"7\": 2 },\n      \"collab\": [],\n      \"chatMuted\": [],\n      \"chatUnread\": [],\n      \"dialogUnread\": [],\n      \"lines\": []\n    },\n    \"notifyLastId\": null,\n    \"desktopStatus\": false,\n    \"serverTime\": 1790293283,\n    \"lastUpdate\": \"2026-09-24T23:41:23+00:00\",\n    \"eventParams\": []\n  }\n}\n```\n\n## Error response example\n\n400 — invalid `siteId`:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"`siteId` must be a Bitrix24 site id: two letters, digits or `_` (e.g. `s1`).\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `siteId` is not two characters made of letters, digits and `_`, or another query parameter was passed |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | Read-only key; the call marks the user online |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- The keys of `counters` and `eventParams` are Bitrix24 codes and module IDs, and they arrive as is. The other keys are converted to camelCase.\n- A `siteId` that does not exist is not rejected.\n\n## See also\n\n- [Unread counters](\u002Fdocs\u002Fchats\u002Fdiscovery\u002Fcounters)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Plan restrictions\n\n`GET \u002Fv1\u002Fchats\u002Ftariff-restrictions`\n\nMessenger restrictions on the Bitrix24 plan: whether the full chat history, collabs and other features are available. The client uses the response to decide what to show the user.\n\n## Parameters\n\nThere are no parameters. Any query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ftariff-restrictions\" \\\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\u002Ftariff-restrictions\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ftariff-restrictions', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconst history = data.fullChatHistory\nconsole.log(history.isAvailable ? 'Full history available' : `History for ${history.limitDays} days`)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Ftariff-restrictions', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Collabs available:', data.collab?.isAvailable)\n```\n\n## Response fields\n\n`data` is the restrictions object. The key is the restriction code, the value is its data. Bitrix24 and its modules define the set of codes.\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.fullChatHistory.isAvailable` | boolean | `true` — the full chat history is available |\n| `data.fullChatHistory.limitDays` | number \\| null | How many days of history are available if not all of it. `null` — no limit |\n| `data.collab.isAvailable` | boolean | `true` — collabs are available on the plan or can be enabled with a trial |\n| `data.collab.isCopyAvailable` | boolean | `true` — copying projects and groups is available on the plan |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"fullChatHistory\": { \"isAvailable\": true, \"limitDays\": null },\n    \"collab\": { \"isAvailable\": true, \"isCopyAvailable\": true }\n  }\n}\n```\n\n## Error response example\n\n400 — a query parameter was passed:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Query parameter `code` is not accepted by GET \u002Fv1\u002Fchats\u002Ftariff-restrictions. It takes no query parameters.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A query parameter was passed — the operation accepts none |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- Restriction codes (`fullChatHistory`, `collab`) arrive as is; the fields inside them are converted to camelCase.\n- Bitrix24 modules can add their own restrictions — do not rely on a fixed set of codes.\n\n## See also\n\n- [Update state](\u002Fdocs\u002Fchats\u002Fservice\u002Fstate)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Promo hints\n\n`GET \u002Fv1\u002Fchats\u002Fpromotions`\n\nMessenger promo hints active for the user — hints about new features that the Bitrix24 interface shows only once. The list covers all device types.\n\n## Parameters\n\nThere are no parameters. Any query parameter, including `type`, is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fpromotions\" \\\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\u002Fpromotions\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fpromotions', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data: promotions } = await res.json()\nconsole.log('Active hints:', promotions.length)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fpromotions', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data: promotions } = await res.json()\nconsole.log(promotions.map((p) => p.id))\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data[]` | object[] | Active hints |\n| `data[].id` | string | Hint ID, for example `im:collab-helpdesk-sidebar:30102024:all`. The last part is the device type |\n| `data[].params.chatId` | number \\| null | The chat the hint belongs to. `null` — the whole messenger |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": [\n    { \"id\": \"im:collab-helpdesk-sidebar:30102024:all\", \"params\": { \"chatId\": null } },\n    { \"id\": \"im:download-several-files:22112024:all\", \"params\": { \"chatId\": null } }\n  ]\n}\n```\n\n## Error response example\n\n400 — `type` was passed:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Query parameter `type` is not accepted by GET \u002Fv1\u002Fchats\u002Fpromotions: Bitrix24 reads it only from a form body, so the endpoint answers the promotions of every device type.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A query parameter was passed — the operation accepts none |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Update state](\u002Fdocs\u002Fchats\u002Fservice\u002Fstate)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## User department\n\n`GET \u002Fv1\u002Fchats\u002Fusers\u002F:userId\u002Fdepartment`\n\nReturns the lowest department the user belongs to in the company structure, by user ID or for the key owner.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|----------|\n| `userId` (path) | string | yes | User ID — a positive integer from the [user list](\u002Fdocs\u002Fentities\u002Fusers\u002Flist), or `me` for the key owner |\n\nThere are no query parameters: any parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fusers\u002Fme\u002Fdepartment\" \\\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\u002Fusers\u002F4\u002Fdepartment\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fusers\u002Fme\u002Fdepartment', {\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { data } = await res.json()\nconsole.log('My department:', data.name)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fusers\u002F4\u002Fdepartment', {\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { data } = await res.json()\nconsole.log('Department:', data.id, data.name)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | object | The user's department |\n| `data.id` | number \\| null | Department ID — a node of the company structure, as in [org structure nodes](\u002Fdocs\u002Fhumanresources\u002Fnodes). `null` — the user is not in any department |\n| `data.name` | string \\| null | Department name |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": { \"id\": 1, \"name\": \"Sales\" }\n}\n```\n\n## Error response example\n\n422 — the user was not found:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"USER_NOT_FOUND\",\n    \"b24Code\": \"USER_NOT_FOUND\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | `userId` is neither a positive integer nor `me`, or a query parameter was passed |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error, and the Bitrix24 code is in `error.b24Code`. `USER_NOT_FOUND` — the user does not exist |\n| 502 | `ME_ALIAS_RESOLUTION_FAILED` | Failed to resolve the key owner for `me` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Employees](\u002Fdocs\u002Fentities\u002Fusers)\n- [Org structure nodes](\u002Fdocs\u002Fhumanresources\u002Fnodes)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n","## Desktop app logout\n\n`POST \u002Fv1\u002Fchats\u002Fdesktop\u002Flogout`\n\nMarks the caller's desktop app and the caller themselves \"offline\" in the messenger — as the Bitrix24 desktop app does when it logs out.\n\n## Parameters\n\nThere are no parameters. Any body field or query parameter is rejected with `400 INVALID_PARAMS`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fdesktop\u002Flogout\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\"\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fdesktop\u002Flogout\" \\\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 res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fdesktop\u002Flogout', {\n  method: 'POST',\n  headers: { 'X-Api-Key': 'YOUR_API_KEY' },\n})\n\nconst { success } = await res.json()\nconsole.log('Marked:', success)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fchats\u002Fdesktop\u002Flogout', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n  },\n})\n\nconst { success } = await res.json()\nconsole.log('Marked:', success)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data` | array | Always an empty array |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": []\n}\n```\n\n## Error response example\n\n400 — a body field was passed:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"INVALID_PARAMS\",\n    \"message\": \"Body field `dialogId` is not accepted by POST \u002Fv1\u002Fchats\u002Fdesktop\u002Flogout. It takes no body fields.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | A body field or query parameter was passed — the operation accepts none |\n| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |\n| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The Bitrix24 code is in `error.b24Code` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |\n\nFor the full list of common API errors, see [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- The call does not sign out of Bitrix24 and does not revoke keys — only the presence status changes.\n- Any subsequent messenger call from the same user, such as a request for the [update state](\u002Fdocs\u002Fchats\u002Fservice\u002Fstate), marks them \"online\" again.\n\n## See also\n\n- [Update state](\u002Fdocs\u002Fchats\u002Fservice\u002Fstate)\n- [User status](\u002Fdocs\u002Fchats\u002Fsettings\u002Fstatus)\n- [Service methods](\u002Fdocs\u002Fchats\u002Fservice)\n",1794739551224]