Skip to content

Read an API key

View as Markdown
GET
/v1/tokens/{tokenId}
curl --request GET \
--url https://example.com/v1/tokens/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Authorization: Bearer <token>'

Never returns the secret. A tenant admin reads any key; anyone else only their own (someone else’s reads as missing), and a key or session with limits only those within them, as for the list.

tokenId
required
string format: uuid

ApiTokenId — opaque branded string (a UUID).

The key.

Media typeapplication/json

An API key. Never includes the secret. principal is whom it acts for; absent on a key that is a service account of its own (service_account:<tokenId>), as keys minted before principals are.

object
tokenId
required
string format: uuid
principal

Whom an API key acts for: a person, or a service account.

object
kind
required
string
Allowed values: user service-account
id
required

The user id, or the service account id.

string
>= 1 characters
role
required

The most the key may do, under its principal’s grants: an admin key may administer the workspace when its principal is a tenant admin; a member key takes no admin action on the workspace, whoever it’s for; below it, its principal’s roles hold (a project admin’s member key administers that project).

string
Allowed values: admin member
capabilities
required

Framework capabilities the key carries (env:write, secrets:write, …). A caller can only grant capabilities it holds.

Array<string>
label
string
projectId

The project the key is limited to.

string format: uuid
readOnly

Present and true when the key only reads.

boolean
createdBy

Who minted it: user:<id> or service_account:<id>.

string
createdAt
required
string format: date-time
expiresAt
string format: date-time
revokedAt

Set once revoked; a revoked key never authenticates again.

string format: date-time
lastUsedAt

When the key last authenticated a request (updated at most once a minute).

string format: date-time
mintedWith

The key it was minted with: the minter’s key, or the key a token sign-in session was opened with. It stops when that key is revoked. Absent when none was, and for a key minted before keys recorded it.

string format: uuid
Example
{
"principal": {
"kind": "user"
},
"role": "admin"
}

Missing / malformed / expired / revoked bearer token.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

A caller with no keys of its own that is not a tenant admin. Or one of the caller’s own keys beyond its limits: not limited to the caller’s project (key-project-mismatch), or an admin key for a caller with the member role (permission-denied).

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

No token with that id that the caller may see.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}
Retry-After
integer
>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

The database was too busy to answer in time (database-busy), or the authorization store couldn’t be reached (authz-backend-unavailable); Retry-After (whole seconds) says when to try again.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}
Retry-After
integer
>= 1

Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.

See also