Environment
Required
SECRET_MASTER_KEY_BASE64: base64-encoded 32-byte key for encrypted secret storage
Runtime defaults (recommended for local)
API_HOST=127.0.0.1API_PORT=4000WEB_ORIGIN=http://localhost:5173COOKIE_SECURE=false
Run time limit
WORKFLOW_EXECUTION_TIMEOUT_MS (default 300000, five minutes) is how long one workflow run may take before it is stopped. Raise it for long agent, model or MCP runs; .env.example sets 1200000 (20 minutes). Calls still in flight to MCP servers are cancelled when it runs out. A queue job counts as stuck no sooner than this limit plus a minute.
Auth bootstrap (optional, recommended)
BOOTSTRAP_ADMIN_EMAILBOOTSTRAP_ADMIN_PASSWORD
Use this to create an initial admin automatically when DB is empty.
Single sign-on (optional)
SAML (SAML_*), LDAP (LDAP_*) and OpenID Connect (OIDC_*) are all off by default. OIDC needs OIDC_ENABLED=true, OIDC_ISSUER and OIDC_CLIENT_ID; the optional OIDC_ALLOWED_EMAIL_DOMAINS and OIDC_ALLOWED_GROUPS limit who can sign in (recommended for shared or self-registration IdPs); see OIDC single sign-on. SAML has the same optional allow-lists (SAML_ALLOWED_EMAIL_DOMAINS, SAML_ALLOWED_GROUPS), an optional SAML_IDP_ISSUER pin and an optional SAML_REQUIRE_IN_RESPONSE_TO (SP-initiated sign-in only, against login CSRF); see SAML single sign-on. LDAP needs LDAP_ENABLED=true, LDAP_URL, LDAP_BASE_DN and the optional ldapts package; see LDAP sign-in.
SSO_MFA (off by default, idp or idp_or_local) requires MFA on OIDC and SAML logins, from the IdP or the local TOTP step; SSO_MFA_OIDC_AMR, SSO_MFA_OIDC_ACR and SSO_MFA_SAML_AUTHN_CONTEXTS tune what counts as IdP MFA. See MFA on SSO.
MFA_REQUIRED_ROLES (unset by default; a comma list of admin, builder, operator, viewer) makes MFA required for those roles: an unenrolled user gets a session that can only set it up. MFA_ENFORCE=true adds admin to the list. STEP_UP_MAX_AGE_MINUTES (0 or unset = off) asks for a fresh code before security actions such as role changes, new API keys and secret changes, and refuses personal API keys on them (a service account's key with an admin role ceiling is let through). See MFA required per role.
SERVICE_ACCOUNT_KEY_MAX_AGE_DAYS (0 or unset = no limit) makes every new or rotated service-account key expire within that many days. NOTIFICATIONS_CREDENTIAL_EVENTS=true sends the credential.expiring warning (an API key or gateway client expiring within 7 days, or a rotated key still in use as its grace window ends) to the channels set in the environment; off by default. See Rotating keys.
SCIM_ENABLED=true (off by default) serves SCIM 2.0 at /scim/v2, so your identity provider creates, updates, deactivates and removes users and groups. A user it deactivates or removes is disabled at once: their sessions end and their API keys are revoked. SCIM_LINK_EXISTING_USERS (non_admin by default, or all or none) decides which existing accounts a provisioned user with the same email is linked to. See SCIM provisioning.
Rate limits (on by default)
RATE_LIMIT_ENABLED=true (the default) limits requests per client address in three buckets. The auth and webhook limits are counted per route and address (for example 10 password sign-ins and, separately, 10 TOTP steps a minute); the global limit is one count per address across all its routes. A request over a limit gets 429 Too Many Requests with Retry-After and x-ratelimit-* headers.
| Bucket | Routes | Default |
|---|---|---|
Auth (RATE_LIMIT_AUTH_MAX, RATE_LIMIT_AUTH_WINDOW_MS) | password sign-in and its TOTP step (/api/auth/login, /api/auth/login/mfa), registration, LDAP, OIDC and SAML sign-in and callbacks, TOTP enrolment and removal checks (/api/auth/mfa/activate, /api/auth/mfa/disable) | 10 a minute |
Webhook (RATE_LIMIT_WEBHOOK_MAX, RATE_LIMIT_WEBHOOK_WINDOW_MS) | /webhook/*, /webhook-test/*, /api/webhooks/* | 120 a minute |
Global (RATE_LIMIT_GLOBAL_MAX, RATE_LIMIT_GLOBAL_WINDOW_MS) | every other route, for unauthenticated and API-key or bearer-token requests | 600 a minute |
/health and /metrics are never limited. Requests from a signed-in browser (a live session cookie and no Authorization or X-API-Key header) do not count against the global bucket: a busy studio tab was measured at up to about 290 requests a minute, and everyone behind one proxy or NAT shares an address. They still count in the auth and webhook buckets. Set RATE_LIMIT_ENABLED=false to turn all three off.
With several instances in cluster mode the auth and webhook buckets are shared through Postgres and the global bucket stays per instance: see Rate limits in a cluster.
The client address is the one that connected. Behind a reverse proxy (the web image's nginx, a load balancer) every client then shares the proxy's address, so set TRUST_PROXY to let the proxy's X-Forwarded-For name the client: a comma list of proxy addresses or CIDR ranges (for example TRUST_PROXY=10.0.0.0/8, or loopback, linklocal, uniquelocal), a hop count, or true to trust every hop. Trust only proxies that overwrite the header and keep the API unreachable except through them: a client that can reach the API directly could otherwise pick its own address. Unset (the default) trusts no proxy. A hop count N trusts the connecting address and the N-1 nearest X-Forwarded-For entries without checking who they are, so it is only as safe as the rule that the API is reachable through the proxy alone; a proxy address or CIDR is checked and is the safer choice where you can name it. docker-compose.prod.yml sets TRUST_PROXY=1 for its single nginx hop (the API port is not published there); override it with your own value.
The shipped nginx appends to X-Forwarded-For
The web image's nginx (apps/web/nginx.conf) sets X-Forwarded-For $proxy_add_x_forwarded_for, which adds the connecting address to whatever the client sent. With TRUST_PROXY=true the API reads the leftmost entry, which the client wrote, so every request can choose its own rate-limit key and the sign-in limit stops protecting anything. Behind the shipped nginx use the hop count TRUST_PROXY=1 (the API then reads the address nginx appended, one hop from the API), or the nginx container's address or network as a CIDR (for example TRUST_PROXY=172.18.0.0/16 for the compose network). Never true. Do not publish port 4000 next to it: a direct caller arrives from an address you may trust.
Network controls (optional)
Address allowlists per scope (NETWORK_ALLOW_UI, NETWORK_ALLOW_API, NETWORK_ALLOW_WEBHOOK, NETWORK_ALLOW_PUBLIC, NETWORK_ALLOW_MCP_GATEWAY, NETWORK_ALLOW_METRICS, NETWORK_ALLOW_SCIM), NETWORK_ALLOWLIST_MODE (enforce or report), NETWORK_BREAK_GLASS_CIDRS, and the forwarded client certificate settings for the MCP gateway (MCP_GATEWAY_CLIENT_CERT_HEADER, MCP_GATEWAY_CLIENT_CERT_PROXIES). All unset by default, so every scope is open. They are checked against the client address above, and refused with TRUST_PROXY=true. See Network controls.
Audit log (optional)
The audit log is on by default (AUDIT_LOG_ENABLED=true). AUDIT_EXPORT_ENABLED=true sends it to export destinations on their schedule (AUDIT_EXPORT_CHECK_INTERVAL_MS, AUDIT_EXPORT_BATCH_SIZE, AUDIT_EXPORT_FILE_ROOT), and the LOG_STREAM_* settings tune the live log streams. See Audit log.
Data retention (optional)
How long each kind of data is kept: EXECUTION_HISTORY_RETENTION_DAYS (30), EVAL_RUN_RETENTION_DAYS (90), AUDIT_LOG_RETENTION_DAYS (365), and, kept forever unless set, USAGE_EVENTS_RETENTION_DAYS, AGENT_MEMORY_RETENTION_DAYS and AI_GATEWAY_REQUEST_RETENTION_DAYS. RETENTION_MAX_ROWS_PER_TICK (50 000) caps the rows one purge deletes per table. See Data retention for every setting and what it deletes. Upgrading: an .env copied from an older .env.example sets USAGE_EVENTS_RETENTION_DAYS=365, which now deletes usage events older than a year; remove it or set 0 to keep them (details).
Data-subject requests (optional)
SUBJECT_REQUEST_DUE_DAYS (30, 1 to 365) sets when a data-subject request is due; one notice goes out once it is overdue. SUBJECT_EXPORT_TTL_HOURS (72, 1 to 720) sets how long its export can be downloaded, and SUBJECT_EXPORT_MAX_BYTES (200 MB, 1 MB to 512 MB) how many bytes of rows one export holds. An unconfirmed deletion preview also expires after SUBJECT_EXPORT_TTL_HOURS. ERASURE_TOMBSTONE_RETENTION_DAYS (400, 0 keeps them) sets how long the records of what a deletion erased are kept, so db:import and db:copy re-apply them after a restore; keep it longer than your oldest backup. See Data-subject requests.
MCP server registry probes (optional)
MCP_PROBE_INTERVAL_MS(default300000;0turns scheduled probes off)MCP_PROBE_TIMEOUT_MS(default30000)MCP_PROBE_HISTORY_LIMIT(default500probes kept per server)
See MCP server registry.
Provider/connector env fallbacks
Some adapters support env fallback values. Examples:
AZURE_OPENAI_API_KEYAZURE_OPENAI_ENDPOINTAZURE_OPENAI_API_VERSIONAZURE_AI_SEARCH_API_KEYAZURE_AI_SEARCH_ENDPOINT
Use secrets for production. Env fallbacks are mainly for local development.