---
title: "Change Password"
method: POST
path: "/auth/changePassword"
---

# Change Password

`POST /auth/changePassword`

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

已登录用户改密：先验旧密码，再写入新密码。

Logged-in user: verify current password, then set new password.

参数 session 由 require_login 注入，未登录会直接 401（sub_code=40101）。
返回：成功 success；新密码过短 40005；用户不存在 40402；旧密码错 40111。
副作用：写库（更新 password_hash）—— 用户身份取 session 而非请求体，避免越权改他人密码。

## Query parameters

- `lang` string

## Request body

- ChangePasswordRequest: Logged-in user change password: current + new. 中文：已登录用户改密。要求提供原密码，因此此接口调用前 必须先通过会话鉴权（require_login）。
  - `current_password` string, required
  - `new_password` 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)
