POST/api/v1/otp/send发送验证码
Try it 面板需要启用 JavaScript。
向手机号 / 邮箱发送 OTP 并返回挑战工单;无需登录。api_service 编排 otp_service 的 otp.code.request,实际投递经 JetStream 异步执行。
Request
| Name | Data Type | Required | Description |
| Content-Type | string | Yes | 请求体内容类型(默认值 "application/json") |
type RequestHeaders = {
/** 请求体内容类型,默认值 "application/json" */
Content-Type: string
}
{
"Content-Type": "application/json"
}
Body
| Name | Data Type | Required | Description |
| channel | string | Yes | phone / email |
| target | string | Yes | 手机号或邮箱 |
| scene | string | Yes | 用途:login / register / bind |
type RequestBody = {
/** phone / email */
channel: string
/** 手机号或邮箱 */
target: string
/** 用途:login / register / bind */
scene: string
}
{
"channel": "email",
"target": "chen.lin@example.com",
"scene": "login"
}
Response
Body
| Name | Data Type | Required | Description |
| ticketId | string | Yes | 挑战工单(校验时携带) |
| expiresAt | string | Yes | 验证码有效期 |
type ResponseBody = {
/** 挑战工单(校验时携带) */
ticketId: string
/** 验证码有效期 */
expiresAt: string
}
{
"ticketId": "cpt_7d92ab41e0583c6f",
"expiresAt": "2026-10-14T18:10:00Z"
}
HTTP Code
| HTTP Status |
Meaning |
Notes |
| 200 |
成功 |
验证码已入队投递 |
| 429 |
发送频率受限 |
同一目标处于频控窗口 |
Response Code
响应使用统一信封 {id, code, messages, result},其 code 字段:
| code |
Meaning |
Notes |
| 0 |
成功 |
返回挑战工单 |
| 2201 |
发送频率受限 |
同一目标处于频控窗口,稍后重试 |
Examples
POST /api/v1/otp/send
Content-Type: application/json
{
"channel": "email",
"target": "chen.lin@example.com",
"scene": "login"
}
{
"id": "01JD8SXHTR8V0WS",
"code": 0,
"messages": [],
"result": { "ticketId": "cpt_7d92ab41e0583c6f", "expiresAt": "2026-10-14T18:10:00Z" }
}
验证码不进任何响应,只随投递渠道到达用户。投递为异步流(otp.send.requested),本接口返回即代表请求受理成功,不代表送达。