Skip to content
StripeSecret API key

How to rotate a Stripe secret key without downtime

Reissue a Stripe secret or restricted key inside the Dashboard's grace period of up to 7 days, roll the new value out, then expire the old key once it is idle.

StripeSecret API key

Starts with: sk_live_…
Where to issue a new one
dashboard.stripe.com/apikeys
What a leaked key reaches
A secret key has unrestricted permissions on all Stripe APIs of the account; a restricted key carries only the permissions you grant.
Can be scoped
Partly

Some key types can be limited, others carry full rights.

Expires
Until you expire or rotate it
Switching keys
Overlap windowRevokes at once

What Crunu does here

Crunu doesn't reissue keys at providers. It shows which values to replace and keeps the new one.

Build the list for a departure with the offboarding checklist
On this page

Rotate the key from the API keys page of the Stripe Dashboard and choose an expiration date instead of Now. Stripe issues the replacement at once and keeps the old key working for up to 7 days, so you can move every service before anything breaks (Stripe Docs). Put the new value where your services read it, restart them, watch the old key's request logs fall to zero, and only then let it expire. If a week is too short, create a second key by hand, move to it at your own pace, and expire the first one afterwards.

Crunu doesn't reissue keys at Stripe or at any other provider. It shows which values a departing person or a leak exposed, keeps the new key as a new version of the environment, and restarts the programs that read it. The rotation itself always happens in your Stripe Dashboard.

Which Stripe key you are reissuing

Stripe has four kinds of API keys, and they don't carry the same risk:

  • Secret key, sk_live_…: unrestricted permissions on all Stripe APIs of the account. Most older backends use one, and it is the subject of this page.
  • Restricted key, rk_live_…: only the permissions you grant. Stripe recommends restricted keys for most uses and suggests moving secret-key integrations to them. They rotate the same way, and the replacement keeps the rotated key's name.
  • Organization key, sk_org_…: acts at the level of a Stripe organization that manages several accounts at once.
  • Publishable key, pk_live_…: built for front-end code. It can be rotated but not expired, and seeing it gives nobody new powers.

Webhook signing secrets are separate from API keys. Every webhook endpoint has its own, under Webhooks in the Dashboard, so reissue those as well if the person could read them. Sandbox keys start with sk_test_ and rk_test_ and reach only test data, which is why live keys come first.

Reissue without downtime

  1. On the API keys page, open the menu (⋯) next to the key, choose Rotate key, and set Expiration to a date inside the 7-day limit. Copy the new value before you close the dialog, because Stripe says you can't retrieve it later.
  2. In Crunu, open the environment that holds it, for example payments-api / production, replace the value of STRIPE_SECRET_KEY and press Save. That creates a new version. History records who saved it and when, naming the variable but never showing the value.
  3. Restart every consumer. A service started with crunu run --restart on-change picks up the new version and restarts by itself; CI secrets and variables kept in a hosting platform need a manual update.
  4. Switch a small group of servers first, as Stripe suggests, and look for errors. Then open View request logs from the old key's menu and wait until its traffic has stayed at zero for a few hours or days.
  5. Choose Expire key on the old key if its scheduled expiration hasn't arrived yet. From that moment, any request that still uses it gets an authentication error.

On a server, the service line looks like this. After a new version arrives and 2 seconds pass without further changes, crunu sends the program SIGTERM and starts it again with the new variables:

Shell
crunu run --env payments-api/production --restart on-change -- /opt/payments/bin/server

When to reissue a Stripe key

Stripe's own list of reasons to rotate a key covers the cases that matter for a team:

  • Someone leaves or changes roles. Stripe names this explicitly. In Crunu, removing the person produces an exposure report and a reissue checklist, and STRIPE_SECRET_KEY appears on the checklist if a version they received still holds the current value.
  • A leak. If the key may be compromised, don't keep it alive for a week. Rotate with Now, which deletes the old key at once, and accept a short interruption while services restart.
  • A schedule. If your policy requires rotation at fixed intervals, Stripe can also schedule a key to rotate after a set time.
  • A lost key. A live key you created yourself can't be revealed again, so losing it means rotating it.

The full order of work for a departure, including what to cut off before you get to providers, is in What to rotate when a developer leaves. The offboarding checklist builds the list of values for your own stack.

Make the next reissue smaller

A secret key that every service shares turns one departure into an account-wide change. A few habits keep the next round small:

  • One restricted key per service. When a key leaks or someone leaves, you reissue a key with known permissions and a known consumer, not the key behind everything.
  • Access policies. Stripe can tie a key to IPv4 addresses and CIDR ranges, or to allowed ASNs and countries, and can block anonymous VPNs, public proxies and Tor exit nodes. Requests from elsewhere are blocked and you are notified. Stripe recommends a policy on every live key.
  • A note on every key. The Dashboard asks where you saved a new key. Writing the Crunu project, environment and variable name there tells the next person exactly which value to replace.

Crunu keeps the paper trail on its side: each saved version carries an author and a time, and Where to reissue next to Stripe values in the reissue checklist links to the Dashboard. Calling Stripe, rotating the key and expiring the old one remain your steps.

Frequently asked questions

Something else? Write to support@crunu.com

Can the old and the new Stripe key work at the same time?

Yes. When you rotate a key in the Dashboard and pick a future expiration, both keys work for up to 7 days. Choosing Now deletes the old key at once. For a longer overlap, create a second key by hand and expire the first one when every service has moved.

Should I use the grace period when a key has leaked?

No. A grace period keeps the leaked key working as well. Rotate with the expiration set to Now, accept a short interruption while services restart with the new value, and read the request logs for calls you did not make.

Do I need to reissue the publishable key too?

Usually not. A publishable key is meant for front-end code and can only identify your account and create tokens or payment methods. Secret keys, restricted keys and any webhook signing secrets the person saw are the values to reissue.

Does Crunu rotate the Stripe key for me?

No. Crunu never calls Stripe. It lists the Stripe values a departing person received, stores the new key as a new environment version, and crunu run can restart services when it changes. Rotating and expiring the key happen in the Stripe Dashboard.

Sources

Every source this page relies on, with the date we last checked it.

  1. Stripe Docs: API keys · checked October 30, 2026
  • Vercel

    Access token

    Expiry: Chosen at creation; the token stops working after that date

    vcp_…Scoped keys

  • Anthropic

    Claude API key

    Expiry: Chosen at creation: 3 hours to 30 days, custom or Never; fixed afterwards

    sk-ant-api…Partly scoped

  • AWS

    IAM user access key

    Expiry: None: a long-term credential until you deactivate or delete it

    AKIA…Partly scopedDelayed revocation

  • Bitbucket

    API token with scopes

    Expiry: 1 to 365 days; one year by default

    Scoped keys

  • Cloudflare

    API token

    Expiry: Optional TTL chosen when the token is created

    cfut_…Scoped keys

  • DigitalOcean

    Personal access token

    Expiry: Chosen at creation; an expired token disappears from the account

    dop_v1_…Scoped keys

Know which values to replace

Free during early access. When someone leaves, Crunu lists the values they received, changes the environment keys, and keeps each new value as a new version.