In-app Chat
  • iOS : Objective-C
  • Android
  • Web
  • Flutter
  • React Native
  • Unity3D
  • Windows
  • macOS
  • Introduction
    • Overview
    • Basic concepts
  • Sample app
  • Getting started
  • Client SDKs
    • SDK downloads
    • Release notes
    • Upgrade guide
  • Guides
    • Authentication
    • Manage users
    • Room
    • Group
    • Messaging
    • Call invitation (signaling)
    • Manage sessions
  • Offline push notifications
  • Error codes
  • Client APIs
  • Server APIs
  • 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:

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