[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-openlines\u002Fsessions\u002Fstart":3,"docs-tabs-openlines\u002Fsessions\u002Fstart":6},{"content":4,"lastmod":5},"## Start a session\n\n`POST \u002Fv1\u002Fopenlines\u002Fsessions\u002Fstart`\n\nPicks up an Open Channel dialog: the employee the call runs as becomes the operator of the chat session.\n\nThe action runs on behalf of the employee the key belongs to — see [On whose behalf the action runs](\u002Fdocs\u002Fopenlines\u002Foperator#on-whose-behalf-the-action-runs).\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|----------|\n| `chatId` | number \\| string | yes | Open Channel chat identifier, a positive integer. A string is accepted if it consists of digits only and does not start with zero. See [Chat ID](\u002Fdocs\u002Fopenlines\u002Foperator#chat-id) |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fopenlines\u002Fsessions\u002Fstart \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"chatId\": 5255}'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fopenlines\u002Fsessions\u002Fstart \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"chatId\": 5255}'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fopenlines\u002Fsessions\u002Fstart', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ chatId: 5255 }),\n})\n\nconst { success, data, error } = await res.json()\nif (!success) throw new Error(`${error.code}: ${error.message}`)\nconsole.log('Session started:', data.started)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fopenlines\u002Fsessions\u002Fstart', {\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({ chatId: 5255 }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|----------|\n| `success` | boolean | `true` on a successful call |\n| `data.chatId` | number | Chat identifier from the request. A string from the request is returned as a number |\n| `data.started` | boolean | Always `true` |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"chatId\": 5255,\n    \"started\": true\n  }\n}\n```\n\n## Error response example\n\n404 — no chat with this `chatId`:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Open Line chat not found\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|----------|\n| 400 | `INVALID_CHAT_ID` | `chatId` is missing, is not a positive integer, is a string with non-digit characters or a leading zero, or is greater than 9007199254740991 |\n| 404 | `ENTITY_NOT_FOUND` | No chat with this `chatId` |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused the action. Its code is in `error.b24Code` |\n| 403 | `BITRIX_ACCESS_DENIED` | The employee the call runs as has no permission for the action |\n| 502 | `OPENLINE_OPERATOR_FAILED` | Bitrix24 neither confirmed the action nor returned an error |\n| 403 | `SCOPE_DENIED` | The key has no `imopenlines` scope |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only |\n| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |\n| 401 | `INVALID_API_KEY` | The key is not recognized |\n| 401 | `TOKEN_MISSING` | A personal key has no access to the Bitrix24 portal, or an application key was sent without a session token in `Authorization` |\n| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or the connection to it broke before the response was complete |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n- **A closed chat is opened with a new session.** If the chat has no open session, the call creates a new one with the status `answered`, and its operator is the employee the call runs as. The new session appears in the [session search](\u002Fdocs\u002Fopenlines\u002Fsessions\u002Fsearch) with the same `chatId`.\n- **A repeated call does not create a second session.** If the employee is already the operator of the chat's open session, the response is again `started: true`, and the session stays the same.\n\n## See also\n\n- [Operator actions and my pause](\u002Fdocs\u002Fopenlines\u002Foperator)\n- [Transfer a dialog](\u002Fdocs\u002Fopenlines\u002Foperator\u002Ftransfer)\n- [Open a client chat](\u002Fdocs\u002Fopenlines\u002Fsessions\u002Fopen)\n- [Session search](\u002Fdocs\u002Fopenlines\u002Fsessions\u002Fsearch)\n- [Chats by CRM card](\u002Fdocs\u002Fopenlines\u002Fcrm-chats)\n","2026-10-19",{},1795000567361]