---
title: "Update Limits"
method: POST
path: "/admin/users/{user_id}/limits"
---

# Update Limits

`POST /admin/users/{user_id}/limits`

## 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}/limits`
- Auth: none declared

单独调整用户的两级限流（每秒/每小时请求数）。

用 None 判断而非真值判断：显式的 0 是合法值（表示"不限速/封禁"），
若写成 `if body.rate_limit_per_second:` 会导致传 0 被静默忽略。

副作用：写库（commit）+ 清该用户鉴权缓存（限流值缓存在其中）。

## Path parameters

- `user_id` integer, required

## Request body

- AdminLimitUpdate: 管理员覆盖用户级限流。传 None 表示清除覆盖、回退到套餐默认值。
  - `rate_limit_per_second` integer, nullable
  - `rate_limit_per_hour` integer, nullable

## 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)
