# Transfer a session

`POST /v1/bots/:botId/openlines/session/transfer`

Bitrix24 method: `imopenlines.bot.session.transfer`. Requires `imbot` and `imopenlines`, the key owning the bot and write access.

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/bots/621/openlines/session/transfer" \
  -H "X-Api-Key: $VIBE_API_KEY" -H "Content-Type: application/json" \
  -d '{"chatId": 2043, "queueId": 7, "leave": true}'
```

Pass exactly one target: `userId`, `queueId` or `transferId`. The first two accept positive safe integers or numeric strings. `transferId` is a user id or `queue<N>` with a case-insensitive prefix. `USER_ID`, `QUEUE_ID`, `TRANSFER_ID` aliases are accepted. `leave` / `LEAVE` accept only true, false, Y, N; default N.

```json
{
  "success": true,
  "data": {
    "chatId": 2043,
    "transferred": true
  }
}
```

Identifiers: `chatId` / `dialogId` / `CHAT_ID` follow the [shared rules](../openlines.md).

## Refusals

| HTTP | Codes |
|---|---|
| 400 | INVALID_BOT_ID / INVALID_CHAT_ID / INVALID_PARAMS / MISSING_REQUIRED_FIELDS / MISSING_TRANSFER_TARGET / INVALID_TRANSFER_TARGET |
| 401 | MISSING_API_KEY / TOKEN_MISSING |
| 403 | SCOPE_DENIED / BOT_ACCESS_DENIED / WRITE_BLOCKED_READONLY_KEY / BITRIX_ACCESS_DENIED |
| 404 | BOT_NOT_FOUND / ENTITY_NOT_FOUND |
| 410 | BOT_DISABLED |
| 422 | BITRIX_ERROR; b24Code carries the Bitrix24 refusal, such as WRONG_CHAT, BOT_ID_ERROR, OPERATOR_WRONG or WRONG_AUTH_TYPE |
| 429 | RATE_LIMITED or portal queue refusal |
| 502 | OPENLINE_BOT_SESSION_FAILED / BITRIX_UNAVAILABLE |
| 503 | BITRIX_TIMEOUT or key-owner deletion freeze |

Bitrix24 business prose is preserved with credentials removed. Do not mutate other users' sessions when testing.
