API · Sessions
The call record
One record of every finished call, in a fixed shape: on your webhook as soon as the call is over, or on demand. Use your own ids to match it to your user and your session.
Sent to your webhook after every call
Pick one of your webhook destinations (GET /v1/notifications/destinations; it must use POST) and switch the record on for an agent. {"call_record": {"destination_id": null}} turns it off.
curl -X PATCH https://talk.selviaai.com/v1/agent/7 \
-H "Authorization: Bearer $SELVIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"call_record": {"destination_id": 12, "include": ["summary", "transcript"]}}'The record goes out once per call, as soon as the transcript is written (usually seconds after the call ends). It is signed and retried exactly like a data handoff (X-Selvia-Signature), and the webhook's delivery log in the console lists it as “Call record”.
include with transcript is done through the API.Fetch it
/v1/sessions/{session_id}/recordThe same record for any finished session of yours. include is summary,transcript by default; leave it empty for neither. While the session is still running the answer is 409 session_live.
curl "https://talk.selviaai.com/v1/sessions/SESSION_ID/record?include=summary,transcript" \
-H "Authorization: Bearer $SELVIA_API_KEY"What it holds
call.ended
{
"type": "call.ended",
"session_id": "1d232153-1857-4b3a-9b9e-658fe81cc0cb",
"agent_id": 7,
"mode": "conversation",
"source": "api",
"external_user_id": "u_88",
"external_session_id": "cart_551",
"external_user_id_verified": true,
"external_session_id_verified": true,
"started_at": "2026-11-26T01:11:33+00:00",
"ended_at": "2026-11-26T01:16:45+00:00",
"duration_seconds": 312,
"end_reason": "viewer_closed",
"visitor_turns": 6,
"summary": "Asked about delivery times to Milan and chose express shipping.",
"transcript": [
{ "role": "agent", "text": "Hi, welcome back! How can I help?", "timestamp": "2026-11-26T01:11:40" },
{ "role": "visitor", "text": "How fast can you ship to Milan?", "timestamp": "2026-11-26T01:11:47" }
]
}| Field | Description |
|---|---|
session_id | The id POST /v1/sessions returned. Calls from the website widget have one too. |
external_user_id, external_session_id | Your own ids, when the session was started with them; otherwise null. |
…_verified | true when the id came with your key or a signed token. A web page can pass ids unsigned; anyone can set those in their own browser, so they come back false. |
duration_seconds, end_reason | How long the session ran, and why it ended (for example viewer_closed, api_stop). |
visitor_turns | How many times the visitor spoke. |
summary | Only with include summary. null when no summary was written for the call: one is written when the visitor spoke at least 3 times. |
transcript | Only with include transcript: every line, in order, with role visitor or agent. Empty for a render session, or a call where nobody spoke. |
Start the session with your ids
Pass external_user_id and external_session_id when you start a session, or from your website with the embed widget: SelviaAI.identify({ external_user_id: "u_88" }), or as claims of the signed token. Your data handoffs can send them too, as {{external_user_id}}, {{external_session_id}} and {{session_id}}.