Skip to Content

BYOK Credentials

Manage Bring Your Own Key (BYOK) credentials for AI provider access.

POST /v1/admin/byok/providers/:provider/credentials

Upload or rotate a BYOK credential.

PropertyValue
Authtenant_admin role
Providersgemini
IdempotentYes

Request

{ "credential": "API key string", "mode": "create | rotate", "label": "optional description (1–120 chars)" }
FieldTypeRequiredDescription
credentialstringYesThe API key
modestringYescreate for first-time setup, rotate to replace
labelstringNoHuman-readable description (1-120 chars)

Behavior

  • Credentials are stored in Google Cloud Secret Manager
  • create mode is for first-time setup
  • rotate mode replaces the existing credential
  • Triggers onboarding state transition to validation_pending
  • Audit event: byok_credential_create or byok_credential_rotate

POST /v1/admin/byok/providers/:provider/credentials/validate

Validate a stored BYOK credential by making a test call to the provider.

PropertyValue
Authtenant_admin role
IdempotentYes

Validation Process

  1. Retrieves stored credential from Secret Manager
  2. Makes test API call to Gemini (15s timeout)
  3. Checks for auth errors (401), quota errors (429), network errors
  4. Stores validation result with timestamp and error details
  5. Updates onboarding state accordingly

Response

{ "tenant_id": "string", "provider": "gemini", "validation_status": "passed | failed", "onboarding_state": "certification_pending | validation_pending", "checked_at": "ISO8601", "error": { "code": "string", "message": "string" } }

Secret Resolution Modes

ModeConfigBehavior
envPROVIDER_SECRET_RESOLUTION_MODE=envAPI key from GEMINI_API_KEY_SECRET env var
dbPROVIDER_SECRET_RESOLUTION_MODE=dbPer-tenant key from Secret Manager via TenantProviderConfig.secretRef
Last updated on