Exposure Medium
Revoke the exposed Anthropic API key
An Anthropic API key (sk-ant-api03-...) is meant for a server. In a browser bundle anyone who loads the page can copy it and send requests billed to the account. The Anthropic API refuses browser calls unless the page opts in with a header named for the danger, so a key in the bundle usually means that opt-in was used.
Find out whether your site has this problem, and every other check, in one free scan.
Check your site freeWhy it matters
An Anthropic API key lets whoever copies it send requests billed to the business's account until the key is revoked or its spend limit is reached.
How to fix
- 1 Revoke the key in the Claude Console (API keys) and create a new one. Revoking is the only step that stops the copied key from working.
- 2 Move every call to the Anthropic API behind an endpoint on your own server that holds the new key, checks who is asking and limits how often.
- 3 Purge the old key from git history so it is not recoverable from a prior commit.
- 4 Redeploy, confirm the shipped bundle has no sk-ant- key in it, and check the usage page for spend you did not make.
Common mistakes
- Putting the key in a build-time environment variable and assuming that keeps it private: a bundler that inlines it (NEXT_PUBLIC_, VITE_, PUBLIC_) ships it to every visitor.
- Removing the key from the current build without revoking it: copies in git history, old deploys and CDN caches keep working until it is revoked.
- Relying on a low spend limit as the fix: it caps the damage, but whoever holds the key still uses the account until it is revoked.
How to verify
- 1 Re-run the scan and confirm the Anthropic API key finding is gone.
- 2 Search the deployed JavaScript for sk-ant- to confirm no key remains.
- 3 Confirm the old key shows as revoked in the Claude Console and check usage for requests you did not make.
Related checks
Ready to see where you stand?
Scan your site and get your Engineering Score with a prioritized roadmap in under a minute, no signup required.
