[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-openlines\u002Foperator\u002Ffinish-another":3,"docs-tabs-openlines\u002Foperator\u002Ffinish-another":6},{"content":4,"lastmod":5},"## Finish another operator's dialog\n\n`POST \u002Fv1\u002Fopenlines\u002Foperator\u002Ffinish-another`\n\nFinishes an Open Channel dialog handled by another operator: the current session of the chat is closed.\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\u002Foperator\u002Ffinish-another \\\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\u002Foperator\u002Ffinish-another \\\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\u002Foperator\u002Ffinish-another', {\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 body = await res.json()\nif (!body.success) throw new Error(`${body.error.code}: ${body.error.message}`)\nconsole.log('Dialog finished:', body.data.chatId)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fopenlines\u002Foperator\u002Ffinish-another', {\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 body = await res.json()\nif (!body.success) throw new Error(`${body.error.code}: ${body.error.message}`)\nconsole.log('Dialog finished:', body.data.chatId)\n```\n\n## Response fields\n\n| Field | Type | Description |\n|---|---|---|\n| `success` | boolean | `true` |\n| `data.chatId` | number | Chat identifier from the request. A string from the request is returned as a number |\n| `data.finished` | boolean | Always `true` |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"chatId\": 5255,\n    \"finished\": true\n  }\n}\n```\n\n## Error response example\n\n404 — no chat with this identifier:\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` | The chat has no open session: the dialog is already finished. `error.b24Code` is `NOT_LOAD_SESSION_OR_CHAT`, and `error.message` is `Session or chat failed to load` |\n| 422 | `BITRIX_ERROR` | Bitrix24 refused the action for another reason. The refusal code, if Bitrix24 returned one, 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 responded without an error but did not confirm the action |\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- **The session is closed with `closeReason` equal to `operator`.** You can see it in [`POST \u002Fv1\u002Fopenlines\u002Fsessions\u002Fsearch`](\u002Fdocs\u002Fopenlines\u002Fsessions\u002Fsearch). An operator finishes their own dialog with `POST \u002Fv1\u002Fopenlines\u002Foperator\u002Ffinish`, described in [Operator actions on a dialog](\u002Fdocs\u002Fopenlines\u002Fconfig#operator-actions-on-a-dialog).\n- **A repeated call right after finishing also returns `200`.** A repeated call within the first seconds after a successful finish returns `finished: true`, although the session is already closed. A minute later, a repeated call returns `422 BITRIX_ERROR` with `NOT_LOAD_SESSION_OR_CHAT`. To check whether the session is closed, use `status` in [`POST \u002Fv1\u002Fopenlines\u002Fsessions\u002Fsearch`](\u002Fdocs\u002Fopenlines\u002Fsessions\u002Fsearch), not the response of a repeated call.\n\n## See also\n\n- [Operator actions and my pause](\u002Fdocs\u002Fopenlines\u002Foperator)\n- [Transfer a dialog](\u002Fdocs\u002Fopenlines\u002Foperator\u002Ftransfer)\n- [Mark the client as spam](\u002Fdocs\u002Fopenlines\u002Foperator\u002Fspam)\n- [Session search](\u002Fdocs\u002Fopenlines\u002Fsessions\u002Fsearch)\n- [Open Channels](\u002Fdocs\u002Fopenlines)\n","2026-10-19",{},1795415489963]