Configuration reference
Every environment variable opendesk and the realtime gateway read, with defaults and meaning.
opendesk reads its configuration from environment variables. The self-host bundle keeps them in /opt/opendesk/.env; for local development, copy .env.example in the repository to .env.
Empty values use the default. Booleans accept true/false, 1/0.
Refuses to boot
Section titled “Refuses to boot”opendesk checks its secrets at start and refuses to run when they are unsafe:
AUTH_SECRETshorter than 32 bytes, or empty. Only a development instance whoseAPP_URLandAPI_URLare both onlocalhostfalls back to a public development secret.CREDENTIALS_KEYmissing or not 32 bytes, with the same localhost-only development fallback, or a key inCREDENTIALS_KEY_PREVIOUSthat is not 32 bytes.- In production,
COOKIE_SECURE=falsewhileAPI_URLishttps. - In production, embedded NATS listening beyond
127.0.0.1withoutNATS_TOKEN. OPENDESK_ROLEother thanall,apiorworker.STRIPE_SECRET_KEYset withoutSTRIPE_WEBHOOK_SECRETandSTRIPE_PRICE_PRO.- Only some of
APNS_KEY,APNS_KEY_IDandAPNS_TEAM_IDset,PUSH_RELAY_SERVE=truewithout an APNs key, or aPUSH_RELAY_URLthat is not anhttpsorigin. HELP_DOMAINthat is not a domain name,HELP_PROXY_SECRETshorter than 32 bytes, only one ofCLOUDFLARE_SAAS_ZONE_IDandCLOUDFLARE_SAAS_TOKEN, or Cloudflare for SaaS with neitherHELP_CNAME_TARGETnorHELP_DOMAIN.
The realtime gateway also refuses to start with an AUTH_SECRET under 32 bytes.
| Variable | Default | Meaning |
|---|---|---|
OPENDESK_ENV |
production, or development when APP_URL and API_URL are on localhost (the image sets production) |
development or production. Production enforces the checks above. |
OPENDESK_ROLE |
all |
all (API and workers), api or worker. See Scaling. |
HTTP_ADDR |
:8080 |
Address the HTTP server listens on. |
LOG_LEVEL |
info in production, debug otherwise |
debug, info, warn or error. debug adds a line for every mailbox sync (new messages, cursor, duration). |
SECURITY_CONTACT |
empty | Where to report a security problem with this instance, mailto: or https://. When set, opendesk serves /.well-known/security.txt with it. |
SECURITY_POLICY_URL |
empty | An https:// page describing how you handle reports, listed in security.txt. |
MAIL_LOG_BODIES |
true outside production |
With MAIL_DRIVER=log, print message bodies (with their sign-in and reset links) to the log. Production prints only the subject and refuses true, so links never land in logs. |
DATA_DIR |
./data |
Local data: attachments with the local driver, and embedded NATS storage. |
SERVE_WEB |
false |
Serve the embedded web app, /config.js and /config.json (for the desktop and iPhone apps) from this binary. true in the self-host bundle. |
SIGNUP_ENABLED |
true |
Allow anyone to register. When false, only invited people can create an account. |
TRUST_PROXY |
false |
Take the client IP from CF-Connecting-IP, then the first X-Forwarded-For entry. Only for a proxy you control that sets those headers itself (the bundled Caddy, Cloudflare). |
TRUSTED_PROXY_HOPS |
0 |
The number of proxies in front that append to X-Forwarded-For (nginx, Traefik, a load balancer). The client IP is the entry that many from the right, which a client cannot forge. Takes precedence over TRUST_PROXY. 0 uses the connection’s address. See Your own reverse proxy. |
UPDATE_CHECK |
true |
Look for new releases on GitHub every few hours and tell the instance admins (admin panel and email). Builds that are not a release never look. See Backups and upgrades. |
AUTO_UPDATE |
true (installer) |
Read by opendesk-ctl, not the server: install new releases each night. See automatic updates. |
EVENT_RETENTION |
168h |
How long events are kept for replay (a Go duration). |
For the embedded workspace app and instance admin panel, set APP_BRAND_NAME to use your product name in the existing shell, sign-in flow and browser titles. APP_BRAND_LOGO_URL supplies the lockup and APP_BRAND_ICON_URL the square mark and favicon. APP_BRAND_WEBSITE_URL, APP_BRAND_DOCS_URL, APP_BRAND_TERMS_URL and APP_BRAND_PRIVACY_URL point to your own pages. These accept HTTPS URLs or same-origin paths. Configure any image assets on a host you operate, or place them in web/public/ before building the embedded app. Workspace help centers and widgets keep using each brand’s own settings.
| Variable | Default | Meaning |
|---|---|---|
API_URL |
http://localhost:8080 |
Public URL of the API. OAuth redirect URIs are built from it. |
APP_URL |
http://localhost:5173 |
Public URL of the web app. Links in email point here. |
GATEWAY_URL |
ws://localhost:4000/socket |
Public WebSocket URL of the realtime gateway, given to clients. |
SITE_URL |
https://opendesk.sh |
Marketing site URL used in links. |
DOCS_URL |
Your documentation site or a path to it on the app’s domain. Publish the docs before setting this value. APP_BRAND_DOCS_URL takes precedence. |
|
CORS_ORIGINS |
APP_URL |
Comma-separated origins allowed to call the API from a browser. |
ADMIN_URL |
APP_URL + /admin |
Where the admin panel is. Its origin is the only one the admin API (/v1/admin/*) accepts. |
ADMIN_ENV_LABEL |
empty | A label in the admin panel’s top bar, such as Production. |
COOKIE_DOMAIN |
empty (host only) | Domain for the refresh cookie. Set it when the API and app are on different subdomains of one domain. |
COOKIE_SECURE |
true when API_URL is https |
Mark cookies Secure. |
On a self-hosted single domain, API_URL and APP_URL are both https://desk.example.com and GATEWAY_URL is wss://desk.example.com/socket.
Help centers
Section titled “Help centers”Where each brand’s help center lives, and how custom domains reach it. See Help center addresses for what customers do, and Docker Compose for the DNS and certificates of a self-hosted instance.
| Variable | Default | Meaning |
|---|---|---|
HELP_DOMAIN |
empty | Puts each help center at <slug>.HELP_DOMAIN, such as https://acme.help.example.com, with the scheme of APP_URL. Needs a wildcard DNS record for *.HELP_DOMAIN. Empty keeps help centers at APP_URL/help/<slug>. opendesk Cloud uses opendeskhelp.com. |
HELP_CNAME_TARGET |
custom.HELP_DOMAIN with Cloudflare for SaaS, else the host of APP_URL |
The hostname customers point their custom domain’s CNAME at. It must reach this instance. |
HELP_PROXY_SECRET |
empty | At least 32 bytes, shared with an edge proxy in front of the help centers (opendesk Cloud’s help worker). When set, the help center host is read only from a request that carries the secret (OD-Help-Secret), with OD-Help-Host and OD-Help-Client-IP. Leave it empty when Caddy or another proxy forwards the Host header as is. |
CLOUDFLARE_SAAS_ZONE_ID |
empty | A Cloudflare zone with Cloudflare for SaaS: verified custom domains become custom hostnames of it, with certificates from Cloudflare. Set together with the token. |
CLOUDFLARE_SAAS_TOKEN |
empty | A Cloudflare API token with SSL and Certificates: Edit on that zone only. Without the pair, the instance’s own proxy issues certificates on demand (Caddy, asking GET /v1/public/help-domains/tls?domain=). |
Database
Section titled “Database”| Variable | Default | Meaning |
|---|---|---|
DATABASE_URL |
postgres://opendesk:opendesk@localhost:5432/opendesk?sslmode=disable |
Pooled connection used by request handlers. On Neon, the -pooler host. |
DATABASE_URL_DIRECT |
DATABASE_URL |
Direct connection for migrations, background jobs and the event relay, which need session features such as LISTEN/NOTIFY. |
See Postgres and Neon.
Redis cache
Section titled “Redis cache”| Variable | Default | Meaning |
|---|---|---|
REDIS_URL |
empty | Optional private redis:// or rediss:// connection for help center, report and translation results. The Compose profile cache provides Redis at redis://redis:6379/0. |
Secrets
Section titled “Secrets”| Variable | Default | Meaning |
|---|---|---|
AUTH_SECRET |
none (development on localhost: a public development secret) | At least 32 bytes. Signs every JWT. Must be identical in opendesk and the realtime gateway. |
CREDENTIALS_KEY |
none (development on localhost: a public development key) | 32 bytes, hex or base64. Encrypts mailbox credentials, OAuth tokens, webhook secrets and TOTP secrets with AES-256-GCM. Change it only with the old key in CREDENTIALS_KEY_PREVIOUS, as in Replace CREDENTIALS_KEY: on its own, a new key leaves existing credentials unreadable. |
CREDENTIALS_KEY_PREVIOUS |
empty | Keys CREDENTIALS_KEY replaced, separated by commas, in the same format. Values they encrypted still decrypt, and a background pass encrypts them again with CREDENTIALS_KEY; remove this once the logs say it can be removed. |
| Variable | Default | Meaning |
|---|---|---|
NATS_URL |
empty | Empty runs NATS embedded in this process. Set it to use an external NATS cluster. |
NATS_TOKEN |
empty | Token for the embedded server, or for the external cluster. Required in production when embedded NATS listens beyond localhost. |
NATS_LISTEN |
127.0.0.1:4222 |
Where embedded NATS listens, so the realtime gateway can connect. |
NATS_STORE_DIR |
DATA_DIR/nats |
Embedded NATS storage directory. |
Storage
Section titled “Storage”| Variable | Default | Meaning |
|---|---|---|
STORAGE_DRIVER |
local |
local (under DATA_DIR) or s3 (any S3-compatible store). |
S3_BUCKET |
Bucket name. | |
S3_REGION |
auto |
Region. auto suits Cloudflare R2. |
S3_ENDPOINT |
Custom endpoint for R2, MinIO and others. Empty uses AWS. | |
S3_ACCESS_KEY_ID |
Access key. | |
S3_SECRET_ACCESS_KEY |
Secret key. | |
S3_FORCE_PATH_STYLE |
false |
Use path-style URLs. Usually needed for MinIO. |
See Storage.
Platform email
Section titled “Platform email”Verification, password reset and invitation emails. Replies to customers go through each mailbox, not this, except from a mailbox that sends through opendesk.
A super admin can set the registration policy and SMTP delivery in Platform settings → Registration and email. The test uses the saved settings and reports provider handoff. Use the deployment settings in the panel to go back to the configured log, SMTP or SES mailer.
| Variable | Default | Meaning |
|---|---|---|
MAIL_DRIVER |
log |
log (print to the log), smtp or ses. |
MAIL_FROM |
opendesk <notifications@localhost> |
From address. |
SMTP_HOST |
SMTP server. | |
SMTP_PORT |
587 |
SMTP port. |
SMTP_USERNAME |
SMTP username. | |
SMTP_PASSWORD |
SMTP password. | |
SMTP_TLS |
starttls |
starttls, tls or none. |
SES_REGION |
us-east-1 |
Amazon SES region, with MAIL_DRIVER=ses. Credentials come from the standard AWS environment. |
EMAIL_LEGAL_ENTITY |
Company name for a line under every email’s footer, where the law asks for one. Unset shows no company line. | |
EMAIL_LEGAL_COMPANY_NUMBER |
Company number in that line. | |
EMAIL_LEGAL_PLACE_OF_REGISTRATION |
Where the company is registered, for example England and Wales. |
|
EMAIL_LEGAL_ADDRESS |
Registered office address. |
Notification emails
Section titled “Notification emails”How often notification emails may go to one person (see How emails are paced). Durations are Go durations: 90s, 5m, 1h.
| Variable | Default | Meaning |
|---|---|---|
NOTIFY_EMAIL_PACING |
relaxed (strict with billing on) |
The set of defaults the variables below change. |
NOTIFY_EMAIL_DELAY |
5m |
Wait after a notification before its email, so reading it in the app first skips the email. |
NOTIFY_EMAIL_COOLDOWNS |
5m,15m,30m,1h (15m,30m,1h) |
Gaps between emails while more keeps coming; the last one repeats. |
NOTIFY_EMAIL_QUIET_RESET |
2h |
Quiet time after which the gaps start over. |
NOTIFY_EMAIL_URGENT_GAP |
5m (10m) |
Shortest gap an urgent notification can cut a wait down to. |
NOTIFY_EMAIL_URGENT_PER_DAY |
12 (6) |
How many times a day urgent ones may cut a wait short. |
NOTIFY_EMAIL_PER_HOUR |
12 (4) |
Most emails per person in an hour, digests included. |
NOTIFY_EMAIL_PER_DAY |
100 (24) |
Most emails per person in a day. |
NOTIFY_EMAIL_INSTANCE_PER_MINUTE |
60 (120) |
Most notification emails the whole server sends in a minute; the rest wait. |
NOTIFY_EMAIL_ACTIVE_WINDOW |
5m |
Nothing is emailed while someone was active in the workspace this recently. |
Inbound email
Section titled “Inbound email”| Variable | Default | Meaning |
|---|---|---|
INBOUND_DOMAIN |
in.localhost |
Forwarding addresses are <token>@INBOUND_DOMAIN. |
INBOUND_SECRET |
Signs POST /v1/inbound/email (the OD-Inbound-Signature header, an HMAC-SHA256 with a timestamp). Empty turns the endpoint off. |
|
INBOUND_SMTP_ADDR |
empty (off) | Address for the built-in SMTP receiver, such as :2525 or :25. |
INBOUND_SMTP_RELAYS |
empty | Comma-separated IP addresses or CIDR ranges of mail servers that relay to the built-in receiver after checking senders. Only mail they hand over has its INBOUND_AUTHSERV_ID results believed; mail straight from a sender’s server believes none. |
INBOUND_SMTP_TLS_CERT, INBOUND_SMTP_TLS_KEY |
empty | PEM certificate and key files for the MX host name. With both, the built-in receiver offers STARTTLS (TLS 1.2 or newer) and reads the files again when they change. |
INBOUND_AUTHSERV_ID |
empty | Comma-separated authserv-ids of the receiving servers whose Authentication-Results are believed, such as mx.cloudflare.net for the Cloudflare Email Worker. Only the first such header from the top counts. Gmail and Microsoft 365 mailboxes always trust their own provider. With the built-in SMTP receiver they count only for mail from a relay in INBOUND_SMTP_RELAYS: the receiver does not check senders, so mail straight from a sender’s server has an unknown DMARC result. A listed server that seals mail it forwards (ARC) is a trusted sealer when its seal’s d= is its own host name or the domain above it. |
See Email setup.
Sign-in providers and mailbox OAuth
Section titled “Sign-in providers and mailbox OAuth”A super admin can enable Google, GitHub and X under Platform settings → Third-party sign-in. Register the callback URL shown there with the provider, then enter the OAuth client ID and client secret. Sign-in settings are read when people open the sign-in page. Mailbox connections use their separately configured OAuth clients.
| Variable | Default | Meaning |
|---|---|---|
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET |
Google sign-in, and Gmail mailbox connections unless they have their own client. | |
GOOGLE_MAILBOX_CLIENT_ID, GOOGLE_MAILBOX_CLIENT_SECRET |
the sign-in client | A separate Google client for Gmail mailbox connections, for example in its own Google Cloud project for the Gmail scopes’ review. |
MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET |
Microsoft sign-in, and Outlook mailbox connections unless they have their own app. | |
MICROSOFT_MAILBOX_CLIENT_ID, MICROSOFT_MAILBOX_CLIENT_SECRET |
the sign-in app | A separate Microsoft app for Outlook mailbox connections, for example to offer mailboxes without Microsoft sign-in. |
MICROSOFT_TENANT |
common |
common, organizations, consumers or your tenant id. |
GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET |
GitHub sign-in. | |
OIDC_ISSUER, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET |
Any OpenID Connect provider for single sign-on. | |
OIDC_NAME |
SSO |
Button label for the OIDC provider. |
See Google and Microsoft OAuth. A sign-in provider is offered only when it is configured (for OIDC, the issuer and client id).
Mailbox sign-in
Section titled “Mailbox sign-in”Connecting a mailbox with Google or Microsoft sign-in has its own switch per provider. It is on when that provider’s client is configured, and it does not change how people sign in to opendesk. The sign-in sends replies from the mailbox; with receiving over IMAP on, it can also sync the mailbox.
| Variable | Default | Meaning |
|---|---|---|
GOOGLE_MAILBOX_OAUTH |
true when GOOGLE_CLIENT_ID is set |
false stops offering Google sign-in for new mailboxes. Mailboxes already connected with it keep working and can reconnect. |
MICROSOFT_MAILBOX_OAUTH |
true when MICROSOFT_CLIENT_ID is set |
The same for Microsoft. |
MAILHOST_ISPDB |
false (true with billing configured) |
When detecting a mailbox’s servers, also look up unknown domains in Thunderbird’s public ISPDB (autoconfig.thunderbird.net). The domain’s own autoconfig, MX and SRV records are always used. |
With a provider’s mailbox sign-in off, or its client not configured, the mailbox wizard offers the other ways: any provider forwards its mail into opendesk, and replies go out through the mailbox’s SMTP server (for Gmail and Google Workspace with an app password, for Microsoft 365 when the tenant allows SMTP AUTH) or a sending service, or, with MAILBOX_SYSTEM_SEND on, through opendesk. With receiving over IMAP on, other providers, and Gmail and Google Workspace with an app password, can also connect over IMAP and SMTP with the settings the wizard detects.
A value that is not true or false (or 1 and 0) turns the switch off. The API answers a new connection with 403 mailbox_oauth_disabled, and the web app reads the same list from its runtime config (mailboxOAuth).
Receiving over IMAP
Section titled “Receiving over IMAP”Every mailbox can receive by forwarding. A self-hosted instance can also let mailboxes receive over IMAP: generic IMAP mailboxes, and Google and Microsoft mailboxes connected to sync. opendesk Cloud runs with it off, so its mailboxes receive by forwarding and Google and Microsoft connect send-only.
| Variable | Default | Meaning |
|---|---|---|
MAILBOX_IMAP |
true |
false turns receiving over IMAP off. The wizard then offers forwarding to receive, and Google and Microsoft sign-in to send only; SMTP sending stays available. Mailboxes that read over IMAP are kept with their tickets, but no longer polled: their page shows that receiving is off until they switch to forwarding. |
With it off, the API refuses an IMAP, Google or Microsoft inbound_kind and a Google or Microsoft connection that syncs, with 422 imap_off, and the web app reads the same setting from its runtime config (mailboxImap). Workspaces with Collab are the exception for generic IMAP while COLLAB_IMAP is on: their mailboxes may still receive over IMAP and SMTP, through the same network guard. They can also connect Google and Microsoft to read the inbox directly through the Gmail API or Microsoft Graph, with the Collab clients below, so no forwarding is needed; that works whatever MAILBOX_IMAP says. Syncing Gmail needs the restricted https://mail.google.com/ scope, and Microsoft the IMAP.AccessAsUser.All permission, on your OAuth apps; see Google and Microsoft OAuth.
Sending through opendesk
Section titled “Sending through opendesk”Every mailbox can send through Google or Microsoft, or over SMTP through its mail server or a sending service such as Resend or Postmark. A self-hosted instance can also let mailboxes send through opendesk: replies go out through the platform email (MAIL_DRIVER), from MAIL_FROM with the mailbox’s name, and customers’ answers come back to the mailbox’s address. opendesk Cloud runs with it off, so every mailbox sends from its own address.
| Variable | Default | Meaning |
|---|---|---|
MAILBOX_SYSTEM_SEND |
true |
false turns sending through opendesk off. The wizard and the mailbox’s settings then offer Google, Microsoft and SMTP only. Mailboxes that send through opendesk are kept with their tickets and settings, but send nothing: the Mailboxes page marks them Not sending, the reply box in their tickets says the address can’t send yet, and their page asks for SMTP or a Google or Microsoft connection. Automations skip their email replies, Ollie’s email answers wait as suggested replies, and auto-replies and satisfaction surveys are not sent. |
With it off, the API refuses outbound_kind system on a new or changed mailbox with 422 system_send_off, and an email reply from a mailbox that still has it with 422 mailbox_cannot_send; a reply queued before the change fails with that reason. Mailboxes report sending: "system_off", and the web app reads the setting from GET /v1/mailboxes/connect-options (system_send). See Mailboxes.
Collab: your own mail accounts
Section titled “Collab: your own mail accounts”Collab lets each member connect their own email account (Google, Microsoft or any IMAP server) and read and handle it in opendesk like a mail client: every folder and label, read and unread, stars, archive, move, trash and spam, replies and new mail, with each change made at the provider too. An account is private to whoever connected it, or shared with the workspace or with teams and people, and any single conversation can be shared, assigned and discussed on its own. A self-hosted instance has it for every workspace unless COLLAB=false. On an instance that runs billing, only workspaces on Pro or Premium have it.
| Variable | Default | Meaning |
|---|---|---|
COLLAB |
true |
false turns Collab off on this instance. Accounts already connected are kept but not synced, and the Mail pages are gone. |
COLLAB_IMAP |
true |
Offer accounts on any IMAP and SMTP server (with an app password where the host needs one). |
COLLAB_GOOGLE_CLIENT_ID, COLLAB_GOOGLE_CLIENT_SECRET |
the mailbox client (GOOGLE_MAILBOX_CLIENT_ID) |
The Google client Gmail and Google Workspace accounts connect with. It needs the Gmail API enabled and the openid, email, profile, https://www.googleapis.com/auth/gmail.modify and https://www.googleapis.com/auth/gmail.settings.basic scopes on its consent screen (the second keeps each account’s signature, From name and vacation responder in sync with Gmail). |
COLLAB_GOOGLE_PUBSUB_TOPIC, COLLAB_GOOGLE_PUBSUB_SERVICE_ACCOUNT |
none | Gmail push: new Gmail arrives in seconds instead of with the next sync (every minute while someone is active, else every 10 minutes). The topic is projects/<project>/topics/<topic> in the Collab client’s Google project, and [email protected] needs the Pub/Sub Publisher role on it. Give it a push subscription to <API_URL>/v1/collab/google/push with authentication on, signed as the service account you set here. Both empty, Gmail accounts sync on the timer alone. |
COLLAB_MICROSOFT_CLIENT_ID, COLLAB_MICROSOFT_CLIENT_SECRET |
the mailbox app (MICROSOFT_MAILBOX_CLIENT_ID) |
The Microsoft app Microsoft 365 and Outlook.com accounts connect with, with the Microsoft Graph delegated permissions Mail.ReadWrite, Mail.Send, User.Read, MailboxSettings.ReadWrite (automatic replies and categories) and offline_access. |
Add these redirect URIs to the clients: <API_URL>/v1/collab/accounts/oauth/google/callback and <API_URL>/v1/collab/accounts/oauth/microsoft/callback. Support mailboxes connected to read the inbox directly sign in with these clients too, through the mailbox redirect URIs: when the Collab clients are separate from the mailbox clients, also add <API_URL>/v1/mailboxes/oauth/google/callback and <API_URL>/v1/mailboxes/oauth/microsoft/callback to them. gmail.modify is a restricted Google scope and gmail.settings.basic a sensitive one: an app used by people outside your own Google Workspace organization needs Google’s verification for them. An account connected before you added the settings scope or permission keeps syncing its mail, with its settings read only (Gmail) or not synced (Outlook automatic replies) until it is reconnected.
Profile pictures
Section titled “Profile pictures”| Variable | Default | Meaning |
|---|---|---|
LOGO_DEV_TOKEN |
A logo.dev publishable token. When set, company logos come from logo.dev instead of the company’s website. |
Agent pictures from Google and GitHub, Gravatar and website icons need no configuration. See Profile pictures and logos.
Bot protection and analytics
Section titled “Bot protection and analytics”| Variable | Default | Meaning |
|---|---|---|
TURNSTILE_SITE_KEY, TURNSTILE_SECRET |
Cloudflare Turnstile on login, registration and password reset. | |
POSTHOG_KEY |
Product analytics. Empty sends nothing. | |
POSTHOG_HOST |
https://us.i.posthog.com |
PostHog host. |
Server-side analytics is off while POSTHOG_KEY is empty. Setting it opts the instance into
the backend event schemas: only known event names and approved scalar properties are sent;
unknown events, nested values, and unapproved properties are discarded. User and workspace
UUIDs identify events. Message text, email addresses, credentials, and exception messages are
not included. Browser analytics has separate WEB_POSTHOG_KEY and WEB_POSTHOG_HOST settings
and is not limited by these schemas.
The receiving PostHog project controls access, data residency, and retention, so configure
those settings for your deployment; the instance does not set PostHog retention.
AI features are on when a provider is configured. See AI features.
| Variable | Default | Meaning |
|---|---|---|
AI_PROVIDER |
detected | anthropic, openai (any OpenAI-compatible endpoint) or none. When empty: anthropic if ANTHROPIC_API_KEY is set, else openai if OPENAI_API_KEY is set, else none. |
ANTHROPIC_API_KEY |
Anthropic API key. | |
OPENAI_API_KEY |
Key for OpenAI or a compatible endpoint. | |
OPENAI_BASE_URL |
https://api.openai.com/v1 |
Any OpenAI-compatible endpoint: Azure, Ollama, vLLM, LM Studio. Point it at a local model to keep everything on your server. |
AI_MODEL |
claude-sonnet-5-5 with Anthropic |
Model for drafting, summaries and answers. Required for openai. |
AI_FAST_MODEL |
claude-haiku-4-5-20251001 with Anthropic, else AI_MODEL |
Model for triage, classification and short rewrites. |
AI_AGENT_INSTRUCTIONS |
empty | Optional instance-wide instructions for the chat and email support agents in every workspace, at most 8,000 characters (more refuses to boot). Keep universal rules here and product-specific ones in each bot: a bot’s instructions win over the workspace’s, which win over these. In .env, double-quote text that spans several lines. |
EMBEDDINGS_DRIVER |
detected | voyage, openai or none. When empty: voyage if VOYAGE_API_KEY is set, else openai with the openai provider, else none (search falls back to Postgres full-text search). |
VOYAGE_API_KEY |
Voyage AI key for embeddings. | |
EMBEDDINGS_MODEL |
Embeddings model. | |
DECISIONS_PROVIDER |
detected | Engine for typed decisions (triage, the chat answer bot’s relevance check, ai_decide automation conditions): typesafe (Jev by TypeSafe), llm (the AI provider’s fast model) or none. When empty: typesafe if TYPESAFE_API_KEY is set, else llm if an AI provider is configured, else none. |
TYPESAFE_API_KEY |
TypeSafe API key for Jev. Without it, decisions use the LLM path and every feature keeps working. | |
TYPESAFE_API_URL |
https://api.typesafe.ai |
TypeSafe API base URL. For the Vercel AI Gateway use https://ai-gateway.vercel.sh/typesafe with TYPESAFE_MODEL=typesafe-ai/jev. |
TYPESAFE_MODEL |
jev-latest |
Jev model or alias. Pin a version such as jev-1.13.0 to keep answers stable across releases. |
Semantic search needs the Postgres vector extension (pgvector). Without it, opendesk uses full-text search.
Integrations
Section titled “Integrations”Connected products for Ollie (MCP servers). Most sign in without any setup; see Integrations.
| Variable | Default | Meaning |
|---|---|---|
MCP_<KEY>_CLIENT_ID |
An OAuth client registered in advance with a product that does not accept self-registration: MCP_SLACK_CLIENT_ID, MCP_BOX_CLIENT_ID, and MCP_GITHUB_CLIENT_ID (a GitHub App; without one GitHub asks for a token). Redirect URL: <API_URL>/v1/integrations/oauth/callback. |
|
MCP_<KEY>_CLIENT_SECRET |
That client’s secret, when the product issued one. |
Native apps
Section titled “Native apps”Settings for the desktop and iPhone apps. The desktop app needs none of them. See Push notifications for choosing a push mode.
| Variable | Default | Meaning |
|---|---|---|
PUSH_RELAY_URL |
empty (off) | Send iPhone pushes through this relay when there is no APNs key: an https origin, such as https://api.opendesk.sh. The relay sees this instance’s address, the notification type and the ticket number, never ticket text, names or email addresses. |
APNS_KEY |
empty | APNs auth key: the .p8 file as PEM text or base64. With a key, the instance sends pushes itself (direct mode). |
APNS_KEY_ID |
The key’s id. Required with APNS_KEY. |
|
APNS_TEAM_ID |
The Apple developer team that owns the key and signs the app. Required with APNS_KEY. |
|
APNS_TOPIC |
sh.opendesk.app |
The bundle id of the app that receives pushes. |
APP_ATTEST_APP_IDS |
empty (off) | Comma-separated app ids (TEAMID.bundle) whose App Attest proofs are accepted in place of Turnstile on login, registration and password reset. Needed for the iPhone app only when Turnstile is on. |
APP_ATTEST_DEVELOPMENT |
false |
Also accept App Attest keys from development builds (run from Xcode). Leave off in production. |
PUSH_RELAY_SERVE |
false |
Cloud only: serve the push relay (/v1/push/relay/*) for other instances. Needs an APNs key. |
Push mode follows from these: an APNs key means direct, else PUSH_RELAY_URL means relay, else off. GET /v1/auth/config reports it under native.push.
Every instance answers GET /v1/push/instance-key with the public half of a key derived from AUTH_SECRET, which the relay uses to check that pushes come from this instance. Changing AUTH_SECRET changes it.
Billing
Section titled “Billing”Leave all payment providers unconfigured to give each workspace the unlimited self_hosted plan with its own AI provider. Stripe enables subscriptions, and a merchant account for WeChat Pay or Alipay enables prepaid CNY offers. The checkout’s deploy/README.md has the provider setup instructions. contracts/billing.md documents the plan catalog and entitlement behavior.
Use Platform settings → Subscriptions and payments to manage the plan catalog and payment settings. Restart the API and worker processes after saving to activate the same revision on both. Stripe needs recurring price IDs and a webhook from the same Stripe account.
Enable charge.refunded, refund.created, refund.updated and refund.failed on that Stripe webhook to keep Orders in sync with refund activity. Instance super admins can sync historical Stripe payments from the billing tab of a workspace. They can issue a full or partial refund for an eligible Stripe subscription invoice. The subscription schedule remains in effect.
| Variable | Default | Meaning |
|---|---|---|
BILLING_PLAN_CATALOG |
JSON overrides of the display name and entitlements for free, pro and premium. |
|
STRIPE_SECRET_KEY |
Enables Stripe checkout and subscriptions. | |
STRIPE_WEBHOOK_SECRET |
Verifies Stripe webhooks. Required with Stripe. | |
STRIPE_PRICE_PRO |
Monthly per-seat price. Required with Stripe. | |
STRIPE_PRICE_PRO_YEARLY |
Optional yearly per-seat price. | |
STRIPE_PRICE_PREMIUM |
Monthly per-seat price of Premium. Without it Premium cannot be bought. | |
STRIPE_PRICE_PREMIUM_YEARLY |
Optional yearly per-seat price of Premium. | |
STRIPE_PRICE_AI_TOPUP |
One-time $10 price that sets the rate for AI usage: top-ups of $5 to $5,000 are charged on its product at its rate, dollar for dollar at $10. STRIPE_PRICE_CREDITS is still read when this is unset. |
|
AI_USAGE_MARKUP |
1.5 |
What each AI call is charged, as a multiple of its provider cost (1 to 100). Read only when billing is on. AI_CREDIT_MARKUP is still read when this is unset. |
STRIPE_API_URL |
Development only: a local Stripe fake or stripe-mock. Refused when OPENDESK_ENV=production. |
|
BILLING_CNY_PRO_MONTH, BILLING_CNY_PRO_YEAR |
Prepaid Pro price per workspace in CNY fen. | |
BILLING_CNY_PREMIUM_MONTH, BILLING_CNY_PREMIUM_YEAR |
Prepaid Premium price per workspace in CNY fen. | |
WECHAT_PAY_*, ALIPAY_* |
Merchant credentials for the chosen CNY payment methods. Use the names in deploy/self-host/.env.template. |
Realtime gateway
Section titled “Realtime gateway”The realtime container reads its own variables:
| Variable | Default | Meaning |
|---|---|---|
PORT |
4000 |
Listen port. |
AUTH_SECRET |
The same value as opendesk. Verifies socket tokens. | |
NATS_URL |
NATS to subscribe to: opendesk’s embedded server (NATS_LISTEN) or your cluster. |
|
NATS_TOKEN |
NATS token. | |
CHECK_ORIGINS |
Comma-separated browser origins allowed to open agent sockets, such as https://desk.example.com. The chat widget endpoint (/socket/widget) accepts any origin, since it takes only widget tokens. |
|
SECRET_KEY_BASE |
Phoenix secret. Generate with openssl rand -hex 48. |
|
CLUSTER_DNS |
empty | A DNS name that resolves to every gateway node, so Presence spans nodes. A single node needs nothing. |
POSTHOG_KEY, POSTHOG_HOST |
Optional connection metrics and errors. |
The gateway’s health check is GET /health.