Overview
API keys authenticate agents (the Edge collector, the remediation executor) and non-GitHub CI/CD integrations with the ChangeGuard AI backend. Keys start withcg_ and are bcrypt-hashed before storage — ChangeGuard AI never stores or logs plaintext keys.
GitHub needs no API key. The GitHub Action authenticates with a short-lived identity token GitHub issues to the workflow, verified by ChangeGuard AI against the repository connection you created. See Connect GitHub.
Creating Keys
Go to Settings → API Keys → Create Key in the dashboard. Choose a name and scope, then click Create Key. The full key is displayed once. You can also create keys via the API:Scopes
How Authentication Works
- The agent or CI tool sends the
X-API-Keyheader with every request - The backend extracts the key prefix (first 10 characters) for fast lookup
- The full key is verified against the bcrypt hash stored in the database
- The tenant context is derived from the key — agents don’t need to know their tenant ID
- The key’s scope is checked against the endpoint’s required scope
Revoking Keys
Go to Settings → API Keys and click Revoke next to the key. You can also revoke a key by its ID (from the keys list) via the API:Key Rotation
Rotate keys without downtime:- Create a new key with the same scope
- Update the agent’s Kubernetes Secret with the new key value
- Restart the agent deployment (
kubectl rollout restart) - Verify the agent reconnects (check backend logs for
Ingestedmessages) - Revoke the old key
Security Details
- Keys are hashed with bcrypt (cost factor 10) before storage
- Only the key prefix (
cg_xxxxxxxx) is visible in the dashboard — never the full key - Keys are scoped per tenant — a key from one tenant cannot authenticate against another
- Revocation is durable and takes effect control-plane-wide the instant the revoke request succeeds — every replica re-checks revocation against the database on every request, so a revoked key cannot survive on a warm replica, a restart, or a second node
- Failed API key attempts are logged with source IP for monitoring