brave-author-62043
03/14/2026, 11:40 AMtall-airline-16756
03/14/2026, 11:40 AMtall-airline-16756
03/14/2026, 11:40 AMroom_finished webhook event.
LiveKit does not include a separate "duration" field in the room_finished payload. The event contains started_at and ended_at timestamps (Unix timestamps in nanoseconds). Compute duration by subtracting and converting nanoseconds to seconds.
Example payload:
{
"event": "room_finished",
"room": {
"sid": "RM_123",
"name": "my-room",
"started_at": 1732135319356232400,
"ended_at": 1732135407895558000
}
}
Calculation (pseudo-code):
duration_seconds = (ended_at - started_at) / 1e9
Notes:
• The timestamps are in nanoseconds, so divide by 1e9 to get seconds.
• If you need milliseconds, divide by 1e6 instead.
• If your language/framework uses integer types, ensure you convert to a float or use integer arithmetic carefully to avoid truncation.
If you’d like, tell me which language or runtime you’re using (Node, Python, Go, Ruby, etc.) and I’ll provide a short code snippet you can drop into your webhook handler.
Sources: Avoiding Room ID Reuse When Re-Creating Rooms With the Same Name | server-sdk-go | livekit/livekit_composite | DeepWiki | server-sdk-ruby | livekit/livekit_composite | DeepWiki | server-sdk-js | livekit/livekit_composite | DeepWiki