tencent cloud

Chat

제품 소개
제품 개요
Basic Concepts
응용 시나리오
기능 소개
계정 시스템
사용자 정보 및 관계망
메시지 관리
그룹 시스템
Official Account
Audio/Video Call
사용 제한
구매 가이드
과금 개요
요금 안내
Purchase Instructions
Renewal Guide
연체 안내
Refund Policy
다운로드 센터
SDK & Demo 소스 코드
업데이트 로그
시나리오 솔루션
Live Streaming Setup Guide
AI Chatbot
대규모 엔터테인먼트 협업 커뮤니티
Discord 구현 가이드
IM을 게임에 통합하는 방법
WhatsApp Channel-style Official Account Integration Solution
Send Red Packet
Firewall Restrictions
클라이언트 APIs
SDK API(Web)
Android
iOS & macOS
Swift
Flutter
Electron
Unity
React Native
C APIs
C++
서버 APIs
Secure authentication with UserSig
RESTful APIs
Webhooks
콘솔 가이드
New Console Introduction
애플리케이션 생성 및 업그레이드
기본 설정
기능 설정
계정 관리
그룹 관리
Official Channel Management
콜백 설정
모니터링 대시보드
Viewing Guide for Resource Packages
Real-Time Monitor
개발 보조 툴
액세스 관리
Advanced Features
FAQ
uni-app FAQs
구매
SDK 관련 질문
계정 인증
사용자 정보 및 관계망
메시지
그룹
라이브 방송 그룹
닉네임 및 프로필 사진
협약 및 인증
Service Level Agreement
컴플라이언스 인증
IM 정책
개인 정보 보호 정책
데이터 개인 정보 보호 및 보안 계약
에러 코드
문의하기

Querying Account Online Status

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-10-23 14:43:57

Feature Description

This API is used to query the current login status of a user.

API Call Description

Sample request URL

https://xxxxxx/v4/openim/query_online_status?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json

Request parameters

The following is a list of the parameters commonly used when calling this API and their descriptions. For more parameters, see the RESTful API Overview.
Parameter
Description
https
The request protocol is HTTPS, and the request method is POST.
xxxxxx
The country/region where your SDKAppID is located.
China: console.tim.qq.com
Singapore: adminapisgp.im.qcloud.com
Seoul: adminapikr.im.qcloud.com
Tokyo:adminapijpn.im.qcloud.com
Frankfurt: adminapiger.im.qcloud.com
Silicon Valley: adminapiusa.im.qcloud.com
Jakarta: adminapiidn.im.qcloud.com
v4/openim/query_online_status
The request API that is used.
sdkappid
The SDKAppID assigned via the Chat console when the application is created.
identifier
The value must be the app admin account. For more information, see App Admin.
usersig
The signature generated by the app admin account. For more information on the operation, see Generating UserSig.
random
The value must be a random 32-bit unsigned integer. Value range: 0 to 4294967295.
contenttype
Request format. The value is always json.

Maximum call frequency

This API can be called up to 200 times per second.

Sample request packets

When detailed login platform information is not needed

{
"To_Account":["id1","id2","id3","id4"],
}


When detailed login platform information is needed

{
"IsNeedDetail": 1,
"To_Account": ["id1", "id2", "id4"]
}

Request packet fields

Field
Type
Property
Description
To_Account
Array
Required
The one or more UserIDs whose login statuses are to be queried. This API can be used to query the login statuses of up to 500 UserIDs at a time.
IsNeedDetail
Integer
Optional
Specifies whether detailed login platform information is needed in the response. 0: not needed. 1: needed.

Sample response packet body

When detailed login platform information is not needed

{
"ActionStatus":"OK",
"ErrorInfo":"",
"ErrorCode": 0
"QueryResult": [
{
"To_Account": "id1",
"State": "Offline"
},
{
"To_Account": "id2",
"State": "Online"
},
{
"To_Account": "id3",
"State": "PushOnline"
}
],
"ErrorList": [
{
"To_Account": "id4",
"ErrorCode": 70107
}
]
}


When detailed login platform information is needed

{
"ActionStatus":"OK",
"ErrorInfo":"",
"ErrorCode": 0
"QueryResult": [
{
"To_Account": "id1",
"State": "Online",
"Detail": [
{
"Platform": "IPhone",
"Status": "PushOnline",
"IsBackground": 1,
"Instid": 74224656,
"CustomIdentifier": "device-1"
},
{
"Platform": "Web",
"Status": "Online",
"IsBackground": 1,
"Instid": 74224656,
"CustomIdentifier": "device-2"
}
]
},
{
"To_Account": "id2",
"State": "Offline",
}
],
"ErrorList": [
{
"To_Account": "id4",
"ErrorCode": 70107
}
]
}

Request error

{
"ActionStatus": "FAIL",
"ErrorInfo": "Fail to Parse json data of body, Please check it",
"ErrorCode": 90001
}

Response packet fields

Field
Type
Description
ActionStatus
String
The processing result of the request. OK: succeeded. FAIL: failed.
ErrorInfo
String
Detailed information on the error.
ErrorCode
Integer
The error code returned for the request.
If the status query for any account succeed, the value is 0.
If the query for all the accounts failed, the return value is not 0.
QueryResult
Array
The returned structured information of the login status of the user.
QueryResult.To_Account
String
The UserID of the user whose status is returned.
QueryResult.Status
String
The returned login status. Valid values:
Online: after the user logs in to the client, the client remains in a persistent connection with the Chat backend.
PushOnline: the client enters the PushOnline state when the iOS or Android process is disconnected due to a network error or is killed by the operating system. In this state, the client still can receive offline messages. However, if the client’s process is not terminated by the operating system after the client is switched to the background, the client is in Online state.
Offline: the user has logged out of the client properly or has not logged in to the client for at least 7 days since the last login.
If the user logs in to the client on multiple devices, the value is Online provided that the client is in the Online state on any device.
QueryResult.Detail
Object
The detailed information on the login platform.
QueryResult.Detail.Platform
String
The type of the login platform. Valid values: "iPhone", "Android", "Web", "PC", "iPad", and "Mac".
QueryResult.Detail.Instid
Integer
The unique identifier of this device.
QueryResult.Detail.CustomIdentifier
String
The custom identifier of this device.
ErrorList
Array
The list of accounts whose statuses failed to be queried. The target accounts in this list were not found or their statuses failed to be queried. If the status query for all accounts succeeded, the value of the ErrorList field is blank.
ErrorList.To_Account
String
The target account whose status failed to be queried.
ErrorList.ErrorCode
Integer
The error code indicating that the status query failed. If the error code for a target account is 70107, the account was not found.
Caution
The Chat backend stores the PushOnline state for only 7 days. If a user has not logged in to the client within 7 days since the previous login, the user enters the Offline state.

Error Codes

The HTTP return code for this API is 200 unless an network error such as error 502 occurs. The actual error code and error information are indicated by ErrorCode and ErrorInfo respectively in the response packet body. For public error codes 60000 to 79999, see Error Codes. The private error codes for this API are as follows:
Error Code
Description
70107
The requested UserID does not exist.
70169
The server timed out. Try again later.
90001
JSON format parsing failed. Check whether the request packet meets the JSON specification, or whether To_Account is a null array.
90003
The value of the To_Account field in the JSON format request packet does not meet the message format requirements. Please check whether the type of the To_Account field is String.
90009
The request requires the app admin’s permissions.
90011
The number of target accounts to which the message is to be sent exceeds 500. Reduce the number of target accounts in To_Account.
90992
The backend service timed out. Please try again.
90994
An internal service error occurred. Please try again.
90995
An internal service error occurred. Please try again.
91000
An internal service error occurred. Please try again.

API Debugging Tool

To debug this API, you can use the Online RESTful API Debugging Tool.

References

Batch Importing Multiple Accounts (v4/im_open_login_svc/multiaccount_import)
Invalidating the Login Status of an Account (v4/im_open_login_svc/kick)

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백