---
title: "Reset Password"
method: POST
path: "/auth/resetPassword"
---

# Reset Password

`POST /auth/resetPassword`

## 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/auth/resetPassword`
- Auth: none declared

凭邮件里的 token 重置密码（无需登录）。

流程：密码长度 -> 图形验证码 -> 校验 token -> 改密 -> 删除 token。
返回：成功 success；密码过短 40005；验证码错 40001；token 无效 40006。
副作用：写库（更新 password_hash）、写 Redis（消费 token）。

安全性：token 用后即删、30 分钟过期，且必须配合图形验证码提交，
因此光拿到 token 还不能重置；但重置成功后并不会踢掉已有的登录会话。

## Query parameters

- `lang` string

## Request body

- ResetPasswordRequest: 凭邮件里的 token 重置密码。 token 由 generate_reset_token() 生成、存于 Redis 且一次性使用； 这里只承载它，有效性由 auth_service 判断。
  - `token` string, required
  - `password` string, required
  - `captcha` string, required

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