To end the current session for all participants, remove all participants using kickAll(). This stops any ongoing recording for that session and sets the session status to ENDED.
Ending a session is different from leaving a meeting. Leaving disconnects only the current participant. The session remains active if other participants are still present.
-
Check that the local participant has permission to remove participants.
-
End the session by removing all participants.
-
Listen for the session end event.
You can also end a session from your backend by removing all participants using the Kick all participants API.
Use the Kick all participants API method to remove all participants from an active session for a meeting.
Required API token permissions
At least one of the following token permissions is required:Realtime AdminRealtime
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/realtime/kit/$APP_ID/meetings/$MEETING_ID/active-session/kick-all" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"Register a webhook that subscribes to meeting.ended. RealtimeKit sends this event when the session ends.
You can use it to trigger backend workflows, such as sending a notification, generating a report, or updating session records in your database.
Required API token permissions
At least one of the following token permissions is required:Realtime AdminRealtime
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/realtime/kit/$APP_ID/webhooks" \
--request POST \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"name": "Session ended webhook",
"url": "<YOUR_WEBHOOK_URL>",
"events": [
"meeting.ended"
]
}'Ending a session does not disable the meeting. Participants can join the meeting again and start a new session.
To prevent participants from joining again and starting a new session, set the meeting status to INACTIVE using the Update a meeting API. If the meeting has an active session, RealtimeKit also removes all participants from it.
Required API token permissions
At least one of the following token permissions is required:Realtime AdminRealtime
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/realtime/kit/$APP_ID/meetings/$MEETING_ID" \
--request PATCH \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"status": "INACTIVE"
}'- Review how presets control permissions in Preset.
- Review the possible values of the local participant room state in Local Participant.