📚 Developer Resources

Comprehensive Developer Documentation

Everything you need to integrate and build with GameLogicHub. From quick start guides to detailed API references.

794+
API Endpoints
5
Auth Systems
100%
OpenAPI Compatible

Quick Start Guide

Get up and running with GameLogicHub in under 10 minutes.

1

Get Your API Keys

Sign up for a GameLogicHub account and generate your API credentials.

Get API Keys →
2

Make Your First Request

Test the API with a simple authentication request.

bash
curl -X POST "https://api.gamelogichub.com/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "your-username",
    "password": "your-password"
  }'
3

Start Building

Explore our comprehensive API to build your lottery application.

View API Reference →

Example Response

json
{
  "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.

POST /api/staff/auth/login

👥 Agent Authentication

Specialized authentication for sales agents with hierarchy and territory management.

POST /api/agents/auth/login

👤 Player Authentication

Phone-based authentication for players with SMS OTP verification and KYC.

POST /api/players/auth/login
javascript
// 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.

GET /api/staff

List Staff Members

Retrieve paginated list of staff members with filtering options.

Query Parameters
page integer Page number (default: 1)
limit integer Items per page (default: 20, max: 100)
department string Filter by department
role string Filter by role
json 200 OK
{
  "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
    }
  }
}
POST /api/staff

Create Staff Member

Create a new staff member with role assignments and department allocation.

json Request Body
{
  "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.

POST /api/players/auth/register

Player Registration

Register new player with phone-based authentication and SMS OTP verification.

json Request Body
{
  "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
}
json 201 Created
{
  "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.

bash
# 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.

javascript
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

400 Bad Request Invalid request parameters or malformed JSON
401 Unauthorized Invalid or missing authentication credentials
403 Forbidden Insufficient permissions for requested operation
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server encountered an unexpected condition
javascript
// 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;
    }
  }
}