Skip to main content

Use API keys securely

Treat your API key like a password.

Do: env vars or a secret manager · call from the backend only · restrict who can read production keys · rotate on suspicion · separate keys per environment.

Don't: frontend code · commits · screenshots, issues, chat messages · logging the full key.

The pattern​

frontend → your backend endpoint → Custodian Labs API (X-API-Key) → your backend → frontend

The key never reaches the browser; your backend owns validation, logging, and retries.

Local vs production​

# local
export CUSTODIAN_SDK_API_KEY="..." # SDKs
export CUSTODIAN_API_KEY="..." # raw Guardian Layer / Platform API

Production: Vercel env vars, AWS/GCP/Azure secret managers, Kubernetes Secrets — read by backend services only.

If a key leaks​

  1. Stop using it.
  2. Remove it from wherever it was exposed, if you can.
  3. Contact support to revoke it and get a new one.
  4. Update your backend with the new key.
  5. Check your usage for anything unexpected.

See also​

API key management · API key expiration