注册
OpenAPI 契约
- 方法
- POST
- 路径
/api/v1/auth/register- 认证
- None
- 响应状态
- 201 400 409 429 500
请求与响应 Schema
JSON
{
"requestBody": {
"application/json": {
"$ref": "#/components/schemas/RegisterRequest"
}
},
"responses": {
"201": {
"description": "Account created",
"content": {
"application/json": {}
}
},
"400": {
"description": "Invalid request",
"content": {
"application/json": {
"$ref": "#/components/schemas/RequestError"
}
}
},
"409": {
"description": "Username or email is already registered",
"content": {
"application/json": {
"$ref": "#/components/schemas/ApiError"
}
}
},
"429": {
"description": "Rate limit exceeded",
"content": {
"application/json": {
"$ref": "#/components/schemas/SecurityError"
}
}
},
"500": {
"description": "Unexpected server error",
"content": {
"application/json": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}POST /api/v1/auth/register 为公开接口。以 JSON 提交 username、email 和 password。用户名长度为 3–50,只能包含字母、数字、下划线和连字符。密码长度为 8–100,且必须同时包含大写字母、小写字母和数字。
成功时服务仅确认注册,不签发会话令牌。校验失败会被拒绝;已存在的用户名或邮箱会返回冲突。切勿记录或保留提交的密码。
http
POST /api/v1/auth/register
Content-Type: application/json