REST API & WebSocket Documentation
This document provides complete API reference for integrating with the Robot Fighting Championship platform.
Production:
REST API: https://api.robotfight.io/v1
WebSocket: wss://ws.robotfight.io
Authentication: Most endpoints require an API key or wallet signature.
🔐 Authentication
Admin Endpoints
Admin endpoints require Bearer token authentication:
Authorization: Bearer <ADMIN_TOKEN>
User endpoints require wallet signature verification:
// Generate signature
const message = `robotfight:${timestamp}:${walletAddress}`;
const signature = await wallet.signMessage(message);
// Send in header
Authorization: Signature ${walletAddress}:${timestamp}:${signature}
📡 REST API Endpoints
GET /fights
Get all fights (past and upcoming).
Query Parameters:
status (optional): open, live, closed
limit (optional): Number of results (default: 50)
offset (optional): Pagination offset
Response:
GET /fights/:fight_id
Get specific fight details.
Response:
POST /admin/fight/create
[Admin Only] Create a new fight.
Request Body:
Response:
POST /admin/fight/:fight_id/close
[Admin Only] Close a fight and declare winner.
Request Body:
Response:
GET /bets
Get bet history for authenticated user.
Query Parameters:
status (optional): pending, won, lost
limit (optional): Number of results (default: 50)
Response:
POST /bet/create
Place a new bet.
Request Body:
Response:
GET /bet/:bet_id
Get specific bet details.
Response:
POST /bet/:bet_id/claim
Claim payout for winning bet.
Response:
GET /fighters
Get all fighter profiles.
Response:
GET /fighters/:fighter_name
Get specific fighter details.
Response:
GET /stats/platform
Get platform-wide statistics.
Response:
GET /stats/fighter/:fighter_name
Get detailed fighter statistics.
Response:
🔌 WebSocket API
Client → Server
Subscribe to Fight
Unsubscribe from Fight
Server → Client
Fight Started
Fight State Update (60Hz during live fights)
Hit Event
Fight Ended
Bet Placed (real-time betting updates)
Odds Update
🛠️ SDK & Libraries
Public endpoints: 100 requests/minute per IP
Authenticated endpoints: 1000 requests/minute per user
WebSocket: 1000 messages/minute per connection
Betting: 10 bets/minute per wallet
Invalid request parameters
Missing or invalid authentication
Error Response Format:
Complete Betting Flow
Last updated