# My Clerk key leaked. What do I do?

**Short answer:** The Clerk Secret Key (`sk_live_…`) gives full Backend API access: list, edit and delete users and impersonate sessions. Rotate it in the Clerk Dashboard's API keys page, update `CLERK_SECRET_KEY` on every server, then review users and sessions for changes. The Publishable Key (`pk_live_…`) is public by design.

*Last updated 2026-11-25 · Reviewed by ProofForge*

## Is it this key?

**Format:** Secret `sk_live_` / `sk_test_` (server only). Publishable `pk_live_` / `pk_test_` (public by design).

**Blast radius:** Backend API access to your entire user base: user data, metadata, sessions, organizations.

## The first 10 minutes

| When | Do | How |
|---|---|---|
| 0–3 min | Add key | Clerk Dashboard → select the app and environment → API keys → Secret keys → Add new key. It's shown once, so copy it now. |
| 3–5 min | Swap & delete | Set `CLERK_SECRET_KEY` on every server, redeploy and verify, then delete the leaked key. |
| 5–8 min | Audit | Review recently created or changed users, admin metadata changes and active sessions. Revoke suspicious sessions. |
| 8–10 min | Close the hole | Remove the key from client code and history. Only `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` belongs in the browser. |

## Stop the next leak

- Keep the key in a server-side env var. Never use a `VITE_`, `NEXT_PUBLIC_` or `EXPO_PUBLIC_` variable or hard-code it in frontend code.
- Call the provider from your backend or an edge function, and add `.env*` to `.gitignore`.
- Re-scan the live site after every deploy. Keys also leak through JS bundles, source maps and exposed `.env` or `.git` paths.

> **Scan box (use the site's ScanBox component):** Check whether your live app has this problem. Paste your URL for a free outside-in scan covering exposed keys, open database rules, CORS and security headers. [Scan my app free →](https://proofforge.live/#scan)

## FAQ

### Is my publishable key a leak?
No. `pk_` keys are designed for the frontend.

### Can I have more than one secret key?
Yes. Clerk supports multiple active secret keys. Use one per consumer (production host, CI) so one leak means rotating one key.

### How did it end up public?
Usually a `NEXT_PUBLIC_` / `VITE_` prefix on the secret key, or a committed `.env`.

## Sources

- [Clerk: Rotate your API keys](https://clerk.com/docs/guides/secure/rotate-api-keys)
- [Clerk: Environment variables](https://clerk.com/docs/guides/development/clerk-environment-variables)

## Related

- [Fix process.env.NEXT_PUBLIC_… undefined in Next.js](/errors/next-public-env-undefined)
- [Fix: secrets in VITE_ / NEXT_PUBLIC_ vars](/fix/vite-env-secrets)
- [Fix: admin route exposed](/fix/admin-route-exposed)
- [Exposed API key checker](/tools/exposed-api-key-checker)
- [Fix: source maps exposed](/fix/source-maps-exposed)
- [All leaked-key guides](/leaked-keys)
