I want to move my plan to scale to enable analytic...
# ask-ai
a
I want to move my plan to scale to enable analytics API, I want to know if this has analytics for only cloud livekit agents or we can grab analytics for self hosted livekit agents as well?
t
Thanks for reaching out, Binod. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’ll answer your question about Analytics on the Scale plan. • Upgrading to the Scale plan enables the Analytics API for your project and it collects session/participant metrics for all sessions in that project — whether agents are running on LiveKit Cloud or self-hosted, as long as those self-hosted agents are connected to the same LiveKit Cloud project. • The Analytics API returns real-time communication metrics (connection minutes, bandwidth, participant count, region, device/browser, etc.) and does not provide detailed agent observability events (transcripts, tool calls). • Agent observability (transcripts, traces, logs, recordings) is available for Cloud and for self-hosted agents if: ◦ Agent observability is enabled in project settings, and ◦ The agent uses the latest Agents SDK and sends observability data to LiveKit Cloud. • If you specifically need transcripts or tool-call detail, use the Agent Insights dashboard / export features rather than the Analytics API. Would you like help checking your project settings to confirm Agent observability is enabled or steps to configure a self-hosted agent to send observability data? Sources: Analytics API | LiveKit docs | Agent insights in LiveKit Cloud | LiveKit docs
a
I am interested in call history, call durations and call participants
t
Thanks — I’m responding to your interest in call history, call durations, and call participants on the Scale plan. • The Analytics API on the Scale plan provides call history and session-level data you can query by date range (paged results). • Call durations: ◦ Each session detail includes
startTime
and
endTime
(use those to compute session duration). ◦
connectionMinutes
gives billable connection time. ◦ Each participant entry includes
joinedAt
and
leftAt
for per-participant duration. • Call participants: ◦ Session details include a
participants
array with
participantIdentity
,
participantName
,
joinedAt
,
leftAt
, device/OS/browser,
publishedSources
, location/network info, and SIP metadata when applicable. ◦ The
List sessions
endpoint also returns
numParticipants
and
numActiveParticipants
. • SIP-specific info (call status, phone number, trunk ID) is available in participant attributes and SIP fields, and SIP lifecycle events (ringing → active → hangup) are tracked. If you’d like, I can: • Show the exact Analytics API endpoints and the minimal example queries to fetch call history for a date range, or • Help you confirm your project has Analytics enabled and show how to pull participant join/leave timestamps. Which would you prefer? Sources: Analytics API | LiveKit docs | Quotas and limits | LiveKit docs | SIP participant | LiveKit docs | SIP Lifecycle Management Agent | LiveKit docs
a
• Show the exact Analytics API endpoints and the minimal example queries to fetch call history for a date range, or
t
Thanks — I’ll show the exact Analytics API endpoints and minimal example queries to fetch call history for a date range and then how to get session (duration + participant) details. Authentication (token) 1. Create a token with the
roomList
grant (example Node.js):
Copy code
const at = new AccessToken(apiKey, apiSecret, { ttl: 60*60*24 });
at.addGrant({ roomList: true });
const token = at.toJwt();
Or use the CLI:
Copy code
lk token create --api-key $LIVEKIT_API_KEY --api-secret $LIVEKIT_SECRET_KEY --list --valid-for 24h
List sessions (call history) for a date range • Endpoint: GET https://cloud-api.livekit.io/api/project/{projectId}/sessions • Required query params: ◦
start
(YYYY-MM-DD) ◦
end
(YYYY-MM-DD) ◦
limit
(page size) ◦
page
(0-based) • Minimal curl example:
Copy code
curl -H "Authorization: Bearer $TOKEN" \
"<https://cloud-api.livekit.io/api/project/p_abc123/sessions?start=2024-01-12&end=2024-01-13&page=0&limit=100>"
Response items include
sessionId
,
roomName
, `createdAt`/`endedAt`,
numParticipants
, `bandwidthIn`/`bandwidthOut`, etc. Get detailed session info (durations & participants) • Endpoint: GET https://cloud-api.livekit.io/api/project/{projectId}/sessions/{sessionId} • Minimal curl example:
Copy code
curl -H "Authorization: Bearer $TOKEN" \
"<https://cloud-api.livekit.io/api/project/p_abc123/sessions/sess_xyz789>"
Important fields in the response: •
startTime
,
endTime
→ compute session duration •
connectionMinutes
→ billable connection time •
participants[]
entries with
participantIdentity
,
participantName
,
joinedAt
,
leftAt
, device/os/browser,
publishedSources
, location/network, and SIP metadata when present Notes & tips • The Analytics API is available only on the Scale plan or higher. • Query results are paged with
limit
and
page
. • For per-participant duration, use each participant’s `joinedAt`/`leftAt`. • SIP-specific fields (call status, phoneNumber, trunkID) appear in participant attributes for SIP sessions. Would you like a ready-to-run script (curl or Node.js) that lists sessions for a date range and then fetches details for each session? Sources: Analytics API | LiveKit docs