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
PollGET /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. The list is scoped to the project that owns your API key, not your whole account. To list sessions from another project, use an API key from that project. Narrow the results with status and agent_id, size the page with limit (1 to 200, default 50), and page forward with cursor.
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.
url with no Authorization header, since the signature already authorizes the request.
Parse the conversation timeline
Thetimeline artifact is the whole conversation, turn by turn:
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.Work with the recording
Theaudio artifact is an OGG/Opus file; the metadata artifact describes it:
<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