Field | Type | Required | Description | Example |
---|---|---|---|---|
apiId |
string | ✔️ | Choose an API where this key should be created. |
api_123 |
prefix |
string | ➖ | To make it easier for your users to understand which product an api key belongs to, you can add prefix them. For example Stripe famously prefixes their customer ids with cus_ or their api keys with sk_live_. The underscore is automatically added if you are defining a prefix, for example: "prefix": "abc" will result in a key like abc_xxxxxxxxx |
|
name |
string | ➖ | The name for your Key. This is not customer facing. | my key |
byteLength |
number | ➖ | The byte length used to generate your key determines its entropy as well as its length. Higher is better, but keys become longer and more annoying to handle. The default is 16 bytes, or 2^^128 possible combinations. | |
ownerId |
string | ➖ | Your user’s Id. This will provide a link between Unkey and your customer record. When validating a key, we will return this back to you, so you can clearly identify your user from their api key. |
team_123 |
meta |
Record<string, any> | ➖ | This is a place for dynamic meta data, anything that feels useful for you should go here | { "billingTier": "PRO", "trialEnds": "2023-06-16T17:16:37.161Z" } |
expires |
number | ➖ | You can auto expire keys by providing a unix timestamp in milliseconds. Once Keys expire they will automatically be disabled and are no longer valid unless you enable them again. | 1623869797161 |
remaining |
number | ➖ | You can limit the number of requests a key can make. Once a key reaches 0 remaining requests, it will automatically be disabled and is no longer valid unless you update it. Learn more |
1000 |
ratelimit |
operations.PostV1KeysRatelimit | ➖ | Unkey comes with per-key ratelimiting out of the box. | { "type": "fast", "limit": 10, "refillRate": 1, "refillInterval": 60 } |