POST
/
v1
/
keys.updateKey

Changelog

DateChanges
Dec 06 2023Introduced endpoint

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Update a key's configuration. The apis.<API_ID>.update_key permission is required.

keyId
string
required

The id of the key you want to modify

name
string | null

The name of the key

ownerId
string | null
deprecated

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.

externalId
string | null

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.

meta
object | null

Any additional metadata you want to store with the key

expires
integer | null

The unix timestamp in milliseconds when the key will expire. If this field is null or undefined, the key is not expiring.

ratelimit
object | null

Unkey comes with per-key ratelimiting out of the box. Set null to disable.

remaining
integer | null

The number of requests that can be made with this key before it becomes invalid. Set null to disable.

refill
object | null

Unkey enables you to refill verifications for each key at regular intervals.

enabled
boolean

Set if key is enabled or disabled. If disabled, the key cannot be used to verify.

roles
object[]

The roles you want to set for this key. This overwrites all existing roles. Setting roles requires the rbac.*.add_role_to_key permission.

permissions
object[]

The permissions you want to set for this key. This overwrites all existing permissions. Setting permissions requires the rbac.*.add_permission_to_key permission.

Response

200 - application/json

The response is of type object.