Docs
API Documentation
Configuration

Configuration

Runtime environment variables, dashboard settings, and config API behavior

by saifyxpro

HeadlessX configuration now comes from three layers:

  1. Required environment variables for booting the stack
  2. Optional environment defaults that seed or influence runtime behavior
  3. Dashboard / API-managed settings stored in the database

Required environment variables


These values are part of the current working setup and should be present in .env.

VariableRequiredPurpose
DATABASE_URLYesPostgreSQL connection string for Prisma and application state
PORTYesBackend API port
WEB_PORTYes for local clarityFrontend dashboard port
NEXT_PUBLIC_API_URLYesURL the dashboard uses to reach the backend
FRONTEND_URLYes for non-default deploysAllowed frontend origin for CORS
DASHBOARD_INTERNAL_API_KEYYesShared secret used by the Next.js dashboard server when proxying /api/*
CREDENTIAL_ENCRYPTION_KEYYesKey used to encrypt stored proxy and profile passwords

Example

Optional environment-backed settings


These are still read by the backend today, but they are better treated as defaults than as your main operating interface.

VariableDefaultNotes
NODE_ENVdevelopmentStandard runtime mode
HOST0.0.0.0Host binding for deployment scenarios
BROWSER_HEADLESStrueDefault browser headless mode before dashboard overrides are saved
BROWSER_TIMEOUT60000Default browser timeout in milliseconds
MAX_CONCURRENCY5Default concurrency before dashboard settings take over
PROFILE_ROTATION_ENABLEDfalseDefault profile rotation toggle
PROFILE_ROTATION_INTERVAL3600000Default profile rotation interval in milliseconds
BODY_LIMIT10mbExpress JSON body size limit

Some variables still present in older docs or examples are not wired into the current runtime. This page only documents values that are reflected in the codebase today.

Dashboard-managed settings


The dashboard and config API persist the main runtime settings to the database. The current ConfigController supports these fields:

SettingTypeMeaning
browserHeadlessbooleanRun the browser without a visible UI
browserTimeoutnumberRequest/browser timeout in milliseconds
maxConcurrencynumberMaximum concurrent scraping jobs
profileRotationIntervalnumberRotation interval for profile reuse workflows
camoufoxGeoipbooleanLet Camoufox align location with proxy IP
camoufoxBlockWebrtcbooleanDisable WebRTC leakage paths
camoufoxBlockImagesbooleanSkip image loading when you want lighter pages
camoufoxEnableCachebooleanEnable browser caching
camoufoxHumanizenumberHumanization factor used by the browser stack

Important behavior

  • Environment values act as defaults when the settings table is empty
  • Once settings are stored in the database, they become the active source of truth
  • Updating config through the API invalidates the backend config cache and restarts the browser service

Config API


All config endpoints require X-API-Key.

Get config

Example response shape:

Update config

Profiles and proxies


Profiles and proxies are configured through their own API groups and dashboard pages:

  • Profiles: /api/profiles
  • Proxies: /api/proxies

Those routes now require API key auth and no longer return raw stored passwords.

Security notes


Dashboard auth model

The dashboard is not meant to expose an internal secret in browser code anymore. The current model is:

  • Browser talks to Next.js /api/*
  • Next.js server injects DASHBOARD_INTERNAL_API_KEY
  • Backend verifies that internal secret or a normal API key

External integrations

For curl, n8n, Make, Zapier, or custom apps, call the backend directly and send a normal API key in X-API-Key.

Troubleshooting


Config changes do not seem to apply

Check these in order:

  1. Confirm the request returned success: true
  2. Re-fetch /api/config to verify the saved value
  3. If you changed .env, restart the affected process
  4. If you changed security variables, restart both API and dashboard

Dashboard and API disagree

Make sure the dashboard is pointing at the same backend you are testing:

  • NEXT_PUBLIC_API_URL
  • FRONTEND_URL
  • PORT
  • WEB_PORT

Next steps