Getting started with gamification
Three integration paths, one decision. Pick the one that matches the surface you are integrating into. Most production stacks combine the SDK and the REST API; the iframe path is the fast lane for marketing-led campaigns. This page covers the decision and ships a working quickstart for all three.
Key takeaways
Quick read- Headless SDK is the default for React and Next.js. Hooks render points, tier, badges, streaks, challenges, leaderboards, and rewards in your own UI.
- REST API is the default for everything else: native mobile, server-to-server, partner platforms, non-React frontends (Vue, Svelte, server-rendered).
- iframe a Bricqs-hosted engagement page when speed beats UI control — marketing-led campaigns, microsites, partner placements.
- Switching paths does not lose data. Participant ledger, points, badges, streaks, and challenge progress are stored once and visible to every surface.
The decision
Which path is right
| Path | Best for | UI control |
|---|---|---|
| Headless SDK | React or Next.js apps where you own the UI. Onboarding flows, in-app challenges, member dashboards. | Full |
| REST API | Native mobile (iOS, Android), server-to-server scoring, partner platforms, non-React web (Vue, Svelte, server-rendered). | Full |
| iframe page | Marketing-led campaigns, microsites, partner placements where Bricqs renders the engagement page. | Pre-built |
Headless SDK
Quickstart for React
Three steps from zero to a working points display.
npm install @bricqs/headless-react"use client";
import { BricqsProvider } from "@bricqs/headless-react";
export function Providers({ children }: { children: React.ReactNode }) {
return (
<BricqsProvider
tenantId={process.env.NEXT_PUBLIC_BRICQS_TENANT!}
participantToken={getParticipantTokenFromCookie()}
env="production"
>
{children}
</BricqsProvider>
);
}"use client";
import { usePoints } from "@bricqs/headless-react";
export function PointsBadge() {
const { available, lifetime, isLoading } = usePoints();
if (isLoading) return <span>Loading...</span>;
return (
<span className="inline-flex items-center gap-2">
<strong>{available.toLocaleString()}</strong> pts
<small>(lifetime {lifetime.toLocaleString()})</small>
</span>
);
}REST API
Quickstart for any backend
Two steps: send an event, read state.
curl -X POST https://api.bricqs.co/api/v1/ingest/events \
-H "Authorization: Bearer bq_live_..." \
-H "Content-Type: application/json" \
-d '{
"participant_id": "p_8a3f",
"event_type": "purchase_completed",
"attributes": { "amount": 1250, "currency": "INR" },
"idempotency_key": "p_8a3f:order_4271"
}'curl https://api.bricqs.co/api/v1/gamify/state/p_8a3f \
-H "Authorization: Bearer bq_live_..."
# response
{
"participant_id": "p_8a3f",
"points": { "available": 1250, "lifetime": 4820 },
"tier": { "id": "silver", "label": "Silver" },
"streaks": [...],
"active_challenges": [...]
}iframe page
Quickstart for iframing a Bricqs-hosted engagement
When the marketing team wants to ship a campaign page without engineering, embed a Bricqs-hosted engagement (quiz, spin, scratch, challenge surface) via iframe. You pass the participant id; Bricqs handles UI, event submission, and reward delivery.
<iframe
src="https://run.bricqs.co/e/your-engagement-slug?participant=p_8a3f"
width="100%"
height="640"
frameborder="0"
allow="clipboard-write"
></iframe>The engagement is configured in the Bricqs dashboard. Participation, points, and rewards still hit the same ledger as the SDK and REST paths — so a user who completes the iframe campaign on Monday and logs into your app on Tuesday sees the points they earned.
Where to go next
Pick the next page based on your path
Provider, auth, environments for the React SDK.
useChallenge, objective progress, completion handoff.
Live and test keys, scopes, rotation, rate limits.
POST events with idempotency, batch, retries.
Mental model: tenants, events, facts, programs.
Endpoint-level documentation.
Developer FAQ
Common questions when integrating gamification with Bricqs.
Ready to ship?
Wire it up with the Bricqs SDK or API
Headless SDK for React UIs, REST API for any backend. Same engine behind both.
