Skip to main content

Platform Config

Platform configuration is stored in an encrypted key-value store in the database. These endpoints allow superadmins to manage API keys, feature flags, and service settings through the admin UI. Database values take precedence over environment variables.
All API requests require a valid JWT token in the Authorization: Bearer <token> header. The API Gateway decodes the JWT and forwards auth context (user-id, organization-id, user-email, x-platform-role, x-org-role) as headers to downstream services.
All platform config endpoints require superadmin access. Non-superadmin requests receive a 403 Forbidden response.

Get All Config

Retrieve all platform configuration values, grouped by category.

Response (200)

Returns configuration entries organized by category. Sensitive values (API keys) are returned in encrypted form.
object
Configuration entries keyed by category.

Set Config Value

Create or update a platform configuration value. Values are encrypted at rest using AES-256-GCM.

Request Body

string
required
Configuration key (e.g., OPENROUTER_API_KEY).
string
required
Configuration value. Will be encrypted before storage.
string
required
Category: ai, voice, knowledge, or feature_flags.

Response (200)


Config Health Check

Check the health of platform configuration, including which required keys are set and which are missing.

Response (200)

string
healthy, degraded, or unconfigured.
string[]
List of configured keys.
string[]
List of required but missing keys.

Setup Status

Check the first-time platform setup status, including whether essential services are configured.

Response (200)

boolean
Whether initial setup is complete.
object
Setup step completion status.

Configuration Precedence

Platform config follows this precedence order:
  1. Database (platform_config table) — highest priority
  2. Environment variables (.env files) — fallback
Services call getConfigValue(key) which checks the database first and falls back to process.env. This means you can override any environment variable through the admin UI without restarting services.

Encryption

All config values are encrypted at rest using AES-256-GCM with the JWT_SECRET as the encryption key. The @brainstormer/shared crypto module handles encryption and decryption transparently.