Skip to content

API Authentication

API key authentication

The primary authentication method for the GOVERN API is a Bearer token:

Terminal window
curl https://api.govern.archetypal.ai/v1/assessments \
-H "Authorization: Bearer gvn_live_xxxxxxxxxxxx" \
-H "X-Govern-Org-Id: org_xxxxxxxxxxxx"

API key types

PrefixTypeUse for
gvn_live_ProductionAll production assessments and API calls
gvn_test_TestCI/CD, development — events not stored in audit trail
gvn_admin_AdminOrganization management, policy updates

Creating API keys

  1. Navigate to govern.archetypal.ai
  2. Settings → API Keys → New Key
  3. Choose key type and optional expiry
  4. Copy the key (shown only once)

Or via API (requires an existing admin key):

Terminal window
curl -X POST https://api.govern.archetypal.ai/v1/api-keys \
-H "Authorization: Bearer gvn_admin_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Probe",
"type": "live",
"description": "Used by the production GOVERN Probe"
}'

Key rotation

Terminal window
# Create new key
curl -X POST https://api.govern.archetypal.ai/v1/api-keys ...
# Update your deployment with the new key
# Revoke the old key
curl -X DELETE https://api.govern.archetypal.ai/v1/api-keys/key_xxxx \
-H "Authorization: Bearer gvn_admin_xxxx"

JWT authentication (SSO)

For organizations using SSO (Okta, Azure AD, Google Workspace), users can authenticate via JWT:

Terminal window
# Exchange SSO token for GOVERN JWT
curl -X POST https://api.govern.archetypal.ai/v1/auth/token \
-H "Content-Type: application/json" \
-d '{"sso_token": "eyJhbG..."}'
# Response
{
"token": "eyJhbGciOiJSUzI1NiJ9...",
"expires_at": "2026-04-12T16:00:00Z"
}
# Use JWT
curl https://api.govern.archetypal.ai/v1/events \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9..."

JWTs expire after 1 hour. Refresh before expiry using POST /v1/auth/token/refresh.

Service account authentication

For automated systems and CI/CD pipelines, create a service account:

Terminal window
curl -X POST https://api.govern.archetypal.ai/v1/service-accounts \
-H "Authorization: Bearer gvn_admin_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "github-actions",
"permissions": ["assess:create", "events:read"],
"ip_allowlist": ["4.4.4.0/24"]
}'

Service accounts have scoped permissions and can be restricted to specific IP ranges.

Permission scopes

ScopeDescription
assess:createCreate assessments (SDK/Probe)
events:readRead assessment events and audit trail
policy:readRead governance policy
policy:writeUpdate governance policy
probes:readRead probe status
probes:writeConfigure probes
webhooks:readRead webhook configurations
webhooks:writeCreate and modify webhooks
reports:readRead reports and exports
admin:*All permissions

Security best practices

  • Use gvn_test_ keys in CI/CD (events not logged)
  • Rotate production keys every 90 days
  • Scope service account permissions to minimum required
  • Enable IP allowlisting for service accounts in known environments
  • Store keys in secrets managers (AWS Secrets Manager, HashiCorp Vault, GitHub Secrets)
  • Never log or print API keys

Authentication errors

HTTP StatusCodeMeaning
401unauthorizedMissing or invalid API key
401token_expiredJWT has expired
403insufficient_permissionsKey does not have required scope
403ip_not_allowedRequest from IP not in allowlist