PATCH/api/v1/me更新我的资料

更新昵称、头像等展示字段;未提供的字段保持不变。

Request

Headers

NameData TypeRequiredDescription
AuthorizationstringYes会话令牌认证,格式 `Bearer <sessionToken>`
Content-TypestringYes请求体内容类型(默认值 "application/json")
type RequestHeaders = {
  /** 会话令牌认证,格式 `Bearer <sessionToken>` */
  Authorization: string
  /** 请求体内容类型,默认值 "application/json" */
  Content-Type: string
}
{
  "Authorization": "Bearer st_7c1f9e05b28d4a63",
  "Content-Type": "application/json"
}

Body

NameData TypeRequiredDescription
displayNamestringNo昵称
avatarUrlstringNo头像地址
type RequestBody = {
  /** 昵称 */
  displayName?: string
  /** 头像地址 */
  avatarUrl?: string
}
{
  "displayName": "林林",
  "avatarUrl": "https://cdn.xeegam.com/passport/avatars/01JD8SEGQ0P9N2XK4L7VDH3T6C-v2.png"
}

Response

Body

NameData TypeRequiredDescription
userIdstringYes用户 ID
usernamestringYes用户名
displayNamestringYes昵称
avatarUrlstringNo头像地址
statusstringYes账号状态:active / frozen
createdAtstringYes注册时间(ISO 8601 UTC)
type UserProfileDTO = {
  /** 用户 ID */
  userId: string
  /** 用户名 */
  username: string
  /** 昵称 */
  displayName: string
  /** 头像地址 */
  avatarUrl?: string
  /** 账号状态:active / frozen */
  status: string
  /** 注册时间(ISO 8601 UTC) */
  createdAt: string
}
{
  "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "username": "chenlin",
  "displayName": "陈林",
  "avatarUrl": "https://cdn.xeegam.com/passport/avatars/01JD8SEGQ0P9N2XK4L7VDH3T6C.png",
  "status": "active",
  "createdAt": "2026-10-14T08:05:00Z"
}

HTTP Code

HTTP Status Meaning Notes
200 成功 返回更新后的资料

Response Code

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

code Meaning Notes
0 成功 返回更新后的资料

Examples

PATCH /api/v1/me
Authorization: Bearer st_7c1f9e05b28d4a63
Content-Type: application/json

{
  "displayName": "林林",
  "avatarUrl": "https://cdn.xeegam.com/passport/avatars/01JD8SEGQ0P9N2XK4L7VDH3T6C-v2.png"
}
{
  "id": "01JD8SNUBO3V6W2CW",
  "code": 0,
  "messages": [],
  "result": {
    "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
    "username": "chenlin",
    "displayName": "林林",
    "avatarUrl": "https://cdn.xeegam.com/passport/avatars/01JD8SEGQ0P9N2XK4L7VDH3T6C-v2.png",
    "status": "active",
    "createdAt": "2026-10-14T08:05:00Z"
  }
}