Complete reference for RevTurbineInitOptions and related configuration types.
Field Type Description tenantIdstringYour RevTurbine tenant identifier apiKeystringAPI key (rt_live_*, rt_test_*, or 'local' for local mode) endpointstringRevTurbine API endpoint URL mode'react' | 'snippet' | 'iframe'SDK integration mode
Field Type Default Description runtimeMode'revturbine_server' | 'custom_endpoints' | 'local_only''revturbine_server'How the SDK resolves decisions endpointOverridesPartial<RevTurbineEndpointOverrides>— Custom endpoint URLs (for custom_endpoints mode) configProviderRevTurbineConfigProvider— Custom provider for Playbook localRuntimeRevTurbineLocalRuntimeOptions— Local-only mode configuration
Field Type Default Description providerRevTurbineSdkProvider | RevTurbineProviderFactory— Primary provider override providerFallbacksArray<...>— Fallback provider chain domainProvidersAnyDomainProvider[]— Domain-specific providers providerFailureSlotBehavior'placeholder' | 'invisible''invisible'Slot behavior after provider failure
Field Type Default Description uiPathResolversRevTurbineUiPathResolverMap— Map of CTA action types to resolver functions
Field Type Default Description userRevTurbineUserContext— Initial user context. plan_handle is the plan’s unique_handle — the value plan-scoped rules match on clientSession() => string | Promise<string>— Mints a client-session token so the SDK keeps server-derived context fresh on its own. See Server-derived context pageRevTurbinePageContext— Page context (URL, title, referrer, tags) contextPolicyRevTurbineContextPolicy{ inferUser: true, inferPage: true, routerAutoTrack: true }Auto-inference behavior
Your app tells RevTurbine who the user is. Some of that state, though, is only
knowable on your server — the plan a Stripe webhook just changed, trial status,
a payment that failed. clientSession is how the SDK gets it without you
wiring a refresh loop.
Supply a function that returns a client-session token minted by your backend
(POST /api/sdk/client-sessions). The SDK calls it when it first needs a
token, again after identify(), and again if the control plane reports one
expired — then fetches GET /api/sdk/client-context and folds the result into
its decisions. A purchase updates what the user can do with no further app
code.
publishableKey: ' rt_pub_… ' ,
user: { id: ' user_123 ' , plan_handle: ' free ' },
fetch ( ' /api/revturbine-session ' , { method: ' POST ' })
. then ( ( j ) => j . client_token ),
It is a function, not a token , because these tokens are short-lived (~10
minutes) — a value captured at init would go stale mid-session, and refreshing
it would become your problem.
The token is a transport credential, never user context: held in memory only,
never persisted, never logged, never placed in a URL. If your minter throws or
the fetch fails, the SDK keeps using the context your app supplied — enrichment
is best-effort and never breaks your app.
Omit clientSession and none of this happens: no token is requested and no
client-context call is made. Server-derived context is opt-in.
Field Type Default Description placementBehaviorPartial<RevTurbinePlacementBehaviorFlags>— Opt-in pipeline flags
Field Type Default Description persistentStorageRevTurbineStoragelocalStoragePersistent storage override sessionStorageRevTurbineStoragesessionStorageSession storage override
Field Type Default Description inferUserbooleantrueAuto-detect user info from browser APIs inferPagebooleantrueAuto-capture URL, title, referrer routerAutoTrackbooleantrueTrack SPA route changes
Field Type Description playbookPlaybookFull Playbook snapshot for local execution placementsLocalPlacementDatasetOptional static placements dataset initialDataobjectStatic data for local decisions (see below) resolversobjectOptional resolver callbacks (see below) storageKeystringOptional localStorage key override getContext() => Promise<JsonObject>Reactive context callback
Field Type placementDecisionsByPlacementIdRecord<string, RevTurbinePlacementDecision>placementsByLookupKeyRecord<string, PlacementOutput | null>entitlementByHandleRecord<string, EntitlementResult>userContextByUserIdRecord<string, UserTargetingContext>trialStatusRevTurbineTrialContext
Field Signature getPlacementDecision(input, placement?, context?) => Promise<RevTurbinePlacementDecision>getPlacement(config) => Promise<PlacementOutput | null>checkEntitlement(handle, context?) => Promise<EntitlementResult>fetchUserContext(userId) => Promise<UserTargetingContext>getTrialStatus() => Promise<RevTurbineTrialContext>resolveExportedConfig() => Promise<Playbook>
Flag Type Default Description enableClientCapsEnforcementbooleanfalseClient-side cap enforcement enableAutoGatedPlacementbooleanfalseAuto-render gated placements enableTrialAutoTriggersbooleanfalseAuto-derive trial lifecycle triggers
Override individual API endpoints for custom_endpoints mode:
Field Default Path decideContext/api/decide-contextbootstrapContext/api/bootstrap-contextdecide/api/decidegetPlacement/api/placementcheckEntitlement/api/entitlementuserContext/api/user-contexttrialStatus/api/trial-statusingestEvents/api/eventstouchpointTransition/api/touchpoint-transitionplacementTypes/api/placement-typessurfaceSlots/api/surface-slots
Interface for custom storage providers:
interface RevTurbineStorage {
getItem ( key : string ) : string | null ;
setItem ( key : string , value : string ) : void ;
removeItem ( key : string ) : void ;
tenantId: string; // ✅ Required
apiKey: string; // ✅ Required (rt_live_* or rt_test_*)
endpoint: string; // ✅ Required
mode: string; // ✅ Required
tenantId: string; // ✅ Required (can be 'demo')
apiKey: string; // ✅ Required (can be 'local')
endpoint: string; // ✅ Required (can be 'http://localhost')
mode: string; // ✅ Required
runtimeMode: ' local_only ' ; // ✅ Required
playbook: Playbook; // ✅ Required
tenantId: string; // ✅ Required
apiKey: string; // ✅ Required
endpoint: string; // ✅ Required
mode: string; // ✅ Required
runtimeMode: ' custom_endpoints ' ; // ✅ Required
endpointOverrides: { // ✅ At least one override required
checkEntitlement ?: string;