# Rotating API Keys

> Rotates a service's API key — generates the replacement, updates each consumer, and retires the old key after the overlap window. Use on a rotation schedule or after a suspected exposure.

- Skill: `brokenrobot-xyz/rotating-api-keys` (Agent Skill)
- Install (CLI): `npx skillmds@latest add brokenrobot-xyz/rotating-api-keys`
- Raw SKILL.md: https://api.skillmd.com/api/skills/brokenrobot-xyz/rotating-api-keys/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: brokenrobot-xyz (https://skillmd.com/u/brokenrobot-xyz)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/brokenrobot-xyz/rotating-api-keys

---


# Rotate an API key

Rotate one service's key with an overlap window, so no consumer loses access mid-rotation.

## Steps

1. Set up the replacement key in the provider console and point the staging consumer to it.
2. Verify staging traffic against the replacement key before you touch production, because a bad
   key caught in staging costs a retry instead of an outage.
3. Update each production consumer to the replacement key, one consumer at a time.
4. Don't retire the old key before every consumer reports healthy on the replacement, because an
   early retirement cuts off every consumer still on the old key.
5. Retire the old key and log the rotation date.

