rootKeys

Creates a new root key secret with the same name, enabled state, expiration, and effective permissions as an existing root key in the authenticated workspace. Requires unkey:v1:<workspace_id>:rootKeys/<key_id>#write, and the caller must already hold every permission of the original key. When expiration is not null, it also requires unkey:v1:<workspace_id>:rootKeys/<key_id>#delete.

expiration controls the original key: 0 revokes it immediately, a positive value keeps it valid for that many milliseconds, and null keeps its current expiration.

post/v2/rootKeys.rerollKey

Request

  • Base URL
    https://api.unkey.com
  • URL
    https://api.unkey.com/v2/rootKeys.rerollKey
  • Auth
    HTTP bearer

Request body

keyIdstring required

Root key identifier returned by rootKeys.createKey or rootKeys.listKeys.

expirationinteger nullable required

Milliseconds until the original root key expires. Use 0 to revoke it immediately. Use null to keep the original key's current expiration. This value never extends an existing expiration.

Response

Root key rerolled. Save the secret now; it cannot be retrieved later.

Example response

{
  "meta": {
    "requestId": "req_123"
  }
}

Changes