How often should you rotate API keys?
Updated October 2026
The honest answer is as often as you can automate it, because every manual rotation schedule eventually gets skipped.
That sounds like a dodge, so here is the reasoning behind it, and the actual factors that should decide your number.
Why "every 90 days" is not really the answer
A lot of security checklists say rotate every 30, 60 or 90 days. NIST's own digital identity guidelines have moved away from forcing a fixed rotation calendar on every credential and toward rotating when there is an actual reason to, like a suspected compromise, because forced periodic rotation without cause tends to push people toward weaker, more predictable secrets instead of safer ones. A key you rotate every 90 days on a sticky note reminder is not meaningfully safer than one you forget to rotate at all, if the reminder gets missed twice in a row.
The real question is not "what number." It is "what actually happens on day 91 when the reminder fires."
The factors that should set your interval
- How exposed the key is. A key that sits in a server environment variable, never printed to a log, never in a repo, can tolerate a longer interval than one that touches a CI pipeline, a public demo, or a tool several people share.
- What the key can do. A read-only analytics key is a different risk than a key that can charge a card or delete a database. Match the interval to the blast radius, not the convenience of one calendar for everything.
- Whether you would even notice a leak. If you have no usage logging on a service, a leaked key could run for months before a bill or an alert tells you. That argues for rotating faster there, not slower, to shrink the window a leak stays useful.
- Whether a human has to remember to do it. This is the factor that actually decides the outcome. Every interval above is theoretical until someone, or something, actually executes the rotation on schedule.
What happens to a manual schedule in practice
Someone sets a 90-day reminder. The reminder fires during a sprint, a launch, a vacation. It gets snoozed once, then forgotten. Nobody notices until an audit, an incident, or a leak forces the question. This is not a hypothetical about careless teams. It is the default outcome of asking a person to remember something recurring that has no immediate consequence for skipping it, over and over, for years.
GitGuardian's State of Secrets Sprawl 2025 report found that 70% of secrets leaked on GitHub in 2022 were still valid three years later, in 2025. Those were not keys rotated on some schedule and then leaked anyway. Most of them were never rotated at all.
The actual answer
Pick the shortest interval you can run without a human in the loop, for the keys that matter. If you cannot automate it yet, pick the longest interval you will genuinely keep, write down the actual date you will do it next, and treat a missed date as the real signal that the schedule needs to change, not the key.
This is the whole case for automating rotation instead of scheduling it. Key Robot runs in your own GitHub Actions and rotates a connected key on a schedule (weekly by default, daily on Vercel), no reminder required. It makes a new key, checks your app still works, and deletes the old one, then puts the old one back if anything fails. There is also a Kill it now button for a key that needs to change right now, outside the schedule. We timed that button on our own demo app on October 23, 2026: 82 seconds from pressing it to the old key being dead.
Today it covers 16 services, including OpenAI, AWS, Stripe webhooks, Neon and Supabase, for apps on Netlify, Vercel, Render, Railway or Cloudflare Workers. Keys are locked in your browser before anything is sent and saved as encrypted GitHub Actions secrets in your own account. Free for one app, no card.
See the full rotate hub for the manual steps per service if you are not ready to automate yet, or the ranked list of rotation tools if you are comparing more than one way to get there.
Questions
Is there one correct number of days to rotate API keys?
No single number fits every key. What matters more is whether the rotation actually happens on schedule, not whether the schedule says 30 days or 90.
Do security standards give a specific rotation interval?
Some do as a baseline, not a universal rule. NIST's guidance has moved toward rotating credentials based on risk and evidence of compromise rather than a fixed calendar interval for every secret.
What if I cannot commit to rotating on a fixed schedule?
That is the actual case for automating it. A schedule a human has to remember gets skipped. A schedule a script runs does not.