POST
/
v1
/
keys.whoami
curl --request POST \
  --url https://api.unkey.dev/v1/keys.whoami \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "key": "sk_123"
}'
{
  "id": "key_123",
  "name": "API Key 1",
  "remaining": 1000,
  "identity": {
    "id": "id_123",
    "externalId": "ext123"
  },
  "meta": {
    "role": "admin",
    "plan": "premium"
  },
  "createdAt": 1620000000000,
  "enabled": true,
  "environment": "production"
}

Changelog

DateChanges
Oct 07 2024Introduced endpoint

You may not always have easy access to the keyId and therefore can’t use /v1/keys.getKey. This offers an escape hatch to send us the real key instead.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
key
string
required

The actual key to fetch

Minimum length: 1
Example:

"sk_123"

Response

200
application/json
The configuration for a single key
id
string
required

The ID of the key

Example:

"key_123"

createdAt
integer
required

The timestamp in milliseconds when the key was created

Example:

1620000000000

enabled
boolean
required

Whether the key is enabled

Example:

true

name
string

The name of the key

Example:

"API Key 1"

remaining
integer

The remaining number of requests for the key

Example:

1000

identity
object

The identity object associated with the key

meta
object

Metadata associated with the key

Example:
{ "role": "admin", "plan": "premium" }
environment
string

The environment the key is associated with

Example:

"production"