Query the Number of Speaking Users and Message Count for a Session
Updated: 2026-11-17 23:37:36
API Description
1、按频道查询一场直播的发言人数和发言条数
2、可指定场次。不指定场次时,查询该频道当前正在进行的场次
3、接口不需要登录,也不需要签名
4、接口支持 HTTPS 协议
API URL
https://apichat.polyv.net/front/speak-uv-pv-session-id/get
Request Method
GET
API Constraints
- The number of speaking users is counted by user. If the same user changes their nickname during the session, they are still counted as 1.
- The message count is accumulated based on the actual number of messages sent.
- The user count and message count are retained for 24 hours. If no one has spoken in the session yet, or the retention period has passed, both the user count and message count return 0.
- If no session is specified and the channel currently has no ongoing session, the API rejects the request and does not use 0 to indicate that there is no session.
Request Parameter Description
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| roomId | true | String | Channel ID. Length 1 to 100. It cannot be empty or contain only spaces |
| sessionId | false | String | Session ID. Length 1 to 100. If omitted, empty, or contains only spaces, the query applies to the currently ongoing session |
Example
https://apichat.polyv.net/front/speak-uv-pv-session-id/get?roomId=412738&sessionId=1794895866648
Without specifying a session:
https://apichat.polyv.net/front/speak-uv-pv-session-id/get?roomId=412738
Response Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| status | String | success on success, fail when parameters or the session do not meet the requirements, and error when the service is abnormal |
| message | String | Result description |
| code | Integer | 200 on success, 400 when parameters or the session do not meet the requirements, and 500 when the service is abnormal |
| data | Object | On success, the user count and message count [see Data Parameter Description for details]. May be empty on failure |
Data Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
| uv | Integer | Number of speaking users. Deduplicated by user |
| pv | Integer | Message count |
Response Example
Success, with speaking activity in the specified session:
{
"status": "success",
"message": "请求成功",
"code": 200,
"data": {
"uv": 2,
"pv": 6
}
}
Success, with no accumulated data for this session:
{
"status": "success",
"message": "请求成功",
"code": 200,
"data": {
"uv": 0,
"pv": 0
}
}
No session specified, and there is currently no ongoing session:
{
"status": "fail",
"message": "当前没有正在进行的场次",
"code": 400,
"data": ""
}
Channel ID not provided:
{
"status": "fail",
"message": "缺少参数roomId",
"code": 400,
"data": {
"code": 506
}
}
