API Documentation
- Overview
- Authentication
- Errors
- Errors v2
- Keys
- APIs
- Permissions
- Identities
- Ratelimits
- Analytics
- Migrations
Keys
Verify a key
POST
/
v1
/
keys.verifyKey
Copy
curl --request POST \
--url https://api.unkey.dev/v1/keys.verifyKey \
--header 'Content-Type: application/json' \
--data '{
"apiId": "api_1234",
"key": "sk_1234",
"tags": [
"path=/v1/users/123",
"region=us-east-1"
],
"authorization": {
"permissions": "<string>"
},
"remaining": {
"cost": 1
},
"ratelimit": {
"cost": 1
},
"ratelimits": [
{
"name": "requests",
"limit": 500,
"duration": 3600000
},
{
"name": "tokens",
"limit": 20000,
"duration": 86400000
}
]
}'
Copy
{
"keyId": "key_1234",
"valid": true,
"name": "Customer X",
"ownerId": "user_123",
"meta": {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
},
"expires": 123,
"ratelimit": {
"limit": 10,
"remaining": 9,
"reset": 3600000
},
"remaining": 1000,
"code": "VALID",
"enabled": true,
"permissions": [
"dns.record.update",
"dns.record.delete"
],
"roles": [
"admin"
],
"environment": "test",
"identity": {
"id": "<string>",
"externalId": "<string>",
"meta": {}
},
"requestId": "<string>"
}
Changelog
Date | Changes |
---|---|
Dec 06 2023 | Introduced endpoint |
Jul 08 2024 | Added EXPIRED code |
Body
application/json
Response
200
application/json
The verification result
The response is of type object
.
Was this page helpful?
Copy
curl --request POST \
--url https://api.unkey.dev/v1/keys.verifyKey \
--header 'Content-Type: application/json' \
--data '{
"apiId": "api_1234",
"key": "sk_1234",
"tags": [
"path=/v1/users/123",
"region=us-east-1"
],
"authorization": {
"permissions": "<string>"
},
"remaining": {
"cost": 1
},
"ratelimit": {
"cost": 1
},
"ratelimits": [
{
"name": "requests",
"limit": 500,
"duration": 3600000
},
{
"name": "tokens",
"limit": 20000,
"duration": 86400000
}
]
}'
Copy
{
"keyId": "key_1234",
"valid": true,
"name": "Customer X",
"ownerId": "user_123",
"meta": {
"roles": [
"admin",
"user"
],
"stripeCustomerId": "cus_1234"
},
"expires": 123,
"ratelimit": {
"limit": 10,
"remaining": 9,
"reset": 3600000
},
"remaining": 1000,
"code": "VALID",
"enabled": true,
"permissions": [
"dns.record.update",
"dns.record.delete"
],
"roles": [
"admin"
],
"environment": "test",
"identity": {
"id": "<string>",
"externalId": "<string>",
"meta": {}
},
"requestId": "<string>"
}
Assistant
Responses are generated using AI and may contain mistakes.