PAT 签发(登录态;完整明文只回显一次;带 x-tansr-org 头 = org 的 key,owner/admin;每 IP 认证严档)
POST
/v1/api-keys
const url = 'https://api.tansr.com/v1/api-keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","scopes":"data","expiresInDays":1}'};
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/api-keys \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "scopes": "data", "expiresInDays": 1 }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”x-tansr-org
string
Org 作用域声明(org 公开 id);服务端校验成员资格与角色,非成员恒 404、角色不够 403
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”已签发
Media typeapplication/json
object
key
required
一次性回显的完整 PAT(tansr_sk_…);库存 sha256
string
Example
{ "apiKey": { "status": "active" }}Limit_exceeded(每 owner PAT 存量上限,active 档计数;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" }}非登录态(PAT 不可管理 PAT)/ org 角色不够
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" }}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" }}本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。