自助注销确认执行(JWT 登录态):校验挑战 OTP 通过即调匿名化内核(email→不可逆占位/name 清空/status=deleted/登录身份与发票档删除;台账/计量/账单行恒不动)+ 全量凭据切断(refresh 与 api keys 全吊销 + 在外 access 用户级切断恒拒)+ 审计在册(actor=本人,原邮箱打码);同邮箱可重注册得全新账户;管理侧 /admin/v1/users/:id/anonymize 保持不动
POST
/v1/account/anonymize
const url = 'https://api.tansr.com/v1/account/anonymize';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"challengeId":"example","otp":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tansr.com/v1/account/anonymize \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "challengeId": "example", "otp": "example" }'Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
challengeId
required
string
otp
required
账户邮箱收到的 6 位确认码
string
Examplegenerated
{ "challengeId": "example", "otp": "example"}Responses
Section titled “Responses”已注销({ok: true};本响应后全部既有凭据即刻失效)
Media typeapplication/json
object
ok
required
boolean
Example
{ "ok": true}Otp_invalid(码错/挑战过期或查无/他人挑战,不泄露存在性;与登录 OTP 同码)
Media typeapplication/json
object
error
required
object
code
required
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
string
message
required
string
requestId
required
string
detail
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}Unauthorized(未认证)
Media typeapplication/json
object
error
required
object
code
required
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
string
message
required
string
requestId
required
string
detail
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}Forbidden(PAT 主体;须登录态 JWT)
Media typeapplication/json
object
error
required
object
code
required
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
string
message
required
string
requestId
required
string
detail
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}Otp_rate_limited(校验尝试超限即毁挑战)/ rate_limited(每 IP 认证严档,T-A28)
Media typeapplication/json
object
error
required
object
code
required
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
string
message
required
string
requestId
required
string
detail
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。