Platform API
Check user accounts
Use Check user accounts to determine whether a batch of user IDs is registered with OpenIM. This is useful before bulk imports, conversation creation, or message delivery.
HTTP request
POST {API_ADDRESS}/user/account_checkRequest example
curl --request POST "${API_ADDRESS}/user/account_check" \
--header "Content-Type: application/json; charset=utf-8" \
--header "operationID: ${OPERATION_ID}" \
--header "token: ${ADMIN_TOKEN}" \
--data-raw '{
"checkUserIDs": [
"user_001",
"user_404"
]
}'Keep administrator tokens on trusted backend services only. Client applications should use user tokens issued by your backend.
Request body
{
"checkUserIDs": [
"user_001",
"user_404"
]
}| Parameter | Required | Type | Description |
|---|---|---|---|
| checkUserIDs | Yes | array | User IDs to check. The array must not be empty or contain duplicate IDs. |
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": {
"results": [
{
"userID": "user_001",
"accountStatus": 1
},
{
"userID": "user_404",
"accountStatus": 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.results | array | One account check result for each requested user ID. |
data.results[] fields
| Field | Type | Description |
|---|---|---|
| userID | string | The user ID that was checked. |
| accountStatus | int | Registration state. 1 means registered and 0 means not registered. |
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
- Remove duplicate IDs before sending the request.
- An unregistered result is not a request error; inspect
accountStatusfor each user.
Related pages
Was this page helpful?