创建应用(name 必填)→ {app, apiKey}:ApiKey 密文(tsk_+40 位 base62)唯一一次回显,库存 sha256(org 语境 owner/admin);expiresAt 缺省 now+365d(显式 null = 有意长期,写审计;存量行不动)、signRequired 请求签名强制位(缺省 false)
const url = 'https://api.tansr.com/v1/apps';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","expiresAt":"example","signRequired":true,"deviceBound":true,"platform":"desktop"}'};
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/apps \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "expiresAt": "example", "signRequired": true, "deviceBound": true, "platform": "desktop" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Org 作用域声明(org 公开 id);服务端校验成员资格与角色,非成员恒 404、角色不够 403
Request Bodyrequired
Section titled “Request Bodyrequired”object
请求签名强制位:缺席 = 缺省 true(CW5-7 新键恒强制;未签名 /t1 恒 401 signature_invalid);显式 false = 兼容档(存量集成逃生口);存量键不动
装置绑定位:true = CLI 派生装置键(同账户同名活跃绑定键唯一,撞名 409 conflict 恒不静默顶替);缺席/false = console 径(名称不设唯一约束);存量键不动
Responses
Section titled “Responses”已建(密文唯一一次)
object
object
离组收回旧凭据;应用仍归组织,须当前组织管理员轮换。旧令牌和双头立即失效。
object
ApiKeyId(api_keys.public_id;门户/审计/报表同键,可公开引用)
密文展示前缀(tsk_ + 6);密文仅创建/轮换各回显一次,hash 永不回读
True = 未签名 /t1 请求恒 401 signature_invalid
True = CLI init 派生装置绑定键(走用户层能力控制面,应用配置对其不生效)
ApiKey 密文(tsk_ + 40 位 base62)唯一一次回显;库存 sha256
Example
{ "app": { "ownership": { "type": "user" }, "permissions": { "deletionRequestUnavailableReason": "org_governance_disabled" }, "status": "active", "platform": "desktop" }}Limit_exceeded(每 owner 应用存量上限,active 档计数;T-A28)
object
object
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}Forbidden(org 角色不够 / PAT 缺 control scope)
object
object
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}Rate_limited(每 IP 认证严档,T-A28)
object
object
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。