keys
Get API key by hash
Find out what key this is.
Required Permissions
Your credential must have one of the following permissions for basic key information:
- api.*.read_key (to read keys from any API)
- api.<api_id>.read_key (to read keys from a specific API)
- unkey:v1:<workspace_id>:keyspaces/*/keys/*#read_key (to read keys in any keyspace)
- unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/*#read_key (to read keys in a specific keyspace)
- unkey:v1:<workspace_id>:keyspaces/<keyspace_id>/keys/<key_id>#read_key (to read a specific key)
If your credential lacks permissions but the key exists, we may return a 404 status here to prevent leaking the existence of a key to unauthorized clients. If you believe that a key should exist, but receive a 404, please double check your credential has the correct permissions.
post/v2/keys.whoami
Request body
Example request
{
"key": "sk_1234abcdef5678"
}Response
Successfully retrieved key information.
Example response
{
"meta": {
"requestId": "req_123"
},
"data": {
"keyId": "key_1234567890abcdef",
"start": "sk_test_abc123",
"enabled": true,
"name": "Production API Key",
"createdAt": 1701425400000,
"updatedAt": 1701425400000,
"lastUsedAt": 1701425400000,
"expires": 1735689600000,
"permissions": [
"documents.read",
"documents.write"
],
"roles": [
"editor",
"viewer"
],
"credits": {
"remaining": 1000,
"refill": {
"interval": "daily",
"amount": 1000,
"refillDay": 15
}
},
"identity": {
"ratelimits": [
{
"id": "rl_1234567890abcdef",
"name": "api_requests",
"limit": 1000,
"duration": 3600000,
"autoApply": true
}
]
},
"plaintext": "sk_test_abc123def456",
"ratelimits": [
{
"id": "rl_1234567890abcdef",
"name": "api_requests",
"limit": 1000,
"duration": 3600000,
"autoApply": true
}
]
}
}