For Engineers
Developer Documentation
Everything you need to integrate crash games into your platform. RESTful API, WebSocket feeds, and a TypeScript SDK.
API Overview
POST/betsPOST/cashoutGET/rounds/:gameIdGET/verifyGET/gamesAll endpoints require an x-api-key header with your operator API key.
SDK Usage
Install with npm install @ace/sdk
sdk-example.ts
import { AceSDK } from '@ace/sdk';
// Initialize with your operator API key
const ace = new AceSDK({
apiKey: 'ak_your_operator_key',
baseUrl: 'https://api.afrigaming.africa',
});
// Place a bet
const bet = await ace.placeBet({
userId: 'player_123',
roundId: 'rnd_abc',
amount: 500, // 500 NGN
autoCashout: 2.5, // Auto cash out at 2.5x
});
// Cash out
const result = await ace.cashout({
betId: bet.id,
});
console.log(result.payout); // 1250 NGNReal-Time WebSocket
Subscribe to live game events for real-time multiplier updates.
websocket-example.ts
// Connect to real-time game feed
const ws = new WebSocket(
'wss://api.afrigaming.africa/ws?gameId=danfo-rush'
);
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
switch (data.event) {
case 'tick':
// Live multiplier update (every 100ms)
updateDisplay(data.multiplier);
break;
case 'crash':
// Round ended — show crash point
showCrash(data.crashPoint);
break;
case 'round_start':
// New round — betting is open
enableBetting();
break;
}
};