NATSidentity.user.register注册账号
Try it 面板需要启用 JavaScript。
以已验证的 OTP 工单注册账号;OTP 工单由 identity_service 回源 otp_service 消费校验。
Request Payload
消息格式:JSON
| Name | Data Type | Required | Description |
|---|---|---|---|
| channel | string | Yes | 注册通道:phone / email |
| target | string | Yes | 手机号或邮箱 |
| verifyTicketId | string | Yes | OTP 已验证工单(scene=register) |
| username | string | No | 用户名(可选) |
| password | string | No | 明文密码,identity_service 哈希后落库(可选) |
type RequestBody = {
/** 注册通道:phone / email */
channel: string
/** 手机号或邮箱 */
target: string
/** OTP 已验证工单(scene=register) */
verifyTicketId: string
/** 用户名(可选) */
username?: string
/** 明文密码,identity_service 哈希后落库(可选) */
password?: string
}{
"channel": "email",
"target": "chen.lin@example.com",
"verifyTicketId": "otv_3d81fa09c2476b5e",
"username": "chenlin",
"password": "J8v#pQ2mXs!a"
}Response Payload
回复使用统一信封 {id, code, messages, result},其 result:
| Name | Data Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | 新用户 ID |
| username | string | No | 用户名 |
| createdAt | string | Yes | 创建时间 |
type ResponseBody = {
/** 新用户 ID */
userId: string
/** 用户名 */
username?: string
/** 创建时间 */
createdAt: string
}{
"userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
"username": "chenlin",
"createdAt": "2026-10-14T08:05:00Z"
}Response Code
回复使用统一信封 {id, code, messages, result},其 code 字段:
| code | Meaning | Notes |
|---|---|---|
| 0 | 成功 | 注册账号 |
| 2009 | 目标已注册 | |
| 2010 | 用户名已占用 | |
| 2202 | OTP 工单无效 | 回源 otp_service 校验失败 |
Examples
{
"channel": "email",
"target": "chen.lin@example.com",
"verifyTicketId": "otv_3d81fa09c2476b5e",
"username": "chenlin",
"password": "J8v#pQ2mXs!a"
}
{
"id": "01JD8SUQ4N6V2X9YU",
"code": 0,
"messages": [],
"result": {
"userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
"username": "chenlin",
"createdAt": "2026-10-14T08:05:00Z"
}
}