REST API ↗
API reference

<DialogueProvider>

The required root. Constructs the core, wires the LiveKit media bridge, and exposes everything to the hooks below it.

Import

ts
import { DialogueProvider } from '@dialogueai/react';
tsx
<DialogueProvider
  publishableKey="pk_live_…"
  bootstrapTokenProvider={getToken}
  locale="EN"
  environment="production"
>
  {children}
</DialogueProvider>

Props

childrenReactNoderequired
Your tree. Mount <Interview> or your custom hook-driven UI inside.
publishableKeystringoptional
Your public key (pk_…). Reserved/forward-looking today: the provider accepts it but does not yet use it for auth — authentication is driven entirely by bootstrapTokenProvider (and anonymous mode when it’s absent). Safe to pass; it’ll back origin allow-listing once that lands.
bootstrapTokenProvider() => Promise<BootstrapTokenResult>optional
The only way to inject real tokens. Resolves to { bootstrapToken, expiresAt } (see Types). Absent ⇒ degraded anonymous mode. See Authentication.
localeDialogueLocaleoptional
Initial UI locale (e.g. 'EN', 'ES'). Locks once the interview is created. When omitted, the SDK resolves it as navigator.language (uppercased, if it’s one of the supported codes) → 'EN'. See all 17 locale codes.
environment'production' | 'staging'default: 'production'optional
Selects the Dialogue backend environment.
baseUrlstringoptional
Override the API base URL. Useful behind a same-origin proxy (e.g. '/dlg') to avoid cross-origin requests.
debugbooleandefault: falseoptional
Verbose console logging via the console error reporter.
sentryDsnstringoptional
DSN for the scoped SDK error client. The SDK uses an isolated Sentry client + hub. It never calls Sentry.init, so it won’t pollute your host’s Sentry. Omit to use the console reporter.

Rules

Exactly one provider per tree. A nested <DialogueProvider> is rejected at mount.
  • The core is constructed eagerly but cheaply; no network happens until a hook opens a study.
  • It disposes the core on unmount; remount (new React key) to restart the journey.
  • publishableKey and bootstrapTokenProvider identity are effectively immutable for a given provider instance.