Quick Start
Prerequisites
Section titled “Prerequisites”- A GamifyHost partner account
- An App created in the dashboard
- Your API keys (public key + secret key)
Step 1: Award Points (Server-Side)
Section titled “Step 1: Award Points (Server-Side)”From your backend, call the Award Points endpoint whenever a user performs a rewardable action.
curl -X POST https://api.gamifyhost.com/v1/points/award \ -H "X-API-Secret: sk_test_your_secret_key" \ -H "Content-Type: application/json" \ -d '{ "userId": "user_12345", "eventType": "signup", "displayName": "Alice", "email": "alice@example.com" }'The user is created automatically if they don’t exist. Points are awarded based on the reward rule configured for the signup event type in your dashboard.
Step 2: Embed the Widget (Client-Side)
Section titled “Step 2: Embed the Widget (Client-Side)”Add the game widget to your frontend so users can spend their points:
<div id="gamifyhost" style="width:100%;height:80vh;"></div><script src="https://cdn.gamifyhost.com/widget.js" data-public-key="pk_test_your_public_key" data-user-id="user_12345" data-api-url="https://api.gamifyhost.com" data-initial-balance="5000"></script>Or use the Flutter SDK:
import 'package:gamifyhost_games/gamifyhost_games.dart';
GamifyHostWidget( config: const GamifyHostConfig( publicKey: 'pk_test_your_public_key', userId: 'user_12345', initialBalance: 5000, ),)Step 3: Users Play Games
Section titled “Step 3: Users Play Games”Users see a game listing, pick a game, and spend points to play. The server determines the outcome and returns the reward.
Step 4: Check the Leaderboard
Section titled “Step 4: Check the Leaderboard”The widget includes a built-in leaderboard. You can also query it directly:
curl https://api.gamifyhost.com/v1/leaderboard?page=1&limit=10 \ -H "X-API-Key: pk_test_your_public_key"What’s Next
Section titled “What’s Next”- Authentication — Understand the two key types
- Game Play API Reference — All client-side endpoints
- Game API Reference — All server-side endpoints
- JavaScript Widget — Full widget docs
- Flutter SDK — Mobile SDK docs