Platform API
Get a user
Use Get users to retrieve profiles for a specified list of OpenIM user IDs.
HTTP request
POST {API_ADDRESS}/user/get_users_infoRequest example
curl --request POST "${API_ADDRESS}/user/get_users_info" \
--header "Content-Type: application/json; charset=utf-8" \
--header "operationID: ${OPERATION_ID}" \
--header "token: ${ADMIN_TOKEN}" \
--data-raw '{
"userIDs": [
"11111111",
"11111112"
]
}'Keep administrator tokens on trusted backend services only. Client applications should use user tokens issued by your backend.
Request body
{
"userIDs": [
"11111111",
"11111112"
]
}| Parameter | Required | Type | Description |
|---|---|---|---|
| userIDs | Yes | array | List of OpenIM user IDs. |
| statuses Enterprise | No | int[] | Return only users in the specified account states. See UserStatus. |
Response
OpenIM usually returns 200 OK when the request reaches the service. Use errCode in the JSON response to determine business success; errCode === 0 means the operation succeeded.
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"usersInfo": [
{
"userID": "11111111",
"nickname": "yourNickname",
"faceURL": "yourFaceURL",
"ex": "",
"createTime": 1688454168302,
"appMangerLevel": 18,
"globalRecvMsgOpt": 0
},
{
"userID": "11111112",
"nickname": "alantestuid3",
"faceURL": "1111111",
"ex": "",
"createTime": 0,
"appMangerLevel": 18,
"globalRecvMsgOpt": 0
}
]
}
}Response fields
| Field | Type | Description |
|---|---|---|
| errCode | int | Business error code. 0 means success. |
| errMsg | string | Short error message. |
| errDlt | string | Detailed error information for troubleshooting. |
| data | object | Endpoint-specific response data. |
| data.usersInfo | array | Matching user profiles. Each item follows UserInfo. |
Error response
When a request fails, OpenIM returns the same error envelope. See Error codes for the full handling model.
{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}| Scenario | Possible cause | Recommended action |
|---|---|---|
| Authentication failed | token is missing, expired, or not an administrator token. | Issue a new administrator token and keep it on the backend. |
| Traceability is weak | operationID is missing or reused across many requests. | Generate a unique operationID for every request and log it with the response. |
| Validation failed | The request body has an invalid type, missing field, or unsupported enum value. | Compare the payload with the request table and retry after correcting the fields. |
Permissions and limits
- The response contains the users found for the requested IDs. Do not infer that every requested ID exists without checking the returned list.
- The
statusesfilter is available in OpenIM Enterprise.
Related pages
Was this page helpful?