Leaked an AI API key? What to do in the first hour

Exposed AI keys get found and abused quickly, often within minutes of landing in a public repo, and the bill lands on you. Move in this order.

Security · Updated November 25, 2026

In the first 15 minutes

  1. Revoke the key in the provider console. Do not wait to investigate first.
  2. Create a new key and update it in your secret manager or environment variables, not in code.
  3. Set or lower a hard spend limit on the project so any other exposed key cannot run up a large bill.

In the next hour

  1. Check usage for the leaked key's project: unusual models, volumes or times.
  2. Contact provider support if you see abuse; some will review fraudulent charges.
  3. Remove the key from git history with a tool like git filter-repo, then force-push. Deleting it in a new commit is not enough.
  4. Search other places it may live: CI logs, chat messages, shared docs, browser extensions.

Prevent the next one

  • Never put keys in front-end code or mobile apps; route calls through a server.
  • Turn on secret scanning in your git host and pre-commit hooks.
  • Use separate keys per project with their own limits, so one leak has a small blast radius.
  • Stop sharing raw keys with employees. Give them a workspace login instead.

How Intrascope handles keys

In Intrascope employees never see provider keys: admins add them once, they are stored encrypted, and people log in with their own accounts and limits. Details in how Intrascope keeps API keys secure.

Frequently asked questions

  • Sometimes, at their discretion. Revoke fast and contact support with the details; there is no guarantee.

  • No. It stays in git history and in any copies or logs. Revoke it first, then clean history.

AI for the whole team, with limits that make sense

Intrascope gives every employee approved models, shared company context and budgets per user and team. Your own API keys or managed usage. 7-day free trial, no card.