Update key properties in response to plan changes, subscription updates, or account status changes.
Use this for user upgrades/downgrades, role modifications, or administrative changes. Supports partial updates - only specify fields you want to change. Set fields to null to clear them.
Important: Permissions and roles are replaced entirely. Use dedicated add/remove endpoints for incremental changes.
Required Permissions
Your root key must have one of the following permissions:
api.*.update_key
(to update keys in any API)api.<api_id>.update_key
(to update keys in a specific API)Side Effects
If you specify an externalId
that doesn’t exist, a new identity will be automatically created and linked to the key. Permission updates will auto-create any permissions that don’t exist in your workspace. Changes take effect immediately but may take up to 30 seconds to propagate to all edge regions due to cache invalidation.
Unkey uses API keys (root keys) for authentication. These keys authorize access to management operations in the API. To authenticate, include your root key in the Authorization header of each request:
Authorization: Bearer unkey_123
Root keys have specific permissions attached to them, controlling what operations they can perform. Key permissions follow a hierarchical structure with patterns like resource.resource_id.action
(e.g., apis.*.create_key
, apis.*.read_api
).
Security best practices:
Key updated successfully. Changes take effect immediately with up to 30-second edge propagation.
The response is of type object
.