Integration Docs
Everything you need to embed Solex games into your casino platform — Prediction Markets and TraderHero.
Interactive REST API reference.
Live Prediction Markets demo.
Live TraderHero jackpot demo.
API Endpoints
Prediction Markets
Cash-Out
Risk Management
TraderHero Jackpot
Casino Admin
IGSP Provider API
User Data (Public)
Transaction Ledger
All financial activity is tracked in the transaction ledger. Each transaction has a unique ID and links back to the originating bet or jackpot round.
| Type | Direction | Game | When |
|---|---|---|---|
| bet_placed | Debit | Prediction Markets | Player places a market bet |
| payout | Credit | Prediction Markets | Market resolves in player's favor |
| bet_refund | Credit | Prediction Markets | Market cancelled, bet returned |
| cash_out | Credit | Prediction Markets | Player cashes out (full or partial) |
| fee_collection | Debit | Prediction Markets | Casino/platform fees collected |
| void_refund | Credit | Prediction Markets | Market voided, all bets refunded |
| jackpot_bet | Debit | TraderHero | Player enters a jackpot round |
| jackpot_payout | Credit | TraderHero | Player wins a jackpot round |
Query the ledger via GET /api/v1/casino/admin/reports/transactions with your API key. Both game types appear in the same ledger.
Cash-Out
Players can exit positions early via full or partial cash-out. Supports all pricing models (LMSR sells shares back, bookmaker models use fair-value calculation with configurable margin). Rate limited to 10 cash-outs per user per 24 hours.
Preview Cash-Out
Returns the current cash-out value without executing. Use this to show the player what they would receive.
{
"betId": "uuid", // Required — bet to preview
"percent": 100 // Optional (1-100) — partial cash-out %
}{
"cashOutValue": 45.20, // Amount player would receive
"margin": 5.0, // Cash-out margin applied (%)
"originalStake": 50.00,
"currentOdds": { "yesPrice": 0.65, "noPrice": 0.35 }
}Execute Cash-Out
Executes the cash-out: credits the player wallet, updates bet status, and adjusts market liability. For partial cash-outs, the bet remains active with reduced shares.
{
"betId": "uuid", // Required — bet to cash out
"percent": 50 // Optional (1-100) — 50 = exit half the position
}Wallet credit retries up to 3 times with idempotent transaction ID (cashout_{betId}). Full rollback if all retries fail.
Auto Cash-Out Triggers
Set automatic take-profit or stop-loss triggers. Evaluated on every oracle price update. When the cash-out value crosses the target, the system executes automatically.
{
"betId": "uuid",
"triggerType": "take_profit", // "take_profit" or "stop_loss"
"targetValue": 75.00 // Cash-out when value reaches this amount
}Partner Configuration
| Field | Type | Description |
|---|---|---|
| cash_out_enabled | boolean | Enable/disable cash-out for this partner (default: true) |
| cash_out_margin_percent | number | Margin applied to cash-out value (default: 5%) |
| cash_out_fee_percent | number | Fee deducted from cash-out amount (default: 0%) |
Risk Management & Safety
Built-in safety controls protect against financial loss. All checks run inside the same database transaction as the bet placement (race-condition safe).
Risk Dashboard
{
"activeMarkets": 12,
"totalVolume": 45000.00,
"totalFeesCollected": 675.00,
"totalOutstandingLiability": 12500.00,
"exposureByModel": { "lmsr": 3200, "oracle_bookmaker": 9300 },
"highRiskMarkets": [...], // Markets at >80% exposure utilization
"correlationGroups": [...], // Grouped market exposure
"recentCashOuts": { "count": 8, "totalAmount": 1200.00 }
}Cached for 10 seconds to avoid heavy aggregate queries.
Emergency Kill Switch
Instantly suspend all betting across all markets. Resume respects per-market suspension reasons (circuit breaker trips are not auto-resumed).
Oracle Circuit Breaker
Auto-suspends oracle bookmaker markets when a price update deviates more than 10% from the previous price. Requires manual admin reset after investigation.
Void Market
Cancel a market with a reason and refund all confirmed bets. Used for disputed outcomes, cancelled events, or erroneous market creation.
{
"reason": "Event cancelled due to weather" // Required, max 1000 chars
}Safety Checks (automatic)
These checks run automatically on every bet placement. No additional API calls needed — configure via partner settings.
| Check | Config | Behavior |
|---|---|---|
| Max payout cap | max_payout_amount | Rejects bet if potential payout exceeds limit |
| Per-user-per-market limit | max_bet_per_user_per_market | Rejects if cumulative user bets on market exceed limit |
| Market exposure limit | maxExposure (pricing_params) | Rejects if market total liability exceeds limit |
| Correlated exposure | max_correlation_group_exposure | Rejects if aggregate exposure across correlated markets exceeds limit |
| Live oracle verification | Automatic (oracle_bookmaker) | Fetches live Polymarket price, rejects if >5% deviation from cached |
| Large bet delay | large_bet_threshold + large_bet_delay_ms | Delays large bets 0-5000ms, re-verifies market state and exposure after wait |
| Betting close window | betting_close_hours_before_resolution | Blocks bets N hours before scheduled resolution |
| Minimum margins | Automatic | Overround >= 5% (bookmaker), pool cut >= 5% (parimutuel) |
Bettor Classification
Tracks closing-line value (CLV) per bettor to classify as recreational, sharp, or restricted. When auto_enforce_sharp_limits is enabled, sharp bettors automatically get reduced per-user limits. Otherwise classification is informational only.
Prometheus Metrics
Exposed at GET /metrics. Includes counters for safety-check rejections (by type), cash-outs executed, circuit breaker trips, kill switch activations, and per-market exposure utilization gauges.