For AI agents: markdown of this page — /docs-content-en/bots/openlines/finish.md documentation index — /llms.txt

Finish a session

POST /v1/bots/:botId/openlines/session/finish

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

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/bots/621/openlines/session/finish" \
  -H "X-Api-Key: $VIBE_API_KEY" -H "Content-Type: application/json" \
  -d '{"chatId": 2043}'

finished mirrors the true REST response. Bitrix24 does not return the outcome of its internal answer/finish steps, so this flag does not prove a change to an already finished or inaccessible session.

JSON
{
  "success": true,
  "data": {
    "chatId": 2043,
    "finished": true
  }
}

Identifiers: chatId / dialogId / CHAT_ID follow the shared rules.

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.