跳转到主要内容
POST
POST /portal/api/keys

授权

gproxy_session
string
cookie
必填

请求体

application/json

What a portal user may choose when minting a key.

There is no userId: the key is the caller's. The two binding fields are present because a user who belongs to a team wants a key scoped to it, and they are validated by the same rules the admin family applies — the organization and the team must exist, and the caller must be a member of them.

name
string
必填
expiresAtMs
integer<int64> | null

Absent mints a key that never expires.

organizationId
string | null
retainSecret
boolean | null

Keep a sealed copy so the key can be revealed later. False by default: a key the instance cannot reproduce is a key a database leak does not hand over.

teamId
string | null

响应

Success

A minted or rotated key. token is the only time the plaintext travels, apart from an explicit reveal of a key that retained one.

enabled
boolean
必填
expiresAtMs
integer<int64> | null
必填
hasSecret
boolean
必填

Whether the instance retained a sealed copy, i.e. whether reveal can answer for this key.

id
string
必填
name
string
必填
organizationId
string | null
必填
prefix
string
必填

The first characters of the key body, for telling two keys apart.

teamId
string | null
必填
token
string
必填