Claude API key stolen? What to do in the first hour
From Swift Labs, makers of LLM Spend Tripwire. Written with AI help and checked against the sources linked below on November 16, 2026. Swift Labs isn't affiliated with Anthropic. This is general information, not security or legal advice.
If someone else has your Claude API key, they can run up charges on your account. Anthropic's help center compares an API key to a credit card number: if someone gets it and uses it, "they incur charges on your behalf" (source). Work through these five steps in order. Each one links to the Anthropic page it comes from.
The short version
- Disable or delete the key on the API keys page in the Claude Console.
- Check the Usage, Cost and Logs pages to see how much was used and when.
- Set or lower your monthly spend limit.
- Put a new key everywhere the old one was used, and find out how it leaked.
- Contact Anthropic support with the key name, the time window and what you found.
1. Disable or delete the key
Sign in to the Claude Console and open the API keys page (platform.claude.com/settings/keys). Anthropic's advice for a key you think is compromised is to revoke it right away: click the menu (the three dots) next to the key and select Delete API key (source).
You have two options, and Anthropic lists both for a key you suspect has leaked (source):
- Disable can be undone. The key can be re-enabled later.
- Delete is permanent. The key is archived and can't be used again.
If you're not sure which key leaked, disable every key that could be it, then delete the leaked one once you know. Any app still using that key will stop working until you give it a new key in step 4.
If the leaked key starts with sk-ant-admin01-, it's an Admin API key, not a regular API key. Admin keys live on a separate Admin keys page (platform.claude.com/settings/admin-keys). They have no scopes: Anthropic says "every key has full access to the endpoints that accept it", and the Admin API manages organization members, workspaces and API keys (source). Remove that key too, then check your members, workspaces and API keys for changes you didn't make.
If the key was in a public GitHub repository, Anthropic may already have acted. Anthropic is a GitHub secret scanning partner: GitHub scans public repositories for Claude API keys and notifies Anthropic, which "automatically deactivates the exposed API key" and emails the affected user (source). That covers public GitHub repositories. A key that leaked anywhere else won't be caught this way, and even after that email you still need the rest of this list.
2. Check Usage and Cost to see what happened
In the Claude Console, look at:
- the Usage page (
platform.claude.com/usage), - the Cost page (
platform.claude.com/cost), - the Logs page (
platform.claude.com/logs).
Anthropic recommends reviewing the Logs and Usage pages for your API keys (source). Write down:
- when the unusual use started and stopped (in UTC, so it matches Anthropic's data),
- which models were used, especially ones you don't use,
- roughly how many tokens and dollars it added up to,
- which workspace it was in.
You'll want these notes for step 5.
For a per-key breakdown, use Anthropic's Usage and Cost API. It can group usage by API key and model in 1-minute, 1-hour or 1-day buckets, and data "typically appears within 5 minutes" of a request. It needs an Admin API key, or a personal or service account key that isn't scoped to a workspace; workspace keys don't work, and individual Console accounts without an organization can't use it (source). If you create an Admin key just for this, pick a short expiration such as 3 hours and delete it when you're done, because every Admin key has full access (source). Cost data from that API is daily only, in USD (source). For example, hourly usage by key and model for one day:
curl "https://api.anthropic.com/v1/organizations/usage_report/messages?\
starting_at=2026-11-15T00:00:00Z&\
ending_at=2026-11-16T00:00:00Z&\
group_by[]=api_key_id&\
group_by[]=model&\
bucket_width=1h" \
-H "anthropic-version: 2026-10-21" \
-H "x-api-key: $ANTHROPIC_ADMIN_KEY"
Change the dates to cover your time window. Two things to know: usage from the playground in the Claude Console has no API key ID, and usage in the default workspace has no workspace ID (source). Anthropic calls this API "legacy" but says it "remains supported"; for new integrations it recommends the newer Usage and Cost Analytics API.
3. Set or lower your spend limit
A spend limit caps what anyone, including someone with a key you haven't found yet, can spend in a month.
- Open Spend limits in the Claude Console (
platform.claude.com/settings/spend-limits). - Next to your organization's Monthly spend limit, click Adjust limit or Set limit.
- Enter a new value. It can't be higher than your usage tier's cap.
If you don't see Spend limits, an older help-center article points organizations with custom rate limits to the Billing page instead (source).
(source)
When usage reaches a limit you set, API requests fail with an HTTP 400 error until access resumes or you raise the limit. That includes your own apps, so pick a number you can live with.
Each usage tier also has its own monthly spend cap: $500 for Start, $1,000 for Build and $200,000 for Scale. Custom-tier organizations have no monthly cap (source).
Workspace limits. You can also set custom spend and rate limits for each workspace, except the default workspace, which can't have its own spend limit. Organization-wide limits always apply (source).
Auto-reload. If your account tops up prepaid credits automatically, look at the auto-reload settings on the Billing page (platform.claude.com/settings/billing). Anthropic says auto-reload limits also act "as a safeguard against unexpected high usage that could result from leaked keys" (source). Until you've found the leak, consider lowering the auto-reload amount so a stolen key can't keep topping up your credits.
4. Rotate keys everywhere and find the leak
Create the new key. On the API keys page, click Create key, name it and pick an expiration (source). Expiration options are 3 hours, 1 day, 7 days, 30 days, a custom duration, or Never. You can't change the expiration later. For a production service, Anthropic suggests a service account key rather than a personal one, so the key doesn't act as one person.
Put it everywhere the old key was. That's usually the ANTHROPIC_API_KEY environment variable or a secrets manager entry. Confirm requests succeed, then delete the old key (source). If you only disabled the leaked key in step 1, delete it now. Store the new key in a secrets manager, not in your code or version control (source).
Rotate whatever sat next to it. If the key leaked from a .env file, a CI system or a shared tool, other secrets in the same place were probably exposed too.
Find out how it leaked. Common places to check:
- Code repositories, including old commits. Deleting the key in a new commit doesn't remove it from earlier ones.
- Front-end code. A key in JavaScript that runs in the browser can be read by anyone who loads the page. (source)
- CI and app logs, error trackers and debug output.
- Third-party tools. Anthropic notes that putting your key into a third-party tool gives that tool's developer access to your Console account (source).
- Chats, tickets and email. Anthropic says not to share keys in emails or support tickets, even with Anthropic.
Turn on secret scanning. Anthropic recommends enabling secret scanning in your source control provider, using a tool such as Gitleaks, and scanning in CI before code reaches your main branch (source). GitHub's secret scanning recognizes Anthropic API keys and Admin API keys (source), and GitHub Advanced Security customers can scan for and block Anthropic keys in private repositories (source).
5. Contact Anthropic support
Anthropic's compromised-key article says to contact support if you keep seeing suspicious activity or have other concerns (source). To reach support for the Claude API or Console (source):
- Sign in to the Claude Console.
- Click your initials or name in the lower left corner and select Get help.
- In the support messenger, click Send us a message. You'll chat with Fin, Anthropic's AI support bot, first. If your issue needs more investigation, Fin passes it to the Product Support team, and their reply comes in the same conversation and by email.
Console Admins can reach the human support team. If you're not an admin, an Owner or Console Admin in your organization has to escalate for you. Support is in writing only, and Anthropic asks for one conversation per issue.
What to include:
- your organization name and the name of the leaked key (never the key itself),
- when you disabled or deleted it,
- the time window of the unusual use, in UTC,
- the models, token counts and costs you found in step 2,
- how the key leaked, if you know.
About the charges. Anthropic's Commercial Terms say the customer "is responsible for all activity under its account" and "will promptly notify Anthropic" if it believes its account has been compromised (source). We couldn't find a published Anthropic policy on refunds for usage from stolen keys. Ask, but whether any charges are adjusted is Anthropic's decision.
After the first hour
- Keep watching usage for the next few days, in case another key or credential was exposed in the same leak.
- Give new keys an expiration date, so a leaked key stops working on its own. Anthropic emails the key's creator before keys with longer lifetimes expire (source).
- Use separate keys for development, testing and production, so one leak only affects one use (source).
- Keep few Admin keys. Only members with the admin role can create them, and each one has full access (source).
- Consider IP allowlisting (beta) to limit where your keys work, or Workload Identity Federation to replace long-lived keys with short-lived tokens (source).
- Set up an alert for unusual usage. Anthropic lists partner integrations, including Datadog, Grafana Cloud and Vantage, on its Usage and Cost API page.
Our free, open-source LLM Spend Tripwire is a Cloudflare Worker you run yourself that reads your usage with an Anthropic Admin key and can alert Slack or Discord when a key's usage spikes. Its source code is on this site under the MIT License.
Sources
Checked on November 16, 2026.
- Anthropic: Authentication (key types, disable vs. delete, expiration, rotation, IP allowlisting)
- Anthropic: Rate limits (spend limits, tier caps, workspace limits)
- Anthropic: Usage and Cost API (Usage and Cost pages, per-key usage, data delay)
- Anthropic: Admin API keys (no scopes, who can create them)
- Claude Help Center: What should I do if I suspect my API key has been compromised?
- Claude Help Center: API key best practices (Logs and Usage pages, auto-reload, secret scanning, GitHub partnership)
- Claude Help Center: How to get support
- Anthropic: Commercial Terms of Service
- GitHub: Anthropic is now a GitHub secret scanning partner and Supported secret scanning patterns
We haven't walked through these Console steps in a live Anthropic account; the button and page names above are the ones Anthropic's docs use. If something has changed, tell us at swiftlabs-ops@agentmail.to.