Leaked an API key? › Clerk
Leaked Clerk secret key: what to do in the next 10 minutes
Last updated: November 26, 2026. Steps checked against Clerk's own docs on November 26, 2026.
Short answer: In the Clerk Dashboard, pick the app and environment, open API keys, and under Secret keys select + Add new key. Put the new key only in a server-only CLERK_SECRET_KEY variable everywhere it is set, redeploy, and check that the new key shows recent use. Then delete the leaked key. Clerk says that after you delete it, any Backend API request that still uses it fails. Clerk supports more than one active Secret Key, so you can do this without downtime. Your Publishable Key (pk_live_ or pk_test_) is safe to expose and doesn't need rotating. A free SniffPup scan of a site you own can flag an exposed environment file or Git metadata, but it has no Clerk-specific pattern and cannot confirm the key is absent everywhere. Removing the key from code alone does not un-leak it.
Which Clerk keys are secret?
- Secret: The Secret Key (sk_live_ in production, sk_test_ in development). Clerk says it must be kept private. Your app uses it to call Clerk's Backend API, which can read and change your users and other data in that instance.
- Secret: The webhook signing secret (whsec_). Clerk says anyone with it can make verified requests to your webhook endpoint. If it leaked, rotate it too.
- Meant to be public: The Publishable Key (pk_live_ or pk_test_). Clerk says it is safe to expose on the frontend and doesn't need rotating if it was committed or made public. It is the value in NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY.
The next 10 minutes
Times are a rough guide. Do the first step before anything else.
1. Add a new Secret Key (Minutes 0-2)
- At the top left of the Clerk Dashboard, select the app and the environment the leaked key belongs to (Development or Production). Keys starting sk_live_ are Production and sk_test_ are Development. Each app and environment has its own keys, so rotating one doesn't touch the others.
- In the sidenav, open API keys. Under Secret keys, select + Add new key, give it a name such as rotated-2026-11-26, and create it.
- Copy the value right away. Since October 2026 the API keys page shows a Secret Key's full value only when you add it, then only part of it.
2. Update CLERK_SECRET_KEY everywhere and redeploy (Minutes 2-5)
- Set the new key in CLERK_SECRET_KEY everywhere it lives: your local .env, your host (Vercel, Netlify, AWS and so on), your CI/CD pipelines, and any scripts. Keep it server-only. Never put it in client JavaScript, a mobile app, a public repository, or a VITE_ or NEXT_PUBLIC_ variable.
- Remove the leaked key from client code and build inputs, then redeploy so the new key takes effect. Check that the files your site serves no longer contain it.
- Test a flow that calls Clerk's Backend API, for example a server route that uses clerkClient, your auth middleware, or an admin script. On the API keys page each Secret Key shows when it was last used. Clerk says to confirm the new key shows recent use and the old one doesn't.
3. Delete the leaked key (Minutes 5-8)
- Back on API keys, find the old key under Secret keys and delete it. Clerk warns you if the key was used recently, so check its Last used time first.
- Clerk says not to delete the old key until your app is redeployed and working with the new one, because deleting a key that's still in use breaks authentication. If the key is public and being abused, deleting it now and fixing the break after may be the right trade. That is our advice.
- After you delete it, Clerk says any Backend API request that still uses the old key fails.
- If the webhook signing secret (whsec_) leaked too, rotate it as well, following Clerk's guide.
4. Check for changes you didn't make, and clean up (Minutes 8-10)
- In the Clerk Dashboard, look over your users and organizations for accounts, edits or deletions your app didn't make, and note times. That is our advice.
- Remove the key from frontend code, public files, screenshots, CI logs, and git history. History can keep a secret after the file is deleted. Rotate any other secrets that sat in the same file or commit.
- Deleting the key from a repo does not revoke it. Only deleting it in the Clerk Dashboard does.
- Re-scan the live site you own. A clean report is not a guarantee of security. Don't paste the full key into chat.
Good to know
- The free scan has no Clerk-specific pattern, so it will not report a Clerk Secret Key by name. It does check whether environment files such as /.env and Git metadata such as /.git/config are publicly downloadable. It reports that the file is exposed, not which keys are inside it. Check your bundles and repo yourself.
- Clerk suggests a separate Secret Key for each place one is used, named after its consumer (for example vercel-production or github-actions). If one leaks, you rotate only that key.
- Clerk can restrict a Secret Key to specific IP addresses, so a leaked key can't be used from someone else's machine. Clerk lists this as a Business or Enterprise feature for production, free to try in development.
- Replacing the key without removing it from client bundles or public .env files exposes the new key the same way.
- The scan is passive and read-only on a live URL you own or are authorized to test. It is not a security guarantee.
After the first 10 minutes
Move the code that needs the key to the server (an API route, serverless function or Supabase Edge Function), keep the key in a server-only environment variable, redeploy, and re-check your live site. The general plan, with a prompt you can paste into Lovable, Bolt, Cursor or Claude Code, is in I leaked an API key in my vibe-coded app. What do I do now? Not sure what kind of key you found? Check it with What kind of key is this?
What SniffPup checks, and what it doesn't
A free SniffPup scan reads only what your live site serves to the public: secret key patterns in HTML and same-origin JavaScript (masked in the report) and public files such as /.env and /.git/config. It never uses a key it finds. It can't see your repo, your server or Clerk's logs, so the steps above are always on you. A clean report is not a guarantee of security.
Sources
- Clerk Docs: Rotate your Clerk API keys
- Clerk Changelog: Secret keys are only shown once on the API keys page
- Clerk Docs: Restrict a Secret Key to specific IP addresses
- Clerk Docs: Deploy your Clerk app to production
Clerk can change its dashboard and steps at any time. If something here doesn't match what you see, follow Clerk's docs and tell us.
Other providers
- Leaked OpenAI API key: what to do in the next 10 minutes
- Leaked Anthropic API key: what to do in the next 10 minutes
- Leaked Gemini API key: what to do in the next 10 minutes
- Leaked Resend API key: what to do in the next 10 minutes
- Leaked Perplexity API key: what to do in the next 10 minutes
- Leaked OpenRouter API key: what to do in the next 10 minutes
- Leaked Groq API key: what to do in the next 10 minutes
- Leaked ElevenLabs API key (unauthorized charges): what to do
- Leaked Stripe secret key: what to do in the next 10 minutes
- Leaked Supabase service_role or secret key: next 10 minutes
- Leaked AWS access key: what to do in the next 10 minutes
- Leaked GitHub token: what to do in the next 10 minutes
- Leaked Twilio auth token: what to do in the next 10 minutes
- Leaked DATABASE_URL: what to do in the next 10 minutes
- Leaked SendGrid API key: what to do in the next 10 minutes