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.
- If
peer_idis specified -- respective connected peer will be disconnected from the active room. - If the
roleis specified -- all the connected peers assigned with that particular role will be disconnected from the active room. - If both
peer_idandroleare specified -- preference will be given to the peer_id and the respective peer will be disconnected from the active room. - If both
peer_idandroleare 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
| Name | Type | Description | Required |
|---|---|---|---|
| room_id — path param | string | Unique identifier of the room to which the peer is connected. Example: 627cda81ab4f3b56a077dc33 | Yes |
| peer_id — body param | string | Unique identifier of the connected peer/participant you wish to remove from the active room. Example: fd9e87d8-5c7b-4750-932f-d8d2ff18b70b | Conditional |
| role — body param | string | You can use this to remove a list of connected peers with the specified role type from the active room. | Conditional |
| reason — body param | string | You 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.