Skip to content

List API keys

GET
/v1/organizations/{id}/api-keys
curl --request GET \
--url https://app.caprid.com/v1/organizations/4/api-keys \
--header 'Authorization: Bearer <token>'

Oldest first. Secrets are never listed, only a preview of each.

id
required
integer

The Organization’s id, from GET /v1/organizations.

Example

4

The Organization’s API keys, expired ones included.

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"
]
}
]

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"
}

No such thing, or not yours. Another customer’s Organization or Namespace is a 404 too, so nobody can tell which ones exist.

Media typeapplication/json
object
error
required
string

Example

{
"error": "the requested grants exceed the key's scope"
}