For AI agents: markdown of this page — /docs-content-en/openlines/operator/transfer.md documentation index — /llms.txt
Transfer a dialog
POST /v1/openlines/operator/transfer
Transfers the current session of an Open Channel chat to another employee or to the channel queue.
The action runs on behalf of the employee the key belongs to — see On whose behalf the action runs.
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
FieldchatId |
Typenumber | string | Requiredyes | DescriptionOpen 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 |
FielduserId |
Typenumber | string | Requiredno | DescriptionID of the employee the dialog is transferred to. List: GET /v1/users |
FieldqueueId |
Typenumber | string | Requiredno | DescriptionID of the channel whose queue receives the dialog. List: GET /v1/openline-configs |
FieldtransferId |
Typenumber | string | Requiredno | DescriptionThe target as a single value: a queue<id> string targets a channel queue, for example queue59. A number or a digit string targets an employee by ID |
Pass exactly one of userId, queueId and transferId.
Examples
curl — personal key
curl -X POST https://vibecode.bitrix24.com/v1/openlines/operator/transfer \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chatId": 5255,
"userId": 1295
}'
curl — OAuth application
curl -X POST https://vibecode.bitrix24.com/v1/openlines/operator/transfer \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"chatId": 5255,
"userId": 1295
}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/operator/transfer', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
chatId: 5255,
userId: 1295,
}),
})
const { success, data, error } = await res.json()
if (!success) throw new Error(`${error.code}: ${error.message}`)
console.log('Transferred:', data.transferred)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/operator/transfer', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
chatId: 5255,
userId: 1295,
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on a successful transfer |
Fielddata.chatId |
Typenumber | DescriptionChat identifier from the request. A string from the request is returned as a number |
Fielddata.transferred |
Typeboolean | DescriptionAlways true |
Response example
{
"success": true,
"data": {
"chatId": 5255,
"transferred": true
}
}
Error response example
400 — more than one target passed:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "Pass exactly one target: userId, queueId or transferId"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_CHAT_ID |
DescriptionchatId is missing, is not a positive integer, is a string with non-digit characters or a leading zero, or is greater than 9007199254740991 |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionNo target passed, more than one target passed, or the target value is neither a positive integer nor a queue<id> string |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionNo chat with this chatId |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 refused the transfer. Its code is returned in error.b24Code. OPERATOR_WRONG with the text You can not redirect to this operator is returned in two cases: the target is the employee the call runs as, or there is no chat with this chatId |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionThe employee the call runs as has no permission for the action |
| HTTP502 | CodeOPENLINE_OPERATOR_FAILED |
DescriptionBitrix24 neither confirmed the transfer nor returned an error |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key has no imopenlines scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header is missing |
| HTTP401 | CodeINVALID_API_KEY |
DescriptionThe key is not recognized |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionA personal key has no access to the Bitrix24 portal, or an application key was sent without a session token in Authorization |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable or the connection to it broke before the response was complete |
Full list of common API errors — Errors.
Known specifics
- A transfer to an employee keeps the session. The session identifier stays the same while its operator changes, and the
queueTransferscounter in the session list increases by one. - A transfer to a queue opens a new session. After a transfer by
queueIdor by atransferIdof the formqueue<id>, the chat continues in a new session with the statusnewand no operator. Find its identifier in the session list bychatId.