---
title: "Get User Activity"
method: GET
path: "/admin/users/{user_id}/activity"
---

# Get User Activity

`GET /admin/users/{user_id}/activity`

## Request

- Base URL: `https://api.twtapi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.twtapi.com/admin/users/{user_id}/activity`
- Auth: none declared

单个用户的活动视图：最近调用明细 + 端点/搜索词 Top10。

与 /logs 的区别：这里会把数字 user_id 还原成 @用户名，并做聚合统计。

关键取舍：用户名只读缓存（_resolve_cached_twitter_usernames），不发上游请求，
防止后台页面被上游 RT 拖住；冷缓存时优先展示数字 id。

聚合口径：先对原始兴趣点做统计、再逐条做用户名替换。替换是一一对应的
（同一 id 只会替换成同一个 @name），所以不会把同一次搜索拆成两条。
传给替换函数的是 dict(...) 浅拷贝，正是为了不污染 raw_interests。

副作用：只读（User 存在性校验 + 日志查询 + Redis 读）。

## Path parameters

- `user_id` integer, required

## Query parameters

- `size` integer

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/twtapi/apis/twtapi-backend.md) · [All operations](https://skmtc.dev/twtapi/apis/twtapi-backend/llms.txt) · [OpenAPI document](https://skmtc.dev/twtapi/apis/twtapi-backend/revisions/5295976febaf?raw)
