logo
In-app Chat
ZIMAudio
On this page

DeleteFriends

POST

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

By calling this API, you can batch delete up to 20 friends for a user in one-way or two-way mode. If you need to increase the limit (up to 50), please contact ZEGOCLOUD Technical Support.

Taking users A and B as examples to illustrate one-way deletion and two-way deletion:

  • One-way deletion: When user A deletes user B in one-way mode, user B is no longer a friend of user A, but user A is still a friend of user B.
  • Two-way deletion: When user A deletes user B in two-way mode, they are no longer friends with each other.

After successfully deleting friends for users, the clients of the relevant users will receive friend list update notifications through the following ZIM SDK callback interface:

iOSAndroidmacOSWindows
friendListChangedonFriendListChangedfriendListChangedonFriendListChanged
WebMini ProgramFlutterReact Native
friendListChangedfriendListChangedonFriendListChangedfriendListChanged
uni-app | uni-app xHarmonyOS
friendListChangedfriendListChanged
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.

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

Request

Query Parameters

    Action stringrequired

    Possible values: [DeleteFriends]

    API prototype parameter

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

    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

    Delete friends for this UserId.

    UserIds string[]required

    Possible values: <= 20

    List of target friends to delete. Default maximum is 20.

    DeleteType numberrequired

    Possible values: [0, 1]

    Deletion type:

    • 0:Two-way deletion.
    • 1:One-way deletion.

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 delete multiple friends at the same time:

    • If 1 or more friends are successfully deleted, Code will return 0. In this case, please refer to the specific information in ErrorList to confirm the operation result.
    • If all target friends fail to be deleted, 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 register FromUserId first.
    660800019Single batch operation exceeds the limit.Reduce the number of single batch operations.
    660800022User ID related parameters in the parameters are duplicated.Please delete or modify duplicate parameters.
    660800033The string in UserIds cannot be the same as FromUserId.Please modify the string in UserIds that is the same as FromUserId.
    660800034The target user is not a friend of FromUserId.No action required.
    Message string

    Description of the request result.

    RequestId string

    Request ID.

    ErrorList object[]
    Failure information list.
    • Code is 0:
    • ErrorList is empty, all target friends are successfully deleted.
    • ErrorList is not empty, indicating that some friends failed to be deleted. Please refer to SubCode for processing.
    • Code is not 0:
    • ErrorList is empty, indicating parameter error, API frequency limit, or system error.
    • ErrorList is not empty, indicating that all specified friends failed to be deleted.
  • Array[
  • UserId string

    Failed to delete the friend with this UserID.

    SubCode integer

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

  • ]

Previous

Check blockships

Next

Delete all friends

On this page

Back to top