logo
In-app Chat
ZIMAudio
On this page

AddUsersToBlacklist

POST

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

By calling this API, you can batch block up to 20 users for a user, and no longer receive messages from related users. If you need to increase the limit, please contact ZEGOCLOUD Technical Support.

Each user can block a maximum of 1000 users by default. If you need to increase the limit, please contact ZEGOCLOUD Technical Support.

After successfully blocking users for a user, this user's client will receive blocklist update notifications through the following ZIM SDK callback interface:

iOSAndroidmacOSWindows
blacklistChangedonBlacklistChangedblacklistChangedonBlacklistChanged
WebMini ProgramFlutterReact Native
blacklistChangedblacklistChangedonBlacklistChangedblacklistChanged
uni-app | uni-app xHarmonyOS
blacklistChangedblacklistChanged
Note

The users corresponding to the parameters FromUserId and UserIds 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.

Note
The parameters FromUserId and UserId only support numbers, English characters, and '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', '{', '}', '|', '~'
QPS Limit
20 times/s

Request

Query Parameters

    Action stringrequired

    Possible values: [AddUsersToBlacklist]

    API prototype parameter

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

    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.

Body

required
    FromUserId stringrequired

    Possible values: <= 32 characters

    Block users for this UserId.

    UserIds string[]required

    Possible values: <= 20

    List of users to be blocked. The default maximum is 20 strings. Each string has a maximum length of 32 bytes.

Responses

OK
Schema
    Code integer

    Return code.

    The following only lists the Code and SubCode related to the API business logic. For complete return codes, please refer to Global Return Codes.

    Note

    When you initiate a request to update multiple friend attributes at the same time:

    • If 1 or more attributes are successfully updated, Code will return 0. In this case, please refer to the specific information in FailKey to confirm the operation result.
    • If all friend attributes fail to be updated, Code will return the relevant return code. For details, please refer to Global Return Codes.
    Code / SubCodeDescriptionSuggested Solution
    660000002Input parameter error。Please check the input parameters。
    660300005The API call frequency exceeds the AppID-level limit.Please try again later.
    660500002FromUserId is not registered.Please confirm whether the user is registered:
    If confirmed registered, please contact ZEGOCLOUD Technical Support for troubleshooting.
    If confirmed not registered, please register this user.
    6607000015The target user of the API is not registered.Please confirm whether the user is registered:
    If confirmed registered, please contact ZEGOCLOUD Technical Support for troubleshooting.
    If confirmed not registered, please register this user.
    660800001FromUserId is not registered.Please confirm whether the user is registered:
    If confirmed registered, please contact ZEGOCLOUD Technical Support for troubleshooting.
    If confirmed not registered, please register this user.
    660800037User has been blocked, no need to repeat the operation.No action required.
    660800038Cannot block FromUserId or remove FromUserId from the blocklist.Please modify UserIds.
    660800039The incoming user list exceeds the limit.Please shorten the incoming user list.
    660800040FromUserId's blocklist has reached the limit and cannot block more users.No action required.
    660800041Failed to block all specified users.Please refer to the SubCode of the response parameter ErrList for processing.
    Message string

    Description of the request result.

    RequestId string

    Request ID.

    ErrList object[]
    • When you initiate a request to block multiple users at the same time:
    • If 1 or more users are successfully blocked, Code will return 0. In this case, please refer to the specific information in ErrList to confirm the operation result.
    • If all specified users fail to be blocked, Code will return the relevant return code. For details, please refer to Global Return Codes.
  • Array[
  • UserId string

    Failed to block this UserID.

    SubCode number

    Specific failure return code. For complete return codes, please refer to the Code description or Global Return Codes.

  • ]

Previous

Modify the attributes of a friend

Next

Unblock users

On this page

Back to top