Skip to main content

Open/closed sessions per interval

Overview

The open_closed_sessions_interval_counts_v2 function provides open and closed session counts grouped by time intervals. Use this endpoint to:

  • Track session lifecycle over time
  • Monitor open vs closed session ratios
  • Analyze workload distribution by period

Quick start

query OpenClosedSessionsInterval(
$deskIds: _uuid
$brainIds: _uuid
$integrationIds: _uuid
$brainVersions: _int4
$channels: _text
$startDate: timestamp
$endDate: timestamp
$intervalInDays: interval
$agentIds: _text
$isTest: Boolean
) {
rows: open_closed_sessions_interval_counts_v2(
args: {
start_time: $startDate
end_time: $endDate
interval_span: $intervalInDays
brain_parent_ids: $brainIds
desk_ids: $deskIds
integration_ids: $integrationIds
brain_versions: $brainVersions
channels: $channels
is_test: $isTest
agent_ids: $agentIds
}
) {
closed_sessions
open_sessions
date: per_interval
}
}

Variables:

{
"deskIds": "{d2be0283-9b53-4d7b-b77d-2650f3a1a99c}",
"startDate": "2024-01-08",
"endDate": "2024-01-17",
"intervalInDays": "1 day"
}

Try it

Loading GraphQL Playground...

Parameters

ParameterTypeDescription
deskIds_uuidFilter by desk IDs
brainIds_uuidFilter by AI agent IDs
integrationIds_uuidFilter by integration IDs
brainVersions_int4Filter by AI agent versions
channels_textFilter by channels
startDatetimestampStart date (format: yyyy-mm-dd)
endDatetimestampEnd date (format: yyyy-mm-dd)
intervalInDaysintervalTime interval (e.g., 1 day, 1 week)
agentIds_textFilter by human agent IDs
isTestBooleanExclude test sessions

Response fields

FieldTypeDescription
closed_sessionsIntNumber of closed sessions
open_sessionsIntNumber of open sessions
datetimestampStart of the interval period

Common use cases

Get daily open/closed sessions for a single desk:

{
"deskIds": "{d2be0283-9b53-4d7b-b77d-2650f3a1a99c}",
"startDate": "2024-01-08",
"endDate": "2024-01-17",
"intervalInDays": "1 day"
}

Example response

{
"data": {
"rows": [
{
"closed_sessions": 1000,
"open_sessions": 13,
"date": "2024-01-08T00:00:00"
},
{
"closed_sessions": 882,
"open_sessions": 11,
"date": "2024-01-09T00:00:00"
},
{
"closed_sessions": 1042,
"open_sessions": 72,
"date": "2024-01-10T00:00:00"
}
]
}
}