Reroll root key
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, a positive value keeps it
valid for that many milliseconds, and null keeps its current expiration. Revoking
the original key can take up to 30 seconds to take effect.
Authorizations
Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs. To authenticate, include the token in the Authorization header of each request:
Root keys have specific permissions attached to them, controlling what operations they can perform. Resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:projects/*/keyspaces/*/keys/*#write.
Security best practices:
- Keep root keys secure and never expose them in client-side code
- Use different root keys for different environments
- Rotate keys periodically, especially after team member departures
- Create keys with minimal necessary permissions following least privilege principle
- Monitor key usage with audit logs.
Body
Milliseconds until the original root key expires. Use 0 to revoke it. Revocation can take up to 30 seconds to take effect. Use null to keep the original key's current expiration. This value never extends an existing expiration.
0 <= x <= 4102444800000Response
Root key rerolled. Save the secret now; it cannot be retrieved later.