GET/api/v1/admin/users/:userId查看用户详情

返回管理视角的用户详情:基础资料、联系方式、三方绑定、会话与角色概况。

Request

Headers

NameData TypeRequiredDescription
AuthorizationstringYes会话令牌认证,格式 `Bearer <sessionToken>`
type RequestHeaders = {
  /** 会话令牌认证,格式 `Bearer <sessionToken>` */
  Authorization: string
}

URL Parameters

Name Data Type Description
userId string 用户 ID

Response

Body

NameData TypeRequiredDescription
userIdstringYes用户 ID
usernamestringYes用户名
displayNamestringYes昵称
statusstringYesactive / frozen
contactsarrayYes联系方式
linkedProvidersarrayYes三方提供方列表
sessionCountnumberYes活跃会话数
hasPasswordbooleanYes是否设置密码
mfaEnabledbooleanYes是否启用 MFA
createdAtstringYes注册时间
lastLoginAtstringNo最近登录时间
type ResponseBody = {
  /** 用户 ID */
  userId: string
  /** 用户名 */
  username: string
  /** 昵称 */
  displayName: string
  /** active / frozen */
  status: string
  /** 联系方式 */
  contacts: Record<string, unknown>[]
  /** 三方提供方列表 */
  linkedProviders: string[]
  /** 活跃会话数 */
  sessionCount: number
  /** 是否设置密码 */
  hasPassword: boolean
  /** 是否启用 MFA */
  mfaEnabled: boolean
  /** 注册时间 */
  createdAt: string
  /** 最近登录时间 */
  lastLoginAt?: string
}
{
  "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "username": "chenlin",
  "displayName": "陈林",
  "status": "active",
  "contacts": [
    {
      "channel": "phone",
      "target": "+8613800001234"
    },
    {
      "channel": "email",
      "target": "chen.lin@example.com"
    }
  ],
  "linkedProviders": [
    "github"
  ],
  "sessionCount": 2,
  "hasPassword": true,
  "mfaEnabled": true,
  "createdAt": "2026-10-14T08:05:00Z",
  "lastLoginAt": "2026-10-14T08:00:00Z"
}

HTTP Code

HTTP Status Meaning Notes
200 成功 返回用户详情

Response Code

响应使用统一信封 {id, code, messages, result},其 code 字段:

code Meaning Notes
0 成功 返回用户详情

Examples

GET /api/v1/admin/users/01JD8SEGQ0P9N2XK4L7VDH3T6C
Authorization: Bearer st_7c1f9e05b28d4a63
{
  "id": "01JD8SSZPU4P7RG",
  "code": 0,
  "messages": [],
  "result": {
    "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
    "username": "chenlin",
    "displayName": "陈林",
    "status": "active",
    "contacts": [
      { "channel": "phone", "target": "+8613800001234" },
      { "channel": "email", "target": "chen.lin@example.com" }
    ],
    "linkedProviders": ["github"],
    "sessionCount": 2,
    "hasPassword": true,
    "mfaEnabled": true,
    "createdAt": "2026-10-14T08:05:00Z",
    "lastLoginAt": "2026-10-14T08:00:00Z"
  }
}