Research
AI API Key Leaks in 2026: The Numbers
API key leaks are no longer a rare edge case — they are the default. This is a short digest of the 2026 data, drawn from our full report, and what the numbers mean if you build with AI tools.
The headline numbers
In 2025, GitGuardian detected 28.6M+ new secrets in public GitHub commits — a 34% jump over 2024, and the fastest growth on record. The fastest-growing category was AI-service credentials, up 81% to over 1.27 million. This is not a niche problem; it is the cost of everyone shipping AI features at once.
Why AI workflows leak more
- Speed. Claude Code-assisted commits leaked secrets at ~3.2% — roughly double the ~1.5% GitHub-wide baseline.
- No standard prefixes. Many AI service keys lack recognizable formats, so older scanners miss them.
- New config surfaces. MCP and agent config files became a fresh place to paste plaintext keys.
- Keys don't get rotated. 64% of valid secrets leaked in 2022 were still not revoked by 2026.
What to do about it
- Get keys out of files. Move them into an encrypted vault that injects them at call time.
- Use per-tool virtual keys. One leak then costs you a virtual key, not your real credential.
- Watch for leaks. Monitor public repos and paste sites for your own keys so you can rotate within minutes.
- Assume breach, rotate fast. If a key touched a public place, replace it today.
FAQ
How many API keys were leaked in 2025?
GitGuardian's State of Secrets Sprawl 2026 reported 28.6M+ new secrets detected in public GitHub commits during 2025, a 34% increase over 2024.
Are AI-related API keys leaking more than others?
Yes. Leaks tied to AI services rose 81% year-over-year to 1,275,105 secrets. AI-service credentials often lack standardized prefix patterns, which makes them slip past older detection rules.
Do MCP and agent config files create a new leak risk?
They do. MCP configuration files exposed 24,008 unique secrets in 2025, including Google API keys (19.2%), PostgreSQL connection strings (14%), and Perplexity.ai keys (11.2%).
How do I protect my API keys in 2026?
Keep keys encrypted on-device instead of in plaintext config files, give each tool its own scoped virtual key so one leak is replaceable, and monitor public code for your own keys so you can rotate fast.
Read the full data
The complete, sourced breakdown lives in our report: API Key Exposure Report 2026 →