Recommended API Path
The SDK has a large surface, but most integrations only need a handful of calls. Reach for these first; everything else is Advanced.
Two questions, two verbs
Section titled “Two questions, two verbs”Almost every monetization decision is one of two questions:
- “Can this user do X?” → check it with
can()(or theuseEntitlementhook). - “Only let them do X if they’re entitled — and show an upsell if not.” → protect it with
gate()(imperative) or<Gate>(declarative React).
And when you just want to render whatever the control plane decides for a spot in your UI, drop in a <Slot>.
What to reach for
Section titled “What to reach for”| You want to… | Use | Kind |
|---|---|---|
| Check access imperatively | rt.can(handle) → EntitlementResult | verb |
| Check access in React | useEntitlement({ handle }) / useCan(handle) | hook |
| Run an action only if entitled | rt.gate(action, fn) → { ran, entitlement } | verb |
| Gate a React subtree + show an upsell | <Gate can="…">…</Gate> | component |
| Render a control-plane placement | <Slot id="…" /> | component |
| Track an event | rt.track(name, data) | verb |
| Report usage | rt.update({ usage }) | verb |
can() vs gate() vs <Gate>
Section titled “can() vs gate() vs <Gate>”They sound alike but do different jobs:
-
can()asks — it returns the answer and does nothing else.const access = await rt.can('data_export');if (!access.allowed) showUpgrade();It returns the rich
EntitlementResult(allowed,status,reason, and — for limit-bearing entitlements —limit/used/remaining).can()is asynchronous by design, so custom resolvers can be injected. -
gate(action, fn)asks and acts — it runsfnonly when the user is entitled, and hands back the entitlement so you can open a paywall otherwise.const gated = await rt.gate('export_pdf', () => exportPdf());if (!gated.ran) openPaywall(gated.entitlement); -
<Gate>is the declarative React version — it renders its children when access is granted and the resolved upsell placement when it isn’t.<Gate id="editor_export" can="data_export"><ExportControls /></Gate>
The vocabulary: Slot · Gate · Playbook
Section titled “The vocabulary: Slot · Gate · Playbook”Three names cover the customer-facing surface:
-
<Slot>— the general placement slot. It renders whatever placement the control plane resolves for a spot (banner, modal, toast, meter, …).<Slot id="pricing_banner" /> -
<Gate>— the entitlement gate (above): render children when entitled, an upsell when not. -
Playbook— the portable monetization config the SDK evaluates against: plans, entitlements, segments, and placements. In local mode you load it (typicallyplaybook.json) at init; in live mode the SDK fetches it.
Each has an older name that stays exported — prefer the canonical one:
| Canonical | Also exported as | What it is |
|---|---|---|
<Slot> | SurfaceSlotComponent, RTSlot | general placement slot component |
<Gate> | AccessGateSurfaceSlot | entitlement-gate component |
Playbook | Playbook, Playbook | the portable monetization config |
Everything else is Advanced
Section titled “Everything else is Advanced”Provider architecture, custom slot types, headless controllers (usePlacement and the imperative controllers), theming internals, and the generated object detail are all still available — they’re just not the first thing you reach for. See the Guides and the API Reference when you need them.
Related
Section titled “Related”- Quickstart — gate one action end to end
- Entitlements — the full entitlement model behind
can()/gate() - Placements — what
<Slot>renders and how decisions resolve