Skip to content

List API keys

Deprecated
GET
/v1/account/api-keys
curl --request GET \
--url https://app.caprid.com/v1/account/api-keys \
--header 'Authorization: Bearer <token>'

GET /v1/organizations/{id}/api-keys for the API key’s Organization.

The Organization’s API keys.

Media typeapplication/json
Array<object>
object
id
required

Identifies the key for revoking it. Not a secret.

string
label
required
string
preview
required

The first 6 characters of the secret after sb_, so you can tell keys apart.

string
created_at
required
integer
expires_at

Absent for a key that never expires.

integer
last_used_at

Absent for a key that has never been used.

integer
namespaces

The Namespaces the key is limited to, by name. Absent for a key with no limit. A deleted Namespace drops out, so a key whose Namespaces have all been deleted has [] here and can do nothing.

Array<string>

Example

[
{
"id": "3f9a1c07be42",
"namespaces": [
"acme-staging"
]
}
]

Sent with a session, which may belong to several Organizations. Use the route the message names instead. This route also returns 400 for anything that route would refuse with 400.

Media typeapplication/json
object
error
required
string

Example

{
"error": "this route is for API keys; use /v1/organizations/{id}/api-keys"
}

No valid credential. Missing, expired and revoked credentials all get the same response, and so does an API key whose trial has lapsed. An Agent token from before a claim gets a 401 too, once the claim has made the trial a person’s, with a message saying to get a new token.

Media typeapplication/json
object
error
required
string

Example

{
"error": "the requested grants exceed the key's scope"
}
WWW-Authenticate
string
Example
Bearer realm="switchboard"

Sent with an API key limited to some Namespaces, to a Namespace outside its limit, or to a route that acts on the Organization as a whole. A limited key can never create API keys.

Media typeapplication/json
object
error
required
string

Example

{
"error": "this API key is limited to the Namespaces acme-staging, and acme isn't one of them"
}