Documentation
zim In-app Chat
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • In-app Chat
  • Server APIs
  • Group related
  • Remove group member

Remove group members

Last updated:2024-04-16 10:57

Description

Remove users in the group by specifying their user IDs.

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:

iOS Android macOS Windows
groupMemberStateChanged
onGroupMemberStateChanged
groupMemberStateChanged
onGroupMemberStateChanged
Web Flutter Reactive Native Unity3D
groupMemberStateChanged
onGroupMemberStateChanged
groupMemberStateChanged
OnGroupMemberStateChanged

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.

Parameter Type Required Description
FromUserId
String
Yes
User ID of the operator.
GroupId
String
Yes
Group ID.
UserId[]
Array of String
Yes
A list of user IDs to be removed, supporting up to 50 user IDs.

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

CustomReason
String
No
The reason for removal, with a length limit of 32 bytes.

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

Sample request

  • Sample request URL:

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

    {
       "FromUserId":"zego_user",
       "GroupId":"groupA",
       "CustomReason":"reason",
       "UserId":["userA"]
    }

Response parameters

Parameter Type Description
Code
Number
Return code.

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.
Message
String
The description information of the request result.
RequestId
String
Request ID.
ErrorList
Array of String
A list of failed operations.
UserId
String
User ID of the removal failure.
SubCode
Number
Error code of the removal failure.

Sample response

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

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 Code Description Processing Suggestions
660000002
Parameter error.
Please refer to the correct parameters in Request Parameters.
660000011
The number of users to be removed exceeds the limit.
The number should not exceed 50.
660600001
The group does not exist.
Please confirm the GroupId is correct.
660600005
The call frequency of the KickoutGroupUser interface exceeds the limit.
The rate limit is 20 requests/second, please do not exceed the limit.
61103
The user to be removed is not in the group.
No need to process.
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code