- Store API keys securely. Do not put API keys directly in startup commands, commit them to code repositories, or write them to logs. Do not show full keys in public documents, screenshots, or other shared content.
- Use a separate API key for each environment and service instead of sharing one key, so each key can be rotated or disabled on its own.
- Configure a network access policy for your API keys so that only trusted sources can use them. See Network Access for API Keys.
- Rotate the API keys you use regularly, and delete keys you no longer need.
How to rotate an API key
- Go to Key Management in the console and create a new API key.
- Replace the old key with the new one in your applications and services, and verify that calls succeed.
- After confirming that every application and service that used the old key has been updated, delete the old key.