Remove Participants from a Room

To remove a Participant from a Room, you must initialize a RoomServiceClient, then call its RemoveParticipant method. Expiring a Participant's token will not remove them from a Room.

Initialize RoomServiceClient

Participant management is done with a RoomServiceClient, created like so:

import (
lksdk ""
livekit ""
// ...
host := ""
roomClient := lksdk.NewRoomServiceClient(host, "api-key", "secret-key")

Remove a Participant

RemoteParticipant will forcibly disconnect the participant from the room. However, this action doesn't invalidate the participant's token.

To prevent the participant from rejoining the same room, consider the following measures:

  • Generate access tokens with a short TTL (Time-To-Live).
  • Refrain from providing a new token to the same participant via your application's backend.
res, err := roomClient.RemoveParticipant(context.Background(), &livekit.RoomParticipantIdentity{
Room: roomName,
Identity: identity,

FAQ: Why can’t I just expire the Participant's token?

A common mistake is to assume that expiring a Participant's token will remove them from a Room. This is not the case. The Participant's token is like a passcode that allows their client to connect to the Room. Once the Participant has connected to the Room, the token is no longer used.

(There is one case where tokens are re-used, and that is reconnection: if the client disconnects, it can reconnect with the same token if that token has not yet expired. This is why, if your application requires you to be able to force-remove a Participant from a Room, you should generate access tokens with a short TTL.)