List sessions
AgentSessionSummary objects plus aggregate totals. Filter by character to get the session history of a specific AI character.
| Auth | JWT bearer or X-API-Key (see API Keys) |
| Scoping | Staff see all sessions. All other callers see only sessions for AI characters they created — results are auto-filtered, no extra params needed. |
| Pagination | Page-based, default 50 / page, max 200 |
Query parameters
| Param | Type | Description |
|---|---|---|
character_slug | string | Filter by character. Returns only sessions for this agent slug. |
tenant_id | string | Filter by tenant. |
start | ISO datetime | Lower bound on created_at (inclusive). |
end | ISO datetime | Upper bound on created_at (inclusive). |
page | int | 1-based page number (default 1). |
page_size | int | Results per page (default 50, max 200). |
Examples
Response
Wrapped in the standard envelope ({ success, message, data, errors }). The data field contains:
Aggregate totals
The top-level fields reflect the filtered queryset — totals for sessions matching yourcharacter_slug / date range, not the whole tenant.
| Field | Meaning |
|---|---|
total_sessions | Count of matching sessions |
total_llm_input_tokens / total_llm_output_tokens | Sum across all matching sessions |
total_stt_audio_seconds | Total seconds of audio transcribed |
total_tts_characters | Total characters spoken by the agent |
total_estimated_cost_usd | Sum of estimated_cost_usd |
Per-session fields
Each entry insessions.data is a full AgentSessionSummary — same shape as Chat History. That means you get the transcript inline for every session in the list, no follow-up calls needed.
Notable fields for character history:
| Field | Use |
|---|---|
session_id | Unique ID; pass to chat-history endpoint for a single-session view |
created_at | When the session started |
finalized_at | When it ended (null for in-progress) |
session_duration_seconds | Length of the call |
turn_count | Conversation depth |
transcript / transcript_text | Full conversation, inline |
metadata | The metadata you passed at session start |
origin_url | Page the call came from |
recording_presigned_url | Time-limited URL to play the audio recording |
Pagination
sessions.pagination.next and previous are absolute URLs you can fetch directly. count is the total before pagination.
Errors
| Status | Cause |
|---|---|
401 Unauthorized | Missing / expired JWT, or invalid / inactive X-API-Key |
400 Bad Request | Malformed start / end datetime |
403 here. If you filter by a character_slug you don’t own, the response is a 200 with an empty sessions.data array — the scoping is enforced silently at the queryset level.
Common patterns
Daily report for one character
Compare characters
Sync new sessions hourly into your DB
Related
- Single session detail / transcript → Chat History
- Starting new sessions → Sessions
- Form submissions per session → Form Responses
