I found my Anthropic API key in my frontend code. Now what?

Your Anthropic key (it starts sk-ant-) belongs on a server. In your JavaScript bundle, anyone can copy it and call Claude on your account, and you pay for every request. Fix it in this order.

How to fix it

  1. Sign in to the Claude Console (formerly the Anthropic Console) at platform.claude.com and open the API keys page. Click the three-dot menu next to the key and choose Delete API key. Do this before anything else. Deleting can't be undone. Disable can, so use it only if you need a minute to be sure which key it is.
  2. Click Create key on the same page to make a replacement. Save it somewhere secure, such as a secrets manager, and never commit it to your repository.
  3. Store the new key only as a server-side environment variable (for example ANTHROPIC_API_KEY in Vercel → Settings → Environment Variables), with a name that does not start with NEXT_PUBLIC_ or VITE_.
  4. Move every Claude call into a server route (a Next.js route handler, a Supabase Edge Function or a serverless function) and have the browser call that route. The browser never needs the key.
  5. Redeploy, and check that your app's Claude features still work with the new key.
  6. Check for damage. Review the Usage and Logs pages for requests your app didn't make. Open the Admin keys page and remove any admin key you didn't create, and check your organization's members for anyone you don't know. If you see usage you can't explain, contact Anthropic support. To cap the cost of a future leak, set a spend limit or review auto-reload on the Billing page.
  7. Scan again to confirm the key is gone. If the scan finds the new key, it was exposed the same way, so go back to step 1.

Common questions

What can someone do with my Anthropic key?

Call Claude as you. Every request they send is billed to your account until the key is deleted, and with auto-reload on they can keep spending until a limit stops them.

The scan found an sk-ant-admin01- key. Is that worse?

Yes. An admin key doesn't call Claude. It manages your organization's members, workspaces and API keys through the Admin API. Remove it on the Admin keys page, then delete every API key and remove every member you don't recognize.

Hasn't Anthropic already turned the key off?

Only if GitHub found it in a public repository. Then Anthropic deactivates it and emails you. A key in your deployed site's JavaScript isn't covered, so delete it yourself.

Why is my grade an F?

Any leaked key gives the scan an F until it's gone, because anyone can use a key they can read.

Fixed it? Scan again to confirm.

Scan your app for leaks