100ms Logo

100ms

Docs

Search docs
/

Remove peers

You can use this API to remove/disconnect a connected peer from an active room. 100ms provides options to disconnect a peer either with their peer_id or role.

  1. If peer_id is specified -- respective connected peer will be disconnected from the active room.
  2. If the role is specified -- all the connected peers assigned with that particular role will be disconnected from the active room.
  3. If both peer_id and role are specified -- preference will be given to the peer_id and the respective peer will be disconnected from the active room.
  4. If both peer_id and role are not specified -- you must specify peer_id or role for this request.
POSThttps://api.100ms.live/v2/active-rooms/<room_id>/remove-peers
curl --location --request POST 'https://api.100ms.live/v2/active-rooms/<room_id>/remove-peers' \ --header 'Authorization: Bearer <management_token>' \ --header 'Content-Type: application/json' \ --data-raw '{ "peer_id": "fd9e87d8-5c7b-4750-932f-d8d2ff18b70b", "role": "host", "reason": "" }'
RESPONSE
Status: 200 OK
{ "message": "peer remove request submitted" }

Arguments

NameTypeDescriptionRequired
room_id
— path param
stringUnique identifier of the room to which the peer is connected.

Example: 627cda81ab4f3b56a077dc33
Yes
peer_id
— body param
stringUnique identifier of the connected peer/participant you wish to remove from the active room.

Example: fd9e87d8-5c7b-4750-932f-d8d2ff18b70b
Conditional
role
— body param
stringYou can use this to remove a list of connected peers with the specified role type from the active room.Conditional
reason
— body param
stringYou can specify the message to be passed to other connected peers in the active room.No

Note: Conditional Arguments

You should define either of these arguments (peer_id or role) in the payload for the request to be successful.

Why would you use this API?

  • Use this API to remove a peer from an active room for misconduct (e.g., abusive chat). This can be combined with custom logic not to generate app tokens for this user to block them from future joins.


Run in postman