What to Do If Your API Key Is Leaked?

2.2k views
Updated: 2026-11-25 14:19:01

Disable the leaked key first, then restore your API calls. Simply removing the key from screenshots, chats, or config files will not stop anyone who has already obtained it from continuing to use it.

#Immediate Actions

  1. Go to key management and disable the leaked key immediately — do not wait for unexpected charges to appear.
  2. Create a new key and update all tools and services that were using the old one.
  3. Reopen your tools and send a short message to verify the new key works.
  4. Check your usage logs for the test record to confirm the new configuration is active.

#Check for Abnormal Calls

Focus on the time window after the potential leak. Look for unfamiliar calls, models, or unusual usage. If you spot anything suspicious, note the time, model, usage, and cost, then contact support to verify.

#Clean Up the Leak Source

Remove the old key from any public screenshots, documents, chats, and code. If the key has entered version history, editing only the latest file will not eliminate historical copies. Regardless of whether cleanup is complete, do not re-enable the leaked key.

#Submitting a Report

Provide the key name or a redacted identifier, the approximate time of the leak, and any relevant logs. Do not send the full content of old or new keys, and do not attach unrelated private code.