# 查询用户状态 (/zh-CN/api-reference/api-ref/rtc/query-user-status)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

查询指定频道中指定用户的在线状态。

- OpenAPI: /openapi/rtc/channel-management.zh-CN.yaml
- Operation ID: get-user-property
- Method: GET
- Path: /dev/v1/channel/user/property/{appid}/{uid}/{channelName}
- Endpoint: https://api.sd-rtn.com/dev/v1/channel/user/property/{appid}/{uid}/{channelName}

## Servers

- https://api.sd-rtn.com

该方法可查询指定频道中某个用户的状态。请求成功后，返回的参数包括用户是否在频道中、加入频道的时间和用户角色等。


## Authorization

This endpoint requires authentication.

- `Basic Auth`

## Parameters

- `appid` (path, required) - 项目的 App ID。可通过以下方式获取：
- 从声网控制台获取。
- 调用[获取所有项目信息 API](/zh-CN/api-reference/api-ref/console/list-projects)，并读取响应包体中 `vendor_key` 字段的值。
- `uid` (path, required) - 用户 ID。

注意：该参数暂不支持 String 型用户名（User Account），请确保使用整型用户 ID。
- `channelName` (path, required) - 频道名称。

## Request body

No request body.

## Responses

### 200

如果状态码为 200，则请求成功。

- `success` (boolean) - 本次请求的状态：
- `true`：请求成功
- `false`：预留
- `data` (object) - 用户状态数据。
  - `data.in_channel` (boolean) - 用户当前是否在频道内：
- `true`：是
- `false`：否

**注意：**
当 `in_channel` 的值为 `false` 时不会返回其他字段。
  - `data.join` (number) - 用户加入频道的 Unix 时间戳，单位为秒。
  - `data.uid` (number) - 用户 ID。
  - `data.role` (number) - 用户在频道内的角色：
- `0`：未知
- `1`：通信场景下的用户
- `2`：直播场景下的主播
- `3`：直播场景下的观众
  - `data.platform` (number) - 用户设备所属平台，常见的返回值如下：
- `1`：Android
- `2`：iOS
- `5`：Windows
- `6`：Linux
- `7`：Web
- `8`：macOS
- `0`：其它平台
### 非 200

如果状态码不为 200，则请求失败。你可以参考[响应状态码](/zh-CN/realtime-media/rtc/reference/response-code)排查问题。

No schema.

## Response examples

### 200

```json
{
  "success": true,
  "data": {
    "join": 1640330382,
    "uid": 2845863044,
    "in_channel": true,
    "platform": 7,
    "role": 2
  }
}
```
