Skip to main content
Every connection to a voice agent is recorded as a session. The Sessions API lists past sessions, retrieves any one with its recording and full conversation timeline, and deletes them. It is what you build a call-history view, transcript review, QA workflow, or usage dashboard on. Send your API key in the Authorization header (a Bearer prefix is accepted and stripped). The base URL is https://agents.assemblyai.com. For the field-level schema of each endpoint, see the Sessions API reference.

Find completed sessions

Poll GET /v1/sessions and process the ones whose status is completed, fetching each and downloading its artifacts. Keep the last session_id you handled (or the newest created_at) so each poll only picks up new sessions. You also know a session’s session_id the moment it connects, since it arrives over the WebSocket in session.ready. Store it live and pull the recording and transcript once the session ends.

List sessions

GET /v1/sessions returns a page of sessions, newest first, without artifacts. Narrow the results with status and agent_id, size the page with limit (1 to 200, default 50), and page forward with cursor.
To pull the full history, keep passing next_cursor back as cursor until has_more is false:

Retrieve a session

GET /v1/sessions/{id} returns the full session. On top of the list metadata it adds two things: config, the session’s configuration as it ran (system prompt, input/output, tools, LLM), and artifacts, each a short-lived pre-signed download URL.
The three artifacts appear once the session completes; the array is empty while it is still active. They are the audio recording (OGG/Opus), the timeline (the conversation as JSON), and metadata (recording details). Download each straight from its url with no Authorization header, since the signature already authorizes the request.
Artifact URLs expire after a short TTL. Store the session_id, not the URL, and re-fetch the session for fresh links right before you download.

Parse the conversation timeline

The timeline artifact is the whole conversation, turn by turn:
Each turn pairs what the user said (user_transcript, null on agent-initiated turns like the greeting) with what the agent replied (agent_text), and carries a tool_calls array only on turns where a tool actually fired. turn_id is the model response ID and status is the turn outcome (completed or interrupted). Timestamps ending _at_ms are absolute Unix epoch milliseconds; durations ending _ms (like time_to_first_audio_ms and duration_ms) are relative spans. A turn can also have no user_transcript and no agent_text: an interruption before the agent spoke, or a brief noise that opened a turn without a resolved transcript. Skip those when you build a transcript rather than assuming every turn has text (the code below does).
Empty arrays are dropped from the JSON: a session where no one spoke has no turns key at all, and a turn with no tools has no tool_calls. Default them when you read: timeline.get("turns", []) in Python, timeline.turns ?? [] in JS.
To render or store the conversation, download the timeline and flatten its turns into an ordered list of messages:

Work with the recording

The audio artifact is an OGG/Opus file; the metadata artifact describes it:
The recording is stereo with the user on the left channel and the agent on the right, so you can split channels for diarized playback or per-speaker analysis. To save it locally:
To play it back in your app, keep the API key server-side: expose a small endpoint that returns a fresh audio URL, then point an <audio> element at it.
OGG/Opus plays natively in Chrome, Firefox, and Edge; Safari support is limited. To support Safari, transcode server-side first, for example ffmpeg -i recording.ogg recording.m4a.

Delete a session

DELETE /v1/sessions/{id} soft-deletes a session and returns 204. It stops appearing in GET /v1/sessions and its artifacts become inaccessible.
cURL