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.
Web Mobile
React Web Components Angular
Check that the local participant has permission to remove participants.
const canEndSession = meeting . self . permissions . kickParticipant === true ;
// Disable the "End meeting/session" control in your UI.
// You can also show a message to explain why the action is not available.
const canEndSession = meeting . self . permissions . kickParticipant === true ;
// Disable the "End meeting/session" control in your UI.
// You can also show a message to explain why the action is not available.
const canEndSession = meeting . self . permissions . kickParticipant === true ;
// Disable the "End meeting/session" control in your UI.
// You can also show a message to explain why the action is not available.
val canEndSession = meeting.localUser.permissions.host.canKickParticipant
// Disable the "End meeting/session" control in your UI.
// You can also show a message to explain why the action is not available.
let canEndSession = meeting. localUser . permissions . host . canKickParticipant
// Disable the "End meeting/session" control in your UI.
// You can also show a message to explain why the action is not available.
final canEndSession = meeting . localUser . permissions . host . canKickParticipant ;
// Disable the "End meeting/session" control in your UI.
// You can also show a message to explain why the action is not available.
const canEndSession = meeting . self . permissions . kickParticipant === true ;
// Disable the "End meeting/session" control in your UI.
// You can also show a message to explain why the action is not available.
End the session by removing all participants.
If the participant does not have the required permission, kickAll() throws a ClientError with error code 1201.
await meeting . participants . kickAll () ;
if ( err ?. code === 1201 ) {
// The participant does not have permission to end the session.
// Update your UI to indicate that the action is not allowed.
If the participant does not have the required permission, kickAll() throws a ClientError with error code 1201.
await meeting . participants . kickAll () ;
if ( err ?. code === 1201 ) {
// The participant does not have permission to end the session.
// Update your UI to indicate that the action is not allowed.
If the participant does not have the required permission, kickAll() throws a ClientError with error code 1201.
await meeting . participants . kickAll () ;
if ( err ?. code === 1201 ) {
// The participant does not have permission to end the session.
// Update your UI to indicate that the action is not allowed.
If the participant does not have the required permission, kickAll() returns a HostError.
val error: HostError ? = meeting.participants. kickAll ()
is HostError.KickPermissionDenied -> {
// The participant does not have permission to end the session.
// Update your UI to indicate that the action is not allowed.
// Successfully initiated session end
If the participant does not have the required permission, kickAll() returns a HostError.
let error: HostError ? = meeting. participants . kickAll ()
case . kickPermissionDenied :
// The participant does not have permission to end the session.
// Update your UI to indicate that the action is not allowed.
// Successfully initiated session end
meeting . participants . kickAll (onResult : (error) {
// The participant does not have permission to end the session.
// Update your UI to indicate that the action is not allowed.
// Successfully initiated session end
If the participant does not have the required permission, kickAll() throws a ClientError with error code 1201.
await meeting . participants . kickAll () ;
if ( err ?. code === 1201 ) {
// The participant does not have permission to end the session.
// Update your UI to indicate that the action is not allowed.
Listen for the session end event.
When the session ends, all participants leave the session. The SDK emits a roomLeft event with state set to ended.
meeting . self . on ( "roomLeft" , ({ state }) => {
// Update your UI to show that the meeting session has ended.
When the session ends, all participants leave the session. The SDK emits a roomLeft event with state set to ended.
meeting . self . on ( "roomLeft" , ({ state }) => {
// Update your UI to show that the meeting session has ended.
When the session ends, all participants leave the session. The SDK emits a roomLeft event with state set to ended.
meeting . self . on ( "roomLeft" , ({ state }) => {
// Update your UI to show that the meeting session has ended.
When the session ends, all participants leave the session. You can subscribe to the event listeners to handle the session end.
meeting. addMeetingRoomEventListener ( object : RtkMeetingRoomEventListener {
override fun onMeetingEnded () {
// Update your UI to show that the meeting session has ended.
When the session ends, all participants leave the session. You can subscribe to the event listeners to handle the session end.
// Implement the delegate method
extension MeetingViewModel : RtkMeetingRoomEventListener {
// Update your UI to show that the meeting session has ended.
meeting. addMeetingRoomEventListener ( self )
When the session ends, all participants leave the session. You can subscribe to the event listeners to handle the session end.
class MeetingRoomListener extends RtkMeetingRoomEventListener {
// Update your UI to show that the meeting session has ended.
meeting . addMeetingRoomEventListener ( MeetingRoomListener ()) ;
When the session ends, all participants leave the session. The SDK emits a roomLeft event with state set to ended.
meeting . self . on ( "roomLeft" , ({ state }) => {
// Update your UI to show that the meeting session has ended.
You can also end a session from your backend by removing all participants using the Kick all participants API.
End a session from your backend
Remove all participants with the 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:
curl "https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /realtime/kit/ $APP_ID /meetings/ $MEETING_ID /active-session/kick-all" \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN "
Listen for session end events with webhooks
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:
curl "https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /realtime/kit/ $APP_ID /webhooks" \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
"name": "Session ended webhook",
"url": "<YOUR_WEBHOOK_URL>",
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.
Required API token permissions
At least one of the following token permissions
is required:
curl "https://api.cloudflare.com/client/v4/accounts/ $ACCOUNT_ID /realtime/kit/ $APP_ID /meetings/ $MEETING_ID " \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN " \
Review how presets control permissions in Preset .
Review the possible values of the local participant room state in Local Participant .