## Session list

> ⚠️ **The method ships in update `imopenlines 26.700.0` and is not yet available on all Bitrix24 portals.** If the update has not reached your portal yet, the API returns `422 METHOD_NOT_YET_AVAILABLE` — this means the method has not been released on the portal yet, not that the integration is broken.

`POST /v1/openlines/sessions/search`

A list of Open Channels 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 | Line identifier. Source: [`GET /v1/openline-configs`](/docs/openlines/config/list) |
| `configIdList` | number[] | no | List of lines |
| `operatorId` | number | no | Operator identifier. Source: [`GET /v1/users`](/docs/entities/users) |
| `operatorIdList` | number[] | no | List of operators |
| `source` | string | no | Channel code (connector id) |
| `sourceList` | string[] | no | List of channel 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 close period, ISO 8601 |
| `dateCloseTo` | string | no | End of the close 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 lines where the user has the right to the supervisor rating.

There is no filter by CRM entity type — for CRM only the boolean `hasCrm` is available (a binding exists or not). If you need to select a specific type, filter on your side by the `crmEntityType` / `crmEntityId` fields from the response.

## Examples

### curl — personal key

```bash
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

```bash
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` | Line identifier |
| `sessions[].source` | Channel code |
| `sessions[].operatorId` | Identifier of the operator who closed the session |
| `sessions[].userId` / `userCode` | Customer: internal id and external code |
| `sessions[].chatId` | IM chat identifier of the session |
| `sessions[].dateCreate` / `dateClose` | Session creation and close, ISO 8601 |
| `sessions[].dateFirstAnswer` / `dateOperatorAnswer` | The date of the first answer and the date the operator started working on the session — these are different moments, 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 no right) |
| `sessions[].crmEntityType` / `crmEntityId` | CRM binding (`null` if no read right for 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, 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 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 tariff does not include Open Channels statistics (`report_open_lines`) |
| 400 | `INVALID_PARAMS` | The request body is not an object |
| 422 | `BITRIX_ERROR` (`error.b24Code: PERIOD_TOO_LARGE`) | The creation/close 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 |

## 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](/docs/errors).

## See also

- [Per-session metrics](/docs/openlines/sessions/stats)
- [Reassignment history](/docs/openlines/sessions/transfers)
- [Open Channels statistics](/docs/openlines)
