Constructor options
Pass configuration directly when creating a client instance. Any option you provide takes precedence over the corresponding environment variable.| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | OPENBAT_API_KEY env var | Your chatbot’s API key. Required either here or as an environment variable. |
baseUrl | string | OPENBAT_BASE_URL or https://app.openbat.dev | The OpenBat API base URL. |
enabled | boolean | true (unless env var is "false" or "0") | When false, all SDK methods become no-ops. |
Environment variables
| Variable | Description | Default |
|---|---|---|
OPENBAT_API_KEY | Your chatbot’s API key (ob_live_...) | Required if not in constructor |
OPENBAT_BASE_URL | API base URL | https://app.openbat.dev |
OPENBAT_ENABLED | Set to "false" or "0" to disable | true |
API key format
API keys follow this format:ob_live_a1b2c3 (roughly the first 14 characters) is stored in the dashboard so you can identify which key is active. The full key is hashed with SHA-256 before storage — only the hash is persisted on the server. You can only view the full key at creation or rotation time.
Disabling the SDK
There are two ways to disable the SDK: Environment variable — setOPENBAT_ENABLED to "false" or "0" in your environment:
.env.test
enabled: false when creating the client:
recordMessages becomes a no-op. It resolves immediately without making any network requests or throwing errors. This is useful for test and CI environments where you do not want SDK traffic.