POST/api/v1/otp/verify校验验证码

校验用户收到的验证码,换取一次性已验证工单(verifyTicket),供注册 / 登录 / 绑定回源消费。api_service 编排 otp_service 的 otp.code.verify。

Request

Headers

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

Body

NameData TypeRequiredDescription
ticketIdstringYes挑战工单(otp/send 返回)
codestringYes用户收到的验证码
type RequestBody = {
  /** 挑战工单(otp/send 返回) */
  ticketId: string
  /** 用户收到的验证码 */
  code: string
}
{
  "ticketId": "cpt_7d92ab41e0583c6f",
  "code": "582914"
}

Response

Body

NameData TypeRequiredDescription
verifyTicketIdstringYes已验证工单(一次性)
channelstringYes通道:phone / email
targetstringYes验证目标
type ResponseBody = {
  /** 已验证工单(一次性) */
  verifyTicketId: string
  /** 通道:phone / email */
  channel: string
  /** 验证目标 */
  target: string
}
{
  "verifyTicketId": "otv_8a24de63b917c05f",
  "channel": "email",
  "target": "chen.lin@example.com"
}

HTTP Code

HTTP Status Meaning Notes
200 成功 返回已验证工单
400 校验失败 工单无效或验证码错误
429 尝试次数超限 单码校验次数用尽,须重新发送

Response Code

响应使用统一信封 {id, code, messages, result},其 code 字段:

code Meaning Notes
0 成功 返回已验证工单
2202 工单无效 不存在或已过期
2203 验证码错误 与预期不符;单码最大校验次数用尽作废,同样返回 2203

Examples

POST /api/v1/otp/verify
Content-Type: application/json

{
  "ticketId": "cpt_7d92ab41e0583c6f",
  "code": "582914"
}
{
  "id": "01JD8SXIUS9W1XT",
  "code": 0,
  "messages": [],
  "result": {
    "verifyTicketId": "otv_8a24de63b917c05f",
    "channel": "email",
    "target": "chen.lin@example.com"
  }
}

Remarks

同一挑战工单只成功校验一次;已验证工单在下游(注册 / 登录 / 绑定)回源消费后立即失效,不可重放。