Skip to main content

Casino System Integration

The Casino Integration APIs provide external access for casino operators to integrate tournament functionality into their platforms. These are the primary APIs used for tournament management, player registration, results access, and event handling.

Overview

Casino System Integration focuses on external APIs that enable casino operators to:
  • Create and manage tournaments
  • Register and manage players
  • Access real-time leaderboards and results
  • Receive webhook notifications for tournament events
  • Handle player transactions (buy-ins, rebuys, refunds)
Integration Pattern: Casino System ↔ Tournament System via external APIs with operator authentication and role-based permissions.

API Categories

Authentication Model

All Casino Integration APIs use operator API keys with role-based permissions:
GET /api/tournaments
Authorization: Bearer {your-operator-api-key}

Permission Structure

  • tournaments.read - View tournaments and status
  • tournaments.write - Create and update tournaments
  • tournaments.delete - Cancel tournaments
  • players.read - View player data and registrations
  • players.write - Register and manage players
  • results.read - Access results and leaderboard data

Common Integration Patterns

1. Tournament Lifecycle Management

1

Create Tournament

Casino System creates tournament via POST /api/tournaments
2

Player Registration

Players register through POST /api/tournaments/{id}/players
3

Tournament Monitoring

Monitor status via GET /api/tournaments/{id}/status
4

Results Access

Retrieve results via GET /api/tournaments/{id}/results

2. Real-time Event Handling

HTTP Webhooks for real-time notifications:
  • Tournament started/completed events
  • Player registration/elimination notifications
  • Results and prize distribution updates
  • System status changes and alerts

API Endpoints Overview

Tournament Management

POST /api/tournaments                    # Create tournament
GET /api/tournaments                     # List tournaments  
GET /api/tournaments/{id}                # Get tournament details
PUT /api/tournaments/{id}                # Update tournament
DELETE /api/tournaments/{id}             # Cancel tournament
GET /api/tournaments/{id}/status         # Get tournament status

Player Management

POST /api/tournaments/{id}/players       # Register player
GET /api/tournaments/{id}/players        # List tournament players
DELETE /api/tournaments/{id}/players/{player}  # Remove player
POST /api/tournaments/{id}/players/{player}/rebuy  # Process rebuy

Results & Leaderboards

GET /api/tournaments/{id}/leaderboard    # Real-time rankings
GET /api/tournaments/{id}/results        # Final results
GET /api/tournaments/{id}/prize-pool     # Prize pool calculation
GET /api/tournaments/{id}/events         # Tournament event history

Data Flow Architecture

Communication Patterns

  • Casino → Tournament: External APIs with operator authentication
  • Tournament → Casino: SQS events and HTTP webhooks
  • UI Integration: postMessage events between game and casino interfaces
  • Real-time Updates: WebSocket connections for live leaderboards

Error Handling & Best Practices

HTTP Status Codes

  • 200 OK - Successful operation
  • 201 Created - Resource created successfully
  • 400 Bad Request - Invalid request parameters
  • 401 Unauthorized - Invalid or missing API key
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Tournament or resource not found
  • 409 Conflict - Resource conflict (duplicate registration)
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error

Rate Limiting

  • Standard Operations: 100 requests per minute per API key
  • Tournament Creation: 10 requests per minute per API key
  • Player Registration: 200 requests per minute per API key
  • Results Access: 500 requests per minute per API key

Retry Logic

Implement exponential backoff for failed requests with maximum retry limits to prevent overwhelming the system.
const retryDelay = Math.min(1000 * Math.pow(2, retryCount), 30000);
setTimeout(() => retryRequest(), retryDelay);

Integration Examples

Basic Tournament Creation

const response = await fetch('/api/tournaments', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Daily Championship',
    startTime: '2024-01-15T20:00:00Z',
    gameSlug: 'crash-classic', 
    maxPlayers: 100,
    entryFee: 10.00
  })
});

const tournament = await response.json();
console.log(`Tournament created: ${tournament.tournamentId}`);

Player Registration

const registration = await fetch(`/api/tournaments/${tournamentId}/players`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    userId: 'player_123',
    displayName: 'PlayerName',
    buyInAmount: 10.00
  })
});

const result = await registration.json();
// Player receives JWT token and game URL for tournament access

Multi-Tenant Architecture

All APIs are scoped to your operator account. You can only access tournaments and players within your operator tenant.

Operator Isolation

  • Data Scoping: All data automatically filtered by operator ID
  • API Key Scoping: Keys only access data within operator boundaries
  • Resource Isolation: No cross-operator data access or interference
  • Independent Configuration: Webhook URLs, settings, and preferences per operator

Next Steps