Skip to main content

Monitoring & Trends API

GET /api/monitor/sessions

List recent chat sessions for the analyst monitoring dashboard.

Auth: Required

Query Parameters:

ParameterTypeDefaultDescription
sincestring (ISO date)30 minutes agoOnly return sessions active after this timestamp
limitnumber20Number of sessions to return (1–100)
cursorstringCursor for pagination (session ID to start after)

Success Response (200):

{
"sessions": [
{
"id": "clxxsession1",
"createdAt": "2026-04-08T12:00:00.000Z",
"lastActivityAt": "2026-04-08T12:05:00.000Z",
"endedAt": null,
"endedReason": null,
"messageCount": 6,
"lastMessage": "We offer several data plans starting from..."
},
{
"id": "clxxsession2",
"createdAt": "2026-04-08T11:50:00.000Z",
"lastActivityAt": "2026-04-08T11:55:00.000Z",
"endedAt": "2026-04-08T11:55:30.000Z",
"endedReason": "violation",
"messageCount": 4,
"lastMessage": "Live agent required..."
}
],
"nextCursor": "clxxsession3"
}

Fields:

FieldDescription
endedAtnull if session is still active
endedReason"user" (normal end), "violation" (auto-ended), or null (active)
messageCountTotal messages in the session
lastMessageTruncated preview of the last message content
nextCursorPass as cursor in next request for pagination

Error Responses:

StatusCause
401Not authenticated

GET /api/trends

Fetch aggregate analytics data for the trends dashboard.

Auth: Required

Query Parameters:

ParameterTypeDefaultDescription
daysnumber30Number of days to analyze (1–365)

Success Response (200):

{
"dailyData": [
{
"date": "2026-04-08",
"uploadCount": 5,
"totalIssues": 12,
"hallucinationRate": 0.15,
"biasRate": 0.08,
"toxicityRate": 0.03,
"hallucinationFlagged": 3,
"biasFlagged": 2,
"toxicityFlagged": 1
}
],
"subtypeBreakdown": {
"hallucination": {
"SELF_CONTRADICTION": 5,
"OVERCONFIDENCE": 3,
"FABRICATED_CITATION": 8,
"HARDCODED_FACT": 2
},
"bias": {
"GENDER_BIAS": 4,
"RACIAL_BIAS": 1,
"AGE_BIAS": 2,
"STEREOTYPING": 3
},
"toxicity": {
"HOSTILE_LANGUAGE": 1,
"CONDESCENSION": 3,
"INAPPROPRIATE_CONTENT": 0,
"PROFANITY": 1
}
},
"totals": {
"uploads": 42,
"issues": 120,
"hallucinationRate": 0.12,
"biasRate": 0.06,
"toxicityRate": 0.02,
"priorPeriod": {
"uploads": 38,
"issues": 95,
"hallucinationRate": 0.14,
"biasRate": 0.07,
"toxicityRate": 0.03
}
}
}

Fields:

FieldDescription
dailyDataArray of daily buckets with counts and rates
subtypeBreakdownAggregate counts by issue subtype across the entire period
totalsPeriod totals and rates
totals.priorPeriodSame metrics for the preceding period (for comparison)

Notes:

  • Rates are calculated as (flagged turns / total turns analyzed)
  • Includes both file uploads and chat-sourced analyses
  • priorPeriod covers the same number of days immediately before the selected range

Error Responses:

StatusCause
400days parameter out of range (1–365)
401Not authenticated