Browse Platform API
Platform API

Get users online token details

Copy

Use Get users' online token details to retrieve tokens grouped by active platform. Only online users are returned; an offline requested user is omitted from data.

HTTP request

POST {API_ADDRESS}/user/get_users_online_token_detail

Request example

curl --request POST "${API_ADDRESS}/user/get_users_online_token_detail" \
  --header "Content-Type: application/json; charset=utf-8" \
  --header "operationID: ${OPERATION_ID}" \
  --header "token: ${ADMIN_TOKEN}" \
  --data-raw '{
  "userIDs": [
    "user_001",
    "user_002"
  ]
}'
Keep administrator tokens on trusted backend services only. Client applications should use user tokens issued by your backend.

Request body

{
  "userIDs": [
    "user_001",
    "user_002"
  ]
}
ParameterRequiredTypeDescription
userIDsYesarrayList of OpenIM user 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": [
    {
      "userID": "user_001",
      "status": 1,
      "singlePlatformToken": [
        {
          "platformID": 1,
          "total": 2,
          "token": [
            "eyJhbGciOiJIUzI1Ni...",
            "eyJhbGciOiJIUzI1Ni..."
          ]
        }
      ]
    }
  ]
}

Response fields

FieldTypeDescription
errCodeintBusiness error code. 0 means success.
errMsgstringShort error message.
errDltstringDetailed error information for troubleshooting.
dataarrayToken details for online users only.

data[] fields

FieldTypeDescription
userIDstringOnline user ID.
statusintOnline state; returned entries are normally 1.
singlePlatformTokenarrayToken groups by platform.
singlePlatformToken[].platformIDintConnected platform. See PlatformID.
singlePlatformToken[].totalintNumber of online tokens for the platform.
singlePlatformToken[].tokenarrayTokens currently used on the platform. Treat these values as sensitive credentials.

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"
}
ScenarioPossible causeRecommended action
Authentication failedtoken is missing, expired, or not an administrator token.Issue a new administrator token and keep it on the backend.
Traceability is weakoperationID is missing or reused across many requests.Generate a unique operationID for every request and log it with the response.
Validation failedThe 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

  • Keep all returned tokens inside a trusted backend or restricted administration system.
  • For a result that explicitly includes offline users, use Get users' online status.