لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/openlines/history.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Session history
This endpoint is being enabled gradually by the Vibecode platform. Until it is enabled on the platform, the call returns
403 OPENLINES_HISTORY_DISABLED— a sign that the capability is not active yet, not an integration error.
POST /v1/openlines/sessions/history
Returns the conversation of the latest session of an Open Channel chat in one response. Suited for reviewing a client's request as a whole: messages, their authors and attached files come together.
Request fields (body)
Pass one of the two fields.
| Field | Type | Required | Description |
|---|---|---|---|
FieldchatId |
Typenumber | string | Requiredno | DescriptionOpen Channel chat identifier: the number 2043 or the string chat2043. Source: sessions[].chatId in the POST /v1/openlines/sessions/search response, chatId from GET /v1/openlines/crm/chats, or from a bot event |
FielddialogId |
Typestring | Requiredno | DescriptionThe same chat, only in the chat2043 form. A number in this field is rejected with 400 MISSING_PARAMS |
The only input is the chat identifier. From it, the platform takes the latest session of that chat — that is, the conversation of the current dialog. The identifier of a specific past session is not accepted as input.
The method has no pagination: the conversation is returned in full in one response. To read chat messages page by page, use GET /v1/chats/:dialogId/messages.
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/sessions/history" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "chatId": 2043 }'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/sessions/history" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "chatId": 2043 }'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/sessions/history', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ chatId: 2043 }),
})
const { data } = await res.json()
for (const message of data.messages) {
console.log(message.date, message.senderId, message.text)
}
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/sessions/history', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ chatId: 2043 }),
})
const { data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on a successful request |
Fielddata.sessionId |
Typenumber | DescriptionIdentifier of the session the conversation belongs to. Session metrics — POST /v1/openlines/sessions/stats |
Fielddata.chatId |
Typenumber | DescriptionChat identifier |
Fielddata.messages |
Typeobject[] | DescriptionSession messages in ascending id order |
Fielddata.messages[].id |
Typenumber | DescriptionMessage identifier |
Fielddata.messages[].chatId |
Typenumber | DescriptionChat identifier |
Fielddata.messages[].senderId |
Typenumber | DescriptionMessage author, 0 for a system message. Author data is the data.users[] element with the same id |
Fielddata.messages[].recipientId |
Typestring | DescriptionRecipient — the chat in the chat<N> form |
Fielddata.messages[].date |
Typestring | DescriptionSend date, ISO 8601 |
Fielddata.messages[].text |
Typestring | DescriptionMessage text with BB-code markup |
Fielddata.messages[].textLegacy |
Typestring | DescriptionThe same text with HTML markup |
Fielddata.messages[].params |
Typeobject | array | null | DescriptionAdditional message parameters. The container is filled by the connector, and its contents are passed through as is, unchanged. It may carry the contact and CRM data of the person who wrote in. A message without parameters carries an empty array [] |
Fielddata.users |
Typeobject[] | DescriptionMessage authors, except system ones |
Fielddata.users[].id |
Typenumber | DescriptionUser identifier |
Fielddata.users[].name |
Typestring | DescriptionDisplay name |
Fielddata.users[].firstName |
Typestring | DescriptionFirst name |
Fielddata.users[].lastName |
Typestring | DescriptionLast name |
Fielddata.users[].workPosition |
Typestring | null | DescriptionJob title |
Fielddata.users[].avatar |
Typestring | DescriptionAvatar image URL |
Fielddata.users[].gender |
Typestring | DescriptionGender: M or F |
Fielddata.users[].extranet |
Typeboolean | DescriptionExternal user flag |
Fielddata.users[].connector |
Typeboolean | Descriptiontrue for a client who came through a connector |
Fielddata.users[].type |
Typestring | DescriptionUser type, for example user for an employee and extranet for a client |
Fielddata.files |
Typeobject[] | DescriptionFiles attached to messages |
Fielddata.files[].id |
Typenumber | DescriptionFile identifier |
Fielddata.files[].chatId |
Typenumber | DescriptionChat identifier |
Fielddata.files[].date |
Typestring | DescriptionUpload date, ISO 8601 |
Fielddata.files[].type |
Typestring | DescriptionFile type, for example image |
Fielddata.files[].name |
Typestring | DescriptionFile name |
Fielddata.files[].extension |
Typestring | DescriptionFile extension |
Fielddata.files[].size |
Typenumber | DescriptionSize in bytes |
Fielddata.files[].status |
Typestring | DescriptionUpload status, done for an uploaded file |
Fielddata.files[].authorId |
Typenumber | DescriptionIdentifier of the file author |
Fielddata.files[].authorName |
Typestring | DescriptionAuthor name |
Fielddata.files[].isVoiceNote |
Typeboolean | DescriptionVoice message |
Fielddata.files[].isVideoNote |
Typeboolean | DescriptionVideo message |
Fielddata.files[].isTranscribable |
Typeboolean | DescriptionWhether a transcript is available |
Fielddata.files[].urlPreview |
Typestring | DescriptionLink to the thumbnail |
Fielddata.files[].urlShow |
Typestring | DescriptionLink for viewing |
Fielddata.files[].urlDownload |
Typestring | DescriptionDownload link |
Fielddata.chats |
Typeobject[] | DescriptionChat metadata |
Fielddata.chats[].id |
Typenumber | DescriptionChat identifier |
Fielddata.chats[].dialogId |
Typestring | DescriptionDialog identifier in the chat<N> form |
Fielddata.chats[].name |
Typestring | DescriptionChat name |
Fielddata.chats[].type |
Typestring | DescriptionChat type, lines for an Open Channel |
Fielddata.chats[].entityType |
Typestring | DescriptionChat entity type, LINES for an Open Channel |
Fielddata.chats[].messageCount |
Typenumber | DescriptionNumber of messages in the chat across all sessions |
Fielddata.chats[].dateCreate |
Typestring | DescriptionChat creation date, ISO 8601 |
Fielddata.usersMessage |
Typeobject | DescriptionA map: dialog identifier chat<N> → session message identifiers as strings |
Response example
{
"success": true,
"data": {
"sessionId": 607,
"chatId": 2043,
"messages": [
{
"id": 88101,
"chatId": 2043,
"senderId": 0,
"recipientId": "chat2043",
"date": "2026-08-14T10:12:30+00:00",
"text": "The request was sent to all queue members",
"textLegacy": "The request was sent to all queue members",
"params": []
},
{
"id": 88103,
"chatId": 2043,
"senderId": 1211,
"recipientId": "chat2043",
"date": "2026-08-14T10:12:33+00:00",
"text": "Hello, my invoice is not arriving",
"textLegacy": "Hello, my invoice is not arriving",
"params": { "connectorMid": ["88099"] }
},
{
"id": 88107,
"chatId": 2043,
"senderId": 13,
"recipientId": "chat2043",
"date": "2026-08-14T10:13:05+00:00",
"text": "[b]Good afternoon![/b] Checking the invoice",
"textLegacy": "<b>Good afternoon!</b> Checking the invoice",
"params": { "connectorMid": ["88109"] }
}
],
"users": [
{
"id": 13,
"name": "Jane Miller",
"firstName": "Jane",
"lastName": "Miller",
"workPosition": "Operator",
"avatar": "/bitrix/js/im/images/blank.gif",
"gender": "F",
"extranet": false,
"connector": false,
"type": "user"
},
{
"id": 1211,
"name": "Guest",
"firstName": "Guest",
"lastName": "",
"workPosition": null,
"avatar": "/bitrix/js/im/images/blank.gif",
"gender": "M",
"extranet": true,
"connector": true,
"type": "extranet"
}
],
"files": [],
"chats": [
{
"id": 2043,
"dialogId": "chat2043",
"name": "Guest - Open Channel",
"type": "lines",
"entityType": "LINES",
"messageCount": 36,
"dateCreate": "2026-08-14T10:12:30+00:00"
}
],
"usersMessage": { "chat2043": ["88107", "88103", "88101"] }
}
}
Error response example
422 — the session cannot be determined from the chat: the chat does not exist or does not belong to an Open Channel:
{
"success": false,
"error": {
"code": "BITRIX_ERROR",
"message": "Unable to determine session ID from provided parameters",
"b24Code": "INVALID_SESSION_ID"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeMISSING_PARAMS |
DescriptionNeither chatId nor dialogId was passed. A body with only sessionId gets the same response |
| HTTP400 | CodeMISSING_PARAMS |
DescriptionThe value is invalid: chatId is neither a positive integer nor a chat<N> string, dialogId is not in the chat<N> form |
| HTTP400 | CodeINVALID_PARAMS |
DescriptionThe request body is not a JSON object |
| HTTP400 | CodeINVALID_JSON_BODY |
DescriptionThe request body did not parse as JSON |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no configured Bitrix24 tokens |
| HTTP403 | CodeOPENLINES_HISTORY_DISABLED |
DescriptionThe capability is not enabled on the Vibecode platform yet |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key has no imopenlines scope |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionThe key's user has no access to this dialog |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionBitrix24 returned an empty result instead of the session history |
| HTTP422 | CodeBITRIX_ERROR |
Descriptionerror.b24Code equals INVALID_SESSION_ID: there is no chat with this identifier, or it does not belong to an Open Channel |
| HTTP429 | CodeRATE_LIMITED |
DescriptionThe method's own limit was exceeded: the platform ceiling of 120 requests per minute applies per Bitrix24 account, not per key, and is split across replicas. The effective value comes in the x-ratelimit-limit header |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 returned a response of an unexpected shape |
Full list of common API errors — Errors.