POST /admin/users

创建新用户账号并返回用户信息

身份认证 `bearerAuth` application/json

请求体

Schema: service-identity/internal/handler/dto.HTTPUserCreateRequest

字段类型必填示例约束描述
password string 是 length: 8–? Password or hash (取决于 password_transmission)
email string 否 Email
force_password_change boolean 否 Force user to change password on first login
metadata object 否 extra keys: `string` Metadata
password_transmission string 否 plain|hash|symmetric|asymmetric
phone string 否 Phone
username string 否 Username

响应

引用的 Schema

service-identity/internal/handler/dto.AuthUserResponse

认证用户信息

字段类型必填示例约束描述
age_group string 否 年龄分组
birth_date string 否 出生日期 (RFC3339)
created_at string 否 2026-01-01T00:00:00Z 创建时间
email string 否 john@example.com 邮箱
email_verified_at string 否 2026-01-10T08:00:00Z 邮箱验证时间
id string 否 usr_abc123 用户ID
is_minor boolean 否 是否未成年人
last_login_at string 否 2026-04-14T10:30:00Z 最后登录
last_login_ip string 否 192.168.1.1 最后登录IP
locked_until string 否 2026-04-15T12:00:00Z 锁定截止
login_fail_count integer 否 0 失败次数
metadata object 否 扩展元数据
mfa_enabled boolean 否 False 是否启用MFA
mfa_type string 否 totp MFA类型
must_change_password boolean 否 False 需要强制修改密码
password_changed_at string 否 密码最后修改时间
pending_parental_consent boolean 否 是否等待家长同意
phone string 否 13800138000 手机号
phone_verified_at string 否 2026-01-10T08:00:00Z 手机验证时间
status string 否 active 状态
tenant_id string 否 tnt_xyz789 租户ID
updated_at string 否 2026-04-10T14:20:00Z 更新时间
username string 否 john_doe 用户名

service-identity/internal/handler/dto.CreateUserResponse

字段类型必填示例约束描述
code integer 否
data service-identity/internal/handler/dto.UserWithIdentitiesResponse 否
message string 否
timestamp string 否

service-identity/internal/handler/dto.IdentityResponse

用户身份凭证信息

字段类型必填示例约束描述
created_at string 否 2026-01-01T00:00:00Z 创建时间
id string 否 id_abc123 凭证ID
identifier string 否 j***@example.com 标识(脱敏)
is_primary boolean 否 True 是否主凭证
is_verified boolean 否 True 是否验证
type string 否 email 类型
user_id string 否 usr_abc123 用户ID
verified_at string 否 2026-01-10T08:00:00Z 验证时间

service-identity/internal/handler/dto.UserWithIdentitiesResponse

字段类型必填示例约束描述
identities array of

参见 service-identity/internal/handler/dto.IdentityResponse

否
user service-identity/internal/handler/dto.AuthUserResponse 否