How to rotate an exposed OpenAI API key

Revoke the affected key in the issuing project. Replace it in the application and check project usage for activity between the exposure and revocation.

Example

A developer pasted a production OpenAI credential into an AI chat at 09:10. The same value is stored in a deployment environment and a local worker.

What to do

  1. Identify the key by name and project in the provider dashboard. Revoke it, especially if it has broad access or usage has changed.
  2. Issue a restricted replacement for the workload. Update the server deployment and the local worker through their secret stores.
  3. Restart only the affected workloads. Run a synthetic request and check their usage in the expected project.

How to verify

The old key is revoked, both processes succeed with the replacement, and a named owner reviewed the exposure window.

Limits

Editing the chat removes one visible copy. It cannot invalidate a provider credential.

Spendplane for this workflow

Try masking with fictional data

Related reading