Authorization header.
Keep keys server-side
API keys belong only in your backend’s secret store. Never expose them to:- Browser or mobile application bundles
- End users or AI agents
- Logs, traces, analytics, or error messages
- Source control, issues, or chat
- Command arguments that may be recorded in shell history or process listings
Environments
Use separate secret entries and deployment configuration for each environment. Do not silently fall back from production to staging or the reverse.
Load a local test key
Read a key without placing it in shell history:Rotation
Treat the raw key as unrecoverable after initial display.1
Create a replacement
Store the replacement in your secret manager before changing deployed configuration.
2
Verify the replacement
Make a safe staging request and confirm the expected organization and environment behavior.
3
Deploy the replacement
Update server-side configuration without exposing the value in logs.
4
Revoke the old key
Confirm the replacement is active before removing the historical credential.
401. Treat authentication failures as non-retryable until configuration changes.