Para agentes de IA: markdown desta página — /docs-content-en/openlines/sessions.md índice da documentação — /llms.txt

Os artigos da documentação estão disponíveis atualmente em inglês.

Session list

The method ships in the imopenlines 26.700.0 update and is not yet available on all Bitrix24 accounts. If the update has not reached your Bitrix24 account yet, the API returns 422 METHOD_NOT_YET_AVAILABLE — this means the method has not been released on the account yet, not that the integration is broken.

POST /v1/openlines/sessions/search

A list of Open Channel sessions with filters and pagination — the main method for detailed reports and export to external analytics systems. An empty body {} returns the first page of all visible sessions.

Request fields (body)

Field Type Req. Description
configId number no Open Channel identifier. Source: GET /v1/openline-configs
configIdList number[] no List of Open Channels
operatorId number no Operator identifier. Source: GET /v1/users
operatorIdList number[] no List of operators
source string no Connector code
sourceList string[] no List of connector codes
status string no Session status: new / answered / closed / spam / paused
closeReason string no Close reason: operator / auto / spam / client / replyLimit
dateCreateFrom string no Start of the creation period, ISO 8601. The dateCreateFrom..dateCreateTo period must not exceed 1 year
dateCreateTo string no End of the creation period, ISO 8601
dateCloseFrom string no Start of the closing period, ISO 8601
dateCloseTo string no End of the closing period, ISO 8601
vote string no Customer rating: like / dislike / none / any
hasVoteHead boolean no Whether there is a supervisor rating. Accepts true/false and Y/N
kpiFirstAnswer boolean no Whether the first-answer SLA was met. Requires a bounded period (dateCreateFrom+dateCreateTo or dateCloseFrom+dateCloseTo)
hasCrm boolean no Whether there is a CRM binding
waitAnswerFrom number no Min. time to first answer, seconds
waitAnswerTo number no Max. time to first answer, seconds
waitCloseFrom number no Min. time to close, seconds
waitCloseTo number no Max. time to close, seconds
order string no Sort field: dateCreate / dateClose / waitAnswer / waitClose (default dateCreate)
orderDirection string no Direction: asc / desc (default desc)
limit number no Page size, 1..200 (default 50)
offset number no Pagination offset (default 0)

The status and closeReason filters are mutually exclusive: closeReason already implies a closed session. The hasVoteHead filter applies only to Open Channels where the user has the supervisor rating permission.

There is no filter by CRM entity type — for CRM only the boolean hasCrm is available (whether a binding exists). To narrow the result to a specific type, filter on your side by the crmEntityType / crmEntityId fields from the response.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/sessions/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": 3,
    "status": "closed",
    "dateCreateFrom": "2026-06-01T00:00:00+00:00",
    "dateCreateTo": "2026-06-30T23:59:59+00:00",
    "limit": 50
  }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/sessions/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": 3,
    "status": "closed",
    "dateCreateFrom": "2026-06-01T00:00:00+00:00",
    "dateCreateTo": "2026-06-30T23:59:59+00:00",
    "limit": 50
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/sessions/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    configId: 3,
    status: 'closed',
    dateCreateFrom: '2026-06-01T00:00:00+00:00',
    dateCreateTo: '2026-06-30T23:59:59+00:00',
    limit: 50,
  }),
})
const { data } = await res.json()

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/sessions/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    configId: 3,
    status: 'closed',
    dateCreateFrom: '2026-06-01T00:00:00+00:00',
    dateCreateTo: '2026-06-30T23:59:59+00:00',
    limit: 50,
  }),
})
const { data } = await res.json()

Response fields

The response is { "success": true, "data": { "sessions": [...], "hasNextPage": bool } }.

Key Description
sessions[].id Session identifier
sessions[].configId Open Channel identifier
sessions[].source Connector code
sessions[].operatorId Identifier of the operator who closed the session
sessions[].userId / userCode Customer: internal ID and external code
sessions[].chatId Identifier of the session's IM chat
sessions[].dateCreate / dateClose Session creation and close dates, ISO 8601
sessions[].dateFirstAnswer / dateOperatorAnswer The date of the first answer and the date the operator started working on the session — these are different points in time, ISO 8601
sessions[].status / closeReason Status and close reason
sessions[].vote Customer rating (like / dislike / none)
sessions[].voteHead / commentHead Supervisor rating and comment (null if the user lacks permission)
sessions[].crmEntityType / crmEntityId CRM binding (null if the user lacks read access to the related entity)
sessions[].queueTransfers Number of reassignments in the queue
sessions[].waitAnswer / waitClose Time to first answer and to close, seconds. These are independent stored metrics — do not compute them from the dates above, as the values may not match
sessions[].kpiFirstAnswer Whether the first-answer SLA was met
sessions[].messageCount Number of messages in the session
hasNextPage Whether there is a next page (a field of the data envelope, not of an element)

Response example

JSON
{
  "success": true,
  "data": {
    "sessions": [
      {
        "id": 1024,
        "configId": 3,
        "source": "livechat",
        "operatorId": 42,
        "userId": 501,
        "userCode": "site_visitor_88a1",
        "chatId": 2048,
        "dateCreate": "2026-06-15T14:30:00+00:00",
        "dateClose": "2026-06-15T14:52:10+00:00",
        "dateFirstAnswer": "2026-06-15T14:31:05+00:00",
        "dateOperatorAnswer": "2026-06-15T14:50:00+00:00",
        "status": "closed",
        "closeReason": "operator",
        "vote": "like",
        "voteHead": 5,
        "commentHead": "Great work",
        "crmEntityType": "deal",
        "crmEntityId": 771,
        "queueTransfers": 1,
        "waitAnswer": 65,
        "waitClose": 1330,
        "kpiFirstAnswer": true,
        "messageCount": 14
      }
    ],
    "hasNextPage": false
  }
}

Error response example

422 — the period limit is exceeded:

JSON
{
  "success": false,
  "error": { "code": "BITRIX_ERROR", "message": "The requested period exceeds the maximum of 1 year", "b24Code": "PERIOD_TOO_LARGE" }
}

Errors

HTTP Code When
403 B24_TARIFF_RESTRICTION The Bitrix24 plan does not include Open Channels statistics (report_open_lines)
400 INVALID_JSON_BODY The request body did not parse as JSON. The check runs before field validation, so the response says nothing about missing parameters
400 INVALID_PARAMS The request body is not an object
422 BITRIX_ERROR (error.b24Code: PERIOD_TOO_LARGE) The creation or closing period exceeds 1 year
422 BITRIX_ERROR (error.b24Code: OFFSET_TOO_LARGE) offset exceeds the maximum — narrow the period or filters
422 BITRIX_ERROR (error.b24Code: INVALID_FILTER) An invalid filter value, status and closeReason passed together, or kpiFirstAnswer without a bounded period
422 METHOD_NOT_YET_AVAILABLE The imopenlines 26.700.0 update has not reached the portal yet. The response contains an error.release field set to imopenlines 26.700.0

Pagination without page drift

The method is paged with offset/limit. For a paged export, fix the upper bound of the period — set dateCreateTo to the moment the export starts. Without a fixed bound, new sessions arriving during paging shift the pages, and records at the boundaries may be duplicated or lost.

The full list of system codes — API errors.

See also