POST/api/v1/otp/send发送验证码

向手机号 / 邮箱发送 OTP 并返回挑战工单;无需登录。api_service 编排 otp_service 的 otp.code.request,实际投递经 JetStream 异步执行。

Request

Headers

NameData TypeRequiredDescription
Content-TypestringYes请求体内容类型(默认值 "application/json")
type RequestHeaders = {
  /** 请求体内容类型,默认值 "application/json" */
  Content-Type: string
}
{
  "Content-Type": "application/json"
}

Body

NameData TypeRequiredDescription
channelstringYesphone / email
targetstringYes手机号或邮箱
scenestringYes用途: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

NameData TypeRequiredDescription
ticketIdstringYes挑战工单(校验时携带)
expiresAtstringYes验证码有效期
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" }
}

Remarks

验证码不进任何响应,只随投递渠道到达用户。投递为异步流(otp.send.requested),本接口返回即代表请求受理成功,不代表送达。