how to set a maximum duration allowed for a room&g...
# ask-ai
g
how to set a maximum duration allowed for a room>?
t
Thanks for reaching out, Harsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — regarding setting a maximum duration for a room: LiveKit does not provide a built-in setting to enforce a fixed maximum room duration. Rooms close when the last participant leaves, and tokens/room config don’t include a time limit. You can enforce a duration from your application instead. Two common approaches: • Start a timer when the room is created or when the first participant joins, then call the server API to delete the room or disconnect participants when the timer expires. • Schedule a job (cron/task queue) that checks room creation times (via your records or the Analytics API
createdAt
) and deletes rooms that exceed the allowed duration using the
DeleteRoom
server API. Note: LiveKit does have egress time limits for recording/streaming (e.g., HLS/RTMP/file outputs), but those limits apply to egress only, not room lifetime. For details on quotas and analytics, see the docs: Quotas and limits and Analytics API. Would you like an example flow or code snippet for starting the timer and calling DeleteRoom? Sources: Quotas and limits | LiveKit docs | Analytics API | LiveKit docs