Skip to main content

Configuration Reference

All MosBot API configuration is provided via environment variables. Copy .env.example to .env in the mosbot-api directory to get started.

Required variables​

These must be set before the API will start:

VariableDescription
DB_PASSWORDPostgreSQL password. Set this to match your PostgreSQL configuration or generate a secure password.
JWT_SECRETJWT signing secret. Generate with: node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"
CORS_ORIGINExact dashboard origin (e.g. http://localhost:5173). Cannot be *.

Server​

VariableDefaultDescription
PORT3000HTTP port the API listens on
NODE_ENVdevelopmentSet to production in production deployments
TIMEZONEUTCIANA timezone for cron schedules and time displays (e.g. Asia/Singapore)

Database​

VariableDefaultDescription
DB_HOSTlocalhostPostgreSQL host
DB_PORT5432PostgreSQL port
DB_NAMEmosbotDatabase name
DB_USERmosbotDatabase user
DB_PASSWORD—See Required variables section above

Authentication​

VariableDefaultDescription
JWT_SECRET—See Required variables section above
JWT_EXPIRES_IN7dToken expiry duration (e.g. 7d, 24h, 1h)

Bootstrap (first run only)​

These variables create the initial owner account on first startup. Remove BOOTSTRAP_OWNER_PASSWORD after your first login.

VariableDescription
BOOTSTRAP_OWNER_EMAILEmail for the initial owner account
BOOTSTRAP_OWNER_PASSWORDPassword (minimum 12 characters). Remove after first login.
BOOTSTRAP_OWNER_NAMEDisplay name for the owner account (default: Owner)

Task archiver​

Completed tasks are automatically archived after a configurable number of days.

VariableDefaultDescription
ENABLE_ARCHIVERtrueEnable the automatic task archiver
ARCHIVE_CRON0 3 * * *Cron schedule for archiving (default: 3am daily)
ARCHIVE_AFTER_DAYS7Archive tasks completed more than N days ago
ARCHIVE_ON_STARTUPfalseRun archiver immediately on startup

OpenClaw Workspace​

Required for workspace file browsing, skills management, and config editing. Without these variables, the workspace browser and skills features will be unavailable.

VariableDefaultDescription
OPENCLAW_WORKSPACE_URL—URL of the OpenClaw workspace service (e.g. http://localhost:8080)
OPENCLAW_WORKSPACE_TOKEN—Bearer token for workspace service authentication. Obtain from OpenClaw admin panel.

OpenClaw Gateway​

Required for agent monitoring, live session data, and runtime control. Without these variables, the org chart and agent monitoring features will be unavailable.

VariableDefaultDescription
OPENCLAW_GATEWAY_URL—URL of the OpenClaw gateway (e.g. http://localhost:18789)
OPENCLAW_GATEWAY_TOKEN—Bearer token for gateway authentication
OPENCLAW_GATEWAY_TIMEOUT_MS15000Request timeout in milliseconds

OpenClaw Device Auth​

Required for full session access with operator.read/operator.write scopes. These values are generated by the OpenClaw device pairing flow. Without these, session details in the Agent Monitor will be limited.

VariableDescription
OPENCLAW_DEVICE_IDDevice identifier from the pairing flow
OPENCLAW_DEVICE_PUBLIC_KEYEd25519 public key (base64url encoded). Generated during OpenClaw device pairing process.
OPENCLAW_DEVICE_PRIVATE_KEYEd25519 private key (base64url encoded)
OPENCLAW_DEVICE_TOKENDevice pairing token

Data retention​

Controls how long subagent session data and activity logs are kept.

VariableDefaultDescription
SUBAGENT_RETENTION_DAYS30Keep subagent session data for N days
ACTIVITY_LOG_RETENTION_DAYS7Keep activity logs for N days
RETENTION_ARCHIVE_ENABLEDtrueEnable retention archiving
ENABLE_SUBAGENT_RETENTION_PURGEtrueEnable automatic purge of old data
SUBAGENT_RETENTION_CRON0 3 * * *Purge cron schedule (default: 3am daily)
SUBAGENT_RETENTION_ON_STARTUPfalseRun purge immediately on startup

Model pricing (optional)​

Enables live model cost data from OpenRouter for the Agent Monitor.

VariableDefaultDescription
OPENROUTER_API_KEY—OpenRouter API key for fetching model pricing data
MODEL_PRICING_REFRESH_INTERVAL_MS604800000How often to refresh pricing (default: 7 days)

Dashboard configuration​

The dashboard (mosbot-dashboard) also has its own .env file:

VariableDefaultDescription
VITE_API_URLhttp://localhost:3000URL of the MosBot API
VITE_* variables are embedded into the built JavaScript bundle and are therefore

public. Never put secrets in dashboard environment variables. :::