Planned rotation
- Create a replacement with the same scopes.
- Deploy the new key alongside the old one.
- Make a real request and confirm the usage shows under the new key.
- Move every workload, then revoke the old key.
- Confirm the old key fails and nothing still uses it.
Emergency rotation
- Revoke at once when continued exposure is riskier than an interruption.
- Deploy a new key through your normal secret path.
- Search source code, build output, CI variables, logs, browser bundles, screenshots and tickets for the exposed value.
- Review the key's usage, keeping only safe identifiers for the investigation.
API keys and webhook secrets rotate differently
An API key works alone: once rotated or revoked, the old value stops working. A webhook signing secret can overlap with the previous secret for a short time, because deliveries already on their way may still be signed with it.
Confirming the rotation
- The new key works for the expected operations and environment.
- The old key returns 401.
- No deployed service still refers to the old key.
- Any unexpected requests or request-unit use has been looked into and written up, without copying keys.