Skip to main content

Key Revocation

Revoke API keys instantly by deleting or disabling them in Unkey. Revoked keys fail verification immediately with no propagation delay.
2 min read

When a key is compromised or a user's access should end, you can revoke it immediately. Unkey supports both permanent deletion and temporary disabling.

When to use this#

Security incident

Key was leaked in a public repo or logs. Delete it immediately.

User offboarding

Customer canceled or employee left. Revoke their API access.

Suspicious activity

Unusual traffic patterns. Disable the key while investigating.

Billing issues

Payment failed. Temporarily disable until resolved.

Delete vs Disable#

ActionEffectReversible?Use when
DeletePermanently removes the keyNoKey is compromised, user churned
DisableKey exists but can't authenticateYesTemporary suspension, investigation

Delete a key permanently#

Use when the key should never work again:

The key is invalidated within 60 seconds globally.

Warning

Deletion is permanent. The key cannot be recovered. If you might need to restore access, use disable instead.

Disable a key temporarily#

Use when you want to suspend access but may restore it later:

Verification response when disabled:

Re-enable a disabled key#

The key works again immediately.

Propagation time#

  • Delete: Up to 60 seconds for global invalidation
  • Disable: Up to 60 seconds for global propagation

For immediate revocation of a compromised key, you may want to also:

  1. Rotate any affected secrets downstream
  2. Review audit logs for unauthorized access
  3. Alert the user if appropriate

Bulk revocation#

To revoke all keys for a specific user, query their keys first:

Tip

For security incidents, consider using key rerolling if you need to maintain the user's configuration while replacing the compromised key.

Next steps#