GET/api/v1/me/logs查询我的日志

分页返回当前用户的审计事件(登录、凭据变更、授权、支付等)。

Request

Headers

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

Query Parameters

NameData TypeRequiredDescription
pagenumberNo页码,默认 1
pageSizenumberNo每页数量,默认 20,上限 100
actionstringNo按动作过滤,如 auth.login.password
sincestringNo起始时间(ISO 8601 UTC)
untilstringNo结束时间(ISO 8601 UTC)
type QueryParams = {
  /** 页码,默认 1 */
  page?: number
  /** 每页数量,默认 20,上限 100 */
  pageSize?: number
  /** 按动作过滤,如 auth.login.password */
  action?: string
  /** 起始时间(ISO 8601 UTC) */
  since?: string
  /** 结束时间(ISO 8601 UTC) */
  until?: string
}
{
  "page": 1,
  "pageSize": 20,
  "action": "auth.login.password"
}

Response

Body

NameData TypeRequiredDescription
itemsarrayYes日志列表
totalnumberYes总数
pagenumberYes当前页码
pageSizenumberYes每页数量
type ResponseBody = {
  /** 日志列表 */
  items: Record<string, unknown>[]
  /** 总数 */
  total: number
  /** 当前页码 */
  page: number
  /** 每页数量 */
  pageSize: number
}
{
  "items": [
    {
      "logId": "01JD8SNXER6Y9Z5FZ",
      "action": "auth.login.password",
      "resource": "user/01JD8SEGQ0P9N2XK4L7VDH3T6C",
      "result": "success",
      "ip": "203.0.113.24",
      "occurredAt": "2026-10-14T08:00:00Z"
    }
  ],
  "total": 42,
  "page": 1,
  "pageSize": 20
}

HTTP Code

HTTP Status Meaning Notes
200 成功 返回日志列表

Response Code

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

code Meaning Notes
0 成功 返回日志列表

Examples

GET /api/v1/me/logs?page=1&pageSize=20&action=auth.login.password
Authorization: Bearer st_7c1f9e05b28d4a63
{
  "id": "01JD8SNYFS7Z0A6GA",
  "code": 0,
  "messages": [],
  "result": {
    "items": [
      {
        "logId": "01JD8SNXER6Y9Z5FZ",
        "action": "auth.login.password",
        "resource": "user/01JD8SEGQ0P9N2XK4L7VDH3T6C",
        "result": "success",
        "ip": "203.0.113.24",
        "occurredAt": "2026-10-14T08:00:00Z"
      }
    ],
    "total": 42,
    "page": 1,
    "pageSize": 20
  }
}