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

DateChanges
Dec 06 2023Introduced endpoint

Authorizations

Authorization
string
header
required

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.