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 anexternalId 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.
Request
Specifies which key to update using the database identifier returned from
createKey. Do not confuse this with the actual API key string that users include in requests.Pattern: ^[a-zA-Z0-9_]+$Example: key_2cGKbMxRyIzhCxo1Idjz8qSets a human-readable name for internal organization and identification. Omitting this field leaves the current name unchanged, while setting null removes it entirely.Avoid generic names like “API Key” when managing multiple keys per user or service.Length: 1-255 charactersExample:
Payment Service Production KeyLinks this key to a user or entity in your system for ownership tracking during verification. Omitting this field preserves the current association, while setting null disconnects the key from any identity.Essential for user-specific analytics, billing, and key management across multiple users. Supports letters, numbers, underscores, dots, and hyphens for flexible identifier formats.Length: 1-255 charactersPattern:
^[a-zA-Z0-9_.-]+$Example: user_912a841dStores arbitrary JSON metadata returned during key verification. Omitting this field preserves existing metadata, while setting null removes all metadata entirely.Avoid storing sensitive data here as it’s returned in verification responses. Large metadata objects increase verification latency and should stay under 10KB total size.Example:
Sets when this key automatically expires as a Unix timestamp in milliseconds. Verification fails with
code=EXPIRED immediately after this time passes.Omitting this field preserves the current expiration, while setting null makes the key permanent. Avoid setting timestamps in the past as they immediately invalidate the key.Example: 1704067200000Controls usage-based limits for this key through credit consumption. Omitting this field preserves current credit settings, while setting null enables unlimited usage.Cannot configure refill settings when credits is null, and refillDay requires monthly interval.
The number of credits available for this key.
Defines time-based rate limits that protect against abuse by controlling request frequency. Omitting this field preserves existing rate limits, while setting null removes all rate limits.Unlike credits which track total usage, rate limits reset automatically after each window expires. Multiple rate limits can control different operation types with separate thresholds and windows.
Controls whether the key is currently active for verification requests. When set to
false, all verification attempts fail with code=DISABLED regardless of other settings.Omitting this field preserves the current enabled status. Useful for temporarily suspending access during billing issues, security incidents, or maintenance windows without losing key configuration.Assigns existing roles to this key for permission management through role-based access control. Roles must already exist in your workspace before assignment.During verification, all permissions from assigned roles are checked against requested permissions. Roles provide a convenient way to group permissions and apply consistent access patterns across multiple keys.Example:
["api_admin", "billing_reader"]Grants specific permissions directly to this key without requiring role membership. Wildcard permissions like
documents.* grant access to all sub-permissions including documents.read and documents.write.Direct permissions supplement any permissions inherited from assigned roles.Example: ["documents.read", "documents.write", "settings.view"]Response
The response contains an empty data object on success.Empty object indicating successful update.