Skip to Content
🎉 BSH Engine v0.0.7 is out with new features and improvements. See what's new →

Expire Signing Key

Expire a retired signing key now, without waiting for its grace window to end. Use it when a retired key has leaked. This action cannot be undone.

POST /api/auth/signing-keys/{kid}/expire

Path Parameters

ParameterTypeRequiredDescription
kidstringyesThe ID of the key to expire

Request Body

{ "reason": "Key exposed in a backup" }
FieldTypeRequiredDescription
reasonstringyesWhy the key is expired. At least 5 characters.

Response

Success Response (200 OK):

{ "code": 200, "message": "JWT signing key expired", "data": [ { "kid": "a82791af-...", ... "status": "Expired", "reason": "Key exposed in a backup" } ], "meta": { "type": "Signing Key Expiry" } }

Tokens signed by the key are rejected immediately, and their users have to log in again. Expiring a key that is already Expired returns it unchanged.

Error Responses

400 Bad Request - The key is the active one:

{ "code": 400, "error": "The active JWT signing key cannot be expired, rotate it instead", "meta": { "type": "Signing Key Expiry", "tips": { "rotate": "POST /api/auth/signing-keys/rotate with {\"expire\": \"previous\"}" } } }
  • To replace the active key and expire it in one step, use Rotate with "expire": "previous".
  • Expiring a key is permanent.
Last updated on