Documentation
Server_APIs_v2 Server APIs v2
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • Server APIs v2
  • Room signaling
  • End a room

End a room

Last updated:2024-07-24 18:26

1 Description

Calling this interface will remove all users from the room and close the room.

If the developer has referred to Setting up server-to-server callbacks and configured Callback on logged out room and Callback on stream closed, when the server calls this interface:

  • The server will receive a Callback on logged out room notification, and the developer can understand the situation when users exit the room.
  • The status of the streams in the original room will be closed, and the server will receive a Callback on stream closed, and the developer can learn about the information related to the closing of the streams in the room.

After the room is closed, the client users will be kicked out of the room and will receive ZEGOCLOUD SDK callback interfaces:

ZegoExpress SDK LiveRoom SDK
iOS/macOS onRoomStateChanged onKickout
Android onRoomStateChanged onKickout
Windows onRoomStateChanged OnKickOut
Web roomStateChanged onKickout

2 Request method and endpoint

  • Request method: GET
  • Request endpoint: https://rtc-api.zego.im/?Action=CloseRoom
  • Transport protocol: HTTPS
  • Rate limit (client app side): 1 time/second (test environment: 1 time/second)

3 Request parameters

Listed below are the parameters specific to this request and part of the public request parameters. For the complete list of public request parameters, see Server APIs public request parameters.

Parameter Type Required Description
RoomId
String
Yes
Room ID.
CustomReason
String
No
Reason for closure, with a maximum length of 256 bytes.

When using, please UrlEncode the content of this parameter.

RoomCloseCallback
Boolean
No
Whether to generate a room close callback, default is false.

Since it is usually an actively initiated closure by the developer, there is no need to notify the developer through the room close callback. If you need to perform unified logic processing through the room close callback, you can modify it to true.

This parameter only affects whether a room close callback is generated. Other callback notifications that cause the room to close (such as `exit room callback`) are not affected.

4 Request example

https://rtc-api.zego.im/?Action=CloseRoom
&RoomId=room1
&CustomReason=clear
&RoomCloseCallback=false
&<Public Request Parameters>

5 Response parameters

Parameter Type Description
Code
Int32
Return code.
Message
String
Description of the operation result.
RequestId
String
Request ID.

6 Response example

{
    "Code": 0,
    "Message": "success",
    "RequestId": "TestRequestId1642755866616219000"
}

7 Return codes

Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.

Return Code Description Suggested Action
5018 The room has been destroyed or does not exist. Please verify if the requested room with RoomId exists.
5024 The room does not exist, same as internal logic for 104 and 50001. Please verify if the requested room with RoomId exists.
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code