---
title: "Send Email Code"
method: POST
path: "/auth/sendEmailCode"
---

# Send Email Code

`POST /auth/sendEmailCode`

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

发送注册邮箱验证码。同一邮箱 60 秒内只能请求一次；验证码 5 分钟内有效。

返回：成功是 success；命中冷却返回 40008；邮箱已注册返回 40003；发信失败返回 50011。
副作用：写 Redis（验证码 + 冷却键）、向外部邮件服务发起发送请求。

顺序上先写 Redis 再发信：这样即使发信失败，冷却键也已经落下，
用户必须等冷却结束才能重试 —— 用「可能多等 60 秒」换「不会因发信故障被无限刷」。
另外，对已注册邮箱直接返回 email_exists，等于暴露了「该邮箱是否已注册」，
这是产品上为了方便用户（提示去登录）而接受的取舍。

## Query parameters

- `lang` string

## Request body

- SendEmailCodeRequest: 请求发送邮箱验证码。发送频率受 EMAIL_CODE_COOLDOWN 限制。
  - `email` 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)
