Accidentally pasted an API key into AI chat? Revoke it first
Revoke the exposed key at the service that issued it. Then replace it in your applications, review usage since the paste, and clean up the chat and any copies.
The first five minutes
If you pasted a working token into ChatGPT, Claude, an IDE chat, or a support conversation, treat it as exposed. The issuer is the service that verifies the token. An OpenAI key pasted into another company's chat still needs to be revoked at OpenAI.
If the key serves production traffic, have a teammate prepare the replacement in parallel. For a key with broad permissions or suspicious activity, prioritise revocation and then repair the service. Preserve the key ID and the time of exposure for investigation.
“revoke it promptly and replace it with a new key”
- Find the key by its name, ID, or partial fingerprint in the provider dashboard and revoke it.
- Create a replacement with only the permissions the workload needs. Store it in the secret manager or server environment and restart the affected workload.
- Review usage, billing and any audit events from the time of the paste until revocation. Look for unexpected models, regions, operations, or spikes. Report anything unexpected to the provider and your incident owner.
- Delete the exposed text and check shared links, attachments, IDE transcripts and copied issue comments. Keep a record of where it appeared and when you rotated it.
Why removing a copy is a separate step
A copied credential can continue working anywhere it has already been seen. Together AI disclosed in November 2026 that a repository credential was obtained during the window before the exposed commit was reverted. The incident concerned a private repository containing stored prompt samples. It illustrates why closing access at the issuer matters even if the visible copy is removed quickly.
Deletion still helps reduce later exposure. If you shared an entire environment file, work through each active credential in it. An AI key, a database URL, and a deployment token can affect different services and need separate rotation.
Protect the next paste
Keep real keys in server-side configuration and use obvious placeholders when asking a model for help. The Spendplane Chrome extension can mask recognised secrets in supported browser chats. For an API client you control, the gateway can mask recognised secrets in requests routed through it. Neither path changes an already exposed key at its issuer.
Use a fictional value in a dry run. Confirm the approved AI surface sees a placeholder and the issue or screenshot you share contains no original value. Spendplane's redaction demo lets you exercise that workflow with its fictional example.