Keys
Create a key
API Documentation
- Overview
- Authentication
- Errors
- Errors v2
- Keys
- APIs
- Permissions
- Identities
- Ratelimits
- Analytics
- Migrations
Keys
Create a key
POST
/
v1
/
keys.createKey
curl --request POST \
--url https://api.unkey.dev/v1/keys.createKey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"apiId": "api_123",
"prefix": "<string>",
"name": "my key",
"byteLength": 16,
"ownerId": "team_123",
"externalId": "team_123",
"meta": {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
},
"roles": [
"admin",
"finance"
],
"permissions": [
"domains.create_record",
"say_hello"
],
"expires": 1623869797161,
"remaining": 1000,
"refill": {
"interval": "monthly",
"amount": 100,
"refillDay": 15
},
"ratelimit": {
"type": "fast",
"limit": 10,
"duration": 60000
},
"enabled": false,
"recoverable": false,
"environment": "<string>"
}'
{
"keyId": "key_123",
"key": "prefix_xxxxxxxxx"
}
Create a new key.
Changelog
Date | Changes |
---|---|
Dec 06 2023 | Introduced endpoint |
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
application/json
Response
200
application/json
The configuration for an api
The response is of type object
.
Was this page helpful?
curl --request POST \
--url https://api.unkey.dev/v1/keys.createKey \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"apiId": "api_123",
"prefix": "<string>",
"name": "my key",
"byteLength": 16,
"ownerId": "team_123",
"externalId": "team_123",
"meta": {
"billingTier": "PRO",
"trialEnds": "2023-06-16T17:16:37.161Z"
},
"roles": [
"admin",
"finance"
],
"permissions": [
"domains.create_record",
"say_hello"
],
"expires": 1623869797161,
"remaining": 1000,
"refill": {
"interval": "monthly",
"amount": 100,
"refillDay": 15
},
"ratelimit": {
"type": "fast",
"limit": 10,
"duration": 60000
},
"enabled": false,
"recoverable": false,
"environment": "<string>"
}'
{
"keyId": "key_123",
"key": "prefix_xxxxxxxxx"
}