logo
In-app Chat
Powered Byspreading
On this page

Remove group members


Description

Remove users in the group by specifying their user IDs.

Note

User IDs in the group can be obtained by Query group member list.

After a user is successfully removed, all group members (including the group owner and the removed member) will receive a ZIM SDK callback interface:

iOSAndroidmacOSWindows
groupMemberStateChangedonGroupMemberStateChangedgroupMemberStateChangedonGroupMemberStateChanged
WebFlutterReactive NativeUnity3D
groupMemberStateChangedonGroupMemberStateChangedgroupMemberStateChangedOnGroupMemberStateChanged

Operation prototype

  • Request method: POST
  • Request endpoint: https://zim-api.zego.im/?Action=KickoutGroupUser
  • Protocol: HTTPS
  • Rate limit: 20 requests/second

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 Accessing Server APIs - Public parameters.

ParameterTypeRequiredDescription
FromUserIdStringYesUser ID of the operator.
GroupIdStringYesGroup ID.
UserId[]Array of StringYes

A list of user IDs to be removed, supporting up to 50 user IDs.

Example: "UserId": ["usera","userb"]

CustomReasonStringNoThe reason for removal, with a length limit of 32 bytes.
Note

FromUserId, GroupId, UserId[], and CustomReason only support numbers, English characters, and '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ', ',']', '^', '_', '{', '|', '}', '~', and ' '.

Sample request

  • Sample request URL:

    Untitled
    https://zim-api.zego.im/?Action=KickoutGroupUser
    &<public request parameter>
    
    1
    Copied!
  • Request body:

    Untitled
    {
       "FromUserId":"zego_user",
       "GroupId":"groupA",
       "CustomReason":"reason",
       "UserId":["userA"]
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberReturn code.
Note
If you remove multiple users at the same time:
  • If one or more users are successfully removed, Code will return 0. Please refer to the specific information in ErrorList to confirm the operation result.
  • If all users are not successfully removed, Code will return the relevant return code, please refer to Return codes for details.
MessageStringThe description information of the request result.
RequestIdStringRequest ID.
ErrorListArray of StringA list of failed operations.
└UserIdStringUser ID of the removal failure.
└SubCodeNumberError code of the removal failure.

Sample response

Untitled
{
  "Code":0,
  "Message":"success",
  "RequestId":"343649807833778782",
  "ErrorList": [
    {
        "UserId":"u2",
        "SubCode":660000012
    } 
  ]
}
1
Copied!

Return codes

The following table describes only the return codes related to the business logic of the operation. For the complete list of return codes, see Return codes.

Return CodeDescriptionProcessing Suggestions
660000002Parameter error.Please refer to the correct parameters in Request Parameters.
660000011The number of users to be removed exceeds the limit.The number should not exceed 50.
660600001The group does not exist.Please confirm the GroupId is correct.
660600005The call frequency of the KickoutGroupUser interface exceeds the limit.The rate limit is 20 requests/second, please do not exceed the limit.
61103The user to be removed is not in the group.No need to process.

Previous

Query group member list

Next

Transfer the group ownership