logo
In-app Chat
ZIMAudio
On this page

SetGroupMemberRole

GET

https://zim-api.zego.im/

By calling this API, you can set roles for group members in the group.

ZIM SDK supports setting users as group owner, administrator, or regular member by default. In a group, the group owner has all client-side permissions and can implement all group functions. Administrators have most client-side permissions. Regular members have the fewest client-side permissions, as shown in the following table:

Client-side PermissionGroup Owner (Enum value is 1)Administrator (Enum value is 2)Regular Member (Enum value is 3)
Modify group avatar, group name, group noticeSupportedSupportedSupported
Modify group attributes
Modify group member nicknameSupported, can be used for all group role usersSupported, can be used for all regular membersSupported, can only be used for oneself
Recall group member messages
Remove membersNot supported.
Mute individual group members
Mute specific group roles
Set group member rolesNot supported
Transfer group ownership
Disband group
All-member mute

In addition, you can also customize group roles, but the client-side permissions of this role are consistent with regular members.

After successful setting, group members will receive notifications through the following ZIM callbacks:

iOSAndroidmacOS
groupMemberInfoUpdatedonGroupMemberInfoUpdatedgroupMemberInfoUpdated
WindowsWebMini Program
onGroupMemberInfoUpdatedgroupMemberInfoUpdatedgroupMemberInfoUpdated
FlutterUnity3Duni-app
onGroupMemberInfoUpdatedOnGroupMemberInfoUpdatedgroupMemberInfoUpdated
React NativeHarmonyOS
groupMemberInfoUpdatedgroupMemberInfoUpdated
Note
The users corresponding to the parameters FromUserId and UserId have logged in to the ZIM service by calling the login method on the client, or have completed registration by calling the server-side API.
QPS Limit
20 times/s

Request

Query Parameters

    Action stringrequired

    Possible values: [SetGroupMemberRole]

    API prototype parameter

    https://zim-api.zego.im/?Action=SetGroupMemberRole

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Public parameter. A 16-character hexadecimal random string (hex encoding of 8-byte random number). Refer to Signature example for how to generate.

    Timestamp int64required

    💡Public parameter. Current Unix timestamp, in seconds. Refer to Signature example for how to generate, with a maximum error of 10 minutes.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    Signature stringrequired

    💡Public parameter. Signature, used to verify the legitimacy of the request. Refer to Signing the requests for how to generate an API request signature.

    FromUserId stringrequired

    Possible values: <= 32 characters

    Operator user ID. It is recommended to fill in the group owner ID.

    Note

    This parameter cannot be the same as ToUserId.

    GroupId stringrequired

    Possible values: <= 32 characters

    Group ID.

    ToUserId stringrequired

    Possible values: <= 32 characters

    Target user ID whose role is to be set.

    Role numberrequired

    Possible values: [2, 3]

    Role:

    • 2: Administrator.
    • 3: Regular member.
    • Other values: Custom roles can be defined. The recommended value range is [100, 255], with permissions consistent with regular members.

Responses

OK
Schema
    Code number

    Return code.

    The following only lists the return codes related to the API business logic. For the complete return codes, please refer to Return codes.

    Return codeDescriptionSuggested Solution
    660000001Server error.Please retry or contact ZEGOCLOUD Technical Support.
    660000002Parameter error.Please check the input parameters.
    660300005The API call frequency exceeds the AppID-level limit.Please try again later.
    660600001Group does not exist.Please confirm if the GroupId is correct.
    660600009Failed to query group information.Please confirm if the GroupID is correct first; if correct, please contact technical support.
    660600024ToUserId is not in the group.Please confirm if ToUserId is in the group:
    • If yes, please contact ZEGOCLOUD Technical Support.
    • If no, please add ToUserId to the group.
    660600029Role cannot be set to 1.Please modify Role.
    660600030FromUserId cannot be equal to ToUserId.Please modify ToUserId.
    Message string

    Description of the request result.

    RequestId string

    Request ID.

Previous

Set nicknames of group members

Next

Mute a group

On this page

Back to top