Skip to main content

Configuration model

Unkey services read configuration from a TOML file passed at startup. Environment variables can be referenced with ${VAR} and are expanded before parsing. Defaults and validation run after parsing. The config schema maps to svc/api/config.go. Minimal config example:
string
Instance identifier for logs and cache invalidation. Example: "api-7d9b8c4f5d-2kq7m".
string
Platform label for logs and metrics. Example: "aws".
string
Container image identifier logged at startup. Example: "ghcr.io/unkeyed/unkey:v2.0.77".
int
default:"7070"
HTTP server port. Example: 7070.
string
default:"unknown"
Region label for logs and analytics. Example: "us-east-1".
string
required
Redis connection string for counters and usage limiting. Example: "redis://redis:6379".
bool
default:"false"
Enables test-only behaviors. Do not use in production.
int
default:"10485760"
Maximum request size in bytes.
object[]
required
Ordered authentication resolver configuration. Each entry registers one auth mechanism. At least one entry is required: a config without auth entries would reject every request, including valid root keys, so startup fails instead.
object
required
MySQL configuration.
object
ClickHouse configuration.
object
TLS settings for HTTPS.
object
Vault connection.
object
Control plane connection.
object
pprof endpoint configuration.
object
Tracing, logging, and metrics configuration.

Environment variables

The Helm chart provides these variables for the default config template:
env
Region label for logs and traces.
env
required
Redis URL for counters and usage limiting.
env
required
MySQL primary DSN.
env
MySQL read replica DSN.
env
ClickHouse shared URL.
env
ClickHouse analytics base URL.
env
required
Control API URL.
env
required
Control API token.
env
Vault URL.
env
Vault bearer token.
env
pprof username.
env
pprof password.

Dashboard proxy configuration

The dashboard proxy forwards the WorkOS access token when a WorkOS session is available. The API verifies that token through a type = "jwt" auth entry configured with the WorkOS issuer and JWKS URL. The WorkOS JWT template includes the organization as org.id, and the API reads Unkey RBAC permissions from the token’s permissions claim. The template also sets aud to ["api.unkey.com"], and the auth entry pins audience = "api.unkey.com". Each WorkOS environment (production, canary) must configure this JWT template in the WorkOS dashboard under Authentication settings:
The aud value must be a JSON array. The API parses aud as a string list and rejects tokens that carry it as a bare string, so a string-valued template claim fails verification with “Invalid bearer token”. Without the template, or with a missing aud claim, every forwarded WorkOS access token fails the audience check the same way. Local development still uses a dashboard-minted fallback JWT when no WorkOS access token exists. For that path, the dashboard needs a signing secret and the API must include the same secret in a type = "jwt" auth entry. The local fallback JWT includes the dashboard proxy permission set directly, so every local dashboard user is effectively an API admin.
env
default:"https://api.unkey.com"
API base URL that dashboard proxy requests are forwarded to.
env
Local dashboard proxy signing secret. Add the same value to the API JWT auth entry’s secrets list so the API can verify dashboard-minted fallback JWTs.

Example configuration