Update a key's configuration.
The apis.<API_ID>.update_key
permission is required.
Field | Type | Required | Description | Example |
---|---|---|---|---|
KeyID |
string | ✔️ | The id of the key you want to modify | key_123 |
Name |
*string | ➖ | The name of the key | Customer X |
OwnerID |
*string | ➖ | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. Deprecated, use externalId The id of the tenant associated with this key. Use whatever reference you have in your system to identify the tenant. When verifying the key, we will send this field back to you, so you know who is accessing your API. |
user_123 |
ExternalID |
*string | ➖ | The id of the tenant associated with this key. Use whatever reference you have in your system to identify the tenant. When verifying the key, we will send this back to you, so you know who is accessing your API. Under the hood this upserts and connects an ìdentity for you.To disconnect the key from an identity, set externalId: null . |
user_123 |
Meta |
map[string]any | ➖ | Any additional metadata you want to store with the key | { "roles": [ "admin", "user" ], "stripeCustomerId": "cus_1234" } |
Expires |
*int64 | ➖ | The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring. | 0 |
Ratelimit |
*operations.UpdateKeyRatelimit | ➖ | Unkey comes with per-key ratelimiting out of the box. Set null to disable. |
{ "type": "fast", "limit": 10, "refillRate": 1, "refillInterval": 60 } |
Remaining |
*int64 | ➖ | The number of requests that can be made with this key before it becomes invalid. Set null to disable. |
1000 |
Refill |
*operations.UpdateKeyRefill | ➖ | Unkey enables you to refill verifications for each key at regular intervals. | { "interval": "daily", "amount": 100 } |
Enabled |
*bool | ➖ | Set if key is enabled or disabled. If disabled, the key cannot be used to verify. | true |
Roles |
[]operations.Roles | ➖ | The roles you want to set for this key. This overwrites all existing roles. Setting roles requires the rbac.*.add_role_to_key permission. |
[ { "id": "perm_123" }, { "name": "dns.record.create" }, { "name": "dns.record.delete", "create": true } ] |
Permissions |
[]operations.Permissions | ➖ | The permissions you want to set for this key. This overwrites all existing permissions. Setting permissions requires the rbac.*.add_permission_to_key permission. |
[ { "id": "perm_123" }, { "name": "dns.record.create" }, { "name": "dns.record.delete", "create": true } ] |