Quick Start Guide
Get up and running with GameLogicHub in under 10 minutes.
Get Your API Keys
Sign up for a GameLogicHub account and generate your API credentials.
Get API Keys →Make Your First Request
Test the API with a simple authentication request.
curl -X POST "https://api.gamelogichub.com/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"username": "your-username",
"password": "your-password"
}'
Start Building
Explore our comprehensive API to build your lottery application.
View API Reference →Example Response
{
"success": true,
"data": {
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 900,
"user": {
"id": 12345,
"username": "admin@gamelogichub.com",
"firstName": "John",
"lastName": "Admin",
"userType": "staff"
}
}
}
Authentication
GameLogicHub uses JWT tokens for secure API authentication across 5 independent systems.
🏢 Staff Authentication
Role-based authentication for internal staff with department and permission management.
👥 Agent Authentication
Specialized authentication for sales agents with hierarchy and territory management.
👤 Player Authentication
Phone-based authentication for players with SMS OTP verification and KYC.
// Staff Login Example
const response = await fetch('https://api.gamelogichub.com/v1/staff/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'admin@gamelogichub.com',
password: 'secure-password'
})
});
const { access_token } = await response.json();
// Use token in subsequent requests
const apiResponse = await fetch('https://api.gamelogichub.com/v1/staff', {
headers: {
'Authorization': `Bearer ${access_token}`
}
});
Staff Management API
Complete CRUD operations for staff management with role-based access control.
List Staff Members
Retrieve paginated list of staff members with filtering options.
Query Parameters
{
"success": true,
"data": {
"staff": [
{
"id": 1,
"username": "admin@gamelogichub.com",
"firstName": "John",
"lastName": "Admin",
"role": "SYSTEM_ADMIN",
"department": "IT",
"status": "ACTIVE",
"lastLogin": "2025-07-30T10:30:00Z"
}
],
"pagination": {
"currentPage": 1,
"totalPages": 5,
"totalRecords": 87,
"limit": 20
}
}
}
Create Staff Member
Create a new staff member with role assignments and department allocation.
{
"username": "newstaff@gamelogichub.com",
"email": "newstaff@gamelogichub.com",
"firstName": "Jane",
"lastName": "Staff",
"password": "SecurePass123!",
"departmentId": 2,
"roleIds": [3, 7],
"permissions": ["USER_READ", "REPORT_VIEW"]
}
Player Management API
Phone-based player authentication and management with KYC verification.
Player Registration
Register new player with phone-based authentication and SMS OTP verification.
{
"first_name": "John",
"last_name": "Player",
"national_id": "GHA123456789",
"phone_number": "+233123456789",
"date_of_birth": "1990-05-15",
"address": "123 Main Street, Accra",
"city": "Accra",
"region": "Greater Accra",
"country": "Ghana",
"password": "SecurePass123!@#",
"marketing_consent": true
}
{
"success": true,
"data": {
"message": "Registration successful. Please verify your phone number with the OTP sent.",
"player": {
"player_id": 12345,
"customer_code": "PLR789ABC",
"username": "PLR56789",
"first_name": "John",
"last_name": "Player",
"account_status": "pending_verification",
"verification_required": true,
"otp_sent": true
}
}
}
Integration Guide
Step-by-step guide to integrate GameLogicHub into your application.
1. Environment Setup
Configure your development environment with the necessary tools and dependencies.
# Install required dependencies
npm install axios dotenv
# Set environment variables
echo "GAMELOGIC_API_URL=https://api.gamelogichub.com/v1" >> .env
echo "GAMELOGIC_API_KEY=your-api-key" >> .env
2. Initialize SDK
Set up the GameLogicHub SDK in your application.
import GameLogicHub from '@gamelogichub/sdk';
const client = new GameLogicHub({
apiUrl: process.env.GAMELOGIC_API_URL,
apiKey: process.env.GAMELOGIC_API_KEY,
timeout: 10000
});
// Test connection
async function testConnection() {
try {
const response = await client.auth.test();
console.log('Connected to GameLogicHub:', response.success);
} catch (error) {
console.error('Connection failed:', error.message);
}
}
Error Handling
Learn how to handle errors and implement proper error recovery in your application.
Common Error Codes
// Error handling example
async function handleApiCall() {
try {
const response = await client.staff.list();
return response.data;
} catch (error) {
switch (error.status) {
case 401:
// Handle authentication error
await refreshToken();
return handleApiCall(); // Retry
case 429:
// Handle rate limiting
await delay(error.retryAfter * 1000);
return handleApiCall(); // Retry
case 500:
// Handle server error
console.error('Server error:', error.message);
throw new Error('Service temporarily unavailable');
default:
console.error('API error:', error);
throw error;
}
}
}