logo
In-app Chat
Powered Byspreading
On this page

Query user information


Description

This API allows you to retrieve information for multiple users based on their user IDs. The response includes each user's name, avatar, and other extended fields.

Request method and endpoint

  • Request method: POST
  • Request endpoint: https://zim-api.zego.im/?Action=QueryUserInfos
  • Transmission 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.

ParameterTypeRequiredDescription
UserIds[]Array of StringYesThe list of user IDs to be queried, up tp 100 user IDs can be queried. Each user ID should be less than 64 bytes.
Note

The UserId can only contain numbers, letters, and the following special characters: !#$%&()+-:<=.>?@[]^_|~.

Sample request

  • Request URL

    Untitled
    https://zim-api.zego.im/?Action=QueryUserInfos
    &<Common request parameters>
    
    1
    Copied!
  • Request body

    Untitled
    {
        "UserIds": ["userA","userB","userC"]
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberReturn code.
MessageStringDescription of the request execution result.
RequestIdStringRequest ID.
ResultObjectResults of the successful query.
└UserIdStringUser ID of successful query.
└UserNameStringUser name.
└UserAvatarStringUser avatar address.
└ExtraStringExtra fileld.
ErrorListObjectThe list of query failures.
└UserIdStringUser ID of failed query.
└SubCodeNumberReturn code indicating query failure.

The returned code when the query fails.

This parameter is only returned when ErrorList is not null.

Sample response

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782",
    "Result": [
        {
            "UserId": "UserA",
            "UserName": "userName",
            "UserAvatar": "avatar",
            "Extra": "extra"
        }
    ],
    "ErrorList": [
        {
            "UserId": "UserB",
            "SubCode": 660000002
        }
    ]
}
1
Copied!

Return codes

Listed below are the return codes related to this API. For the complete list of return codes, see Return codes|_balnk.

return codeDescription
660000001Business related general error. Please try again or contact ZEGOCLOUD Technical Support.
660000002Invalid parameter. The parameter entered is missing or invalid. Please check the parameters.
660300005The QPS limit specified in AppID is exceeded. Try again later.
660700008Failed to get user information. Please check the user IDs or contact ZEGOCLOUD Technical Support. 
660700015The user is not registered. Please register the user first.

Previous

Query users online status

Next

Batch register users