Launch offer: everything is 100% off. Download any skill free, no sign-up. Get the skills
TechFixError fixesKey leaked
Key leaked

Stripe secret key exposed: rotate it safely

What Stripe says
"If Stripe detects an exposed secret or restricted API key, we notify you and
request that you rotate the key. In some cases, Stripe deactivates the key
proactively."

sk_live_...   secret key: rotate now
rk_live_...   restricted key: rotate now
pk_live_...   publishable key: safe to expose, no action needed
Short answer

If it starts with sk_ or rk_, rotate it now and set the old key to expire immediately. If it starts with pk_, it's a publishable key and is meant to be public.

Why it happens

Stripe secret keys work like a username and password for your account. Stripe warns that someone holding one can make charges, read customer data or disrupt your integration, and that bad actors continuously scan public repositories for them.

Stripe's advice is to rotate an exposed key immediately even if you aren't sure anyone saw it, and to treat any exposure as a potential compromise.

Fix it by hand

  1. Rotate the key. In the Stripe Dashboard open Developers, then API keys. On the leaked key, open the overflow menu and choose Rotate key. Set the old key's expiration to Now (otherwise the old key can keep working for up to 7 days), then confirm.
  2. Copy the new key right away. Stripe shows it once. Put it in your host's secret settings, not in code.
  3. Update every server and CI job that uses STRIPE_SECRET_KEY, and redeploy.
  4. Check what happened. On the key, choose View request logs and look for calls you don't recognise. Review payouts, external bank accounts and connected accounts for anything new.
  5. Roll the webhook secret too if your whsec_ signing secret was in the same file: open the webhook endpoint and roll its secret.
  6. Follow Stripe's compromised-key guide if you see unauthorized activity, and contact Stripe support.

Stop it happening again

Let TechFix do this for you

Key Leaked $7

Key Leaked tells a real Stripe exposure apart from a publishable key, finds every copy in your code, history and bundles, and gives Stripe's rotation steps in order, including the webhook secret.

  • Finds every secret in your files, every commit on every branch, and the JavaScript you ship to browsers.
  • Gives exact revoke-and-replace steps for 19 providers, and never prints your full secrets.
  • Verdict first. Every finding shows the file and line, what it breaks, and the fix as a diff that is applied only with your OK.

Key Leaked: how it works, with examples · Install guide

Works with Claude Code, Claude.ai, Cursor, Codex and other agents that read SKILL.md files. No installs, no accounts, works offline. No-questions refund.

Sources (checked 2026-10-13)