Data Feed API
Decentralized sports game scores for betting apps, oracles, TV feeds, and stat platforms.
Rate limiting
60 requests per minute per IP. Returns 429 with retryAfter when exceeded.
Endpoints
GET /api/feed/games
Returns games (default: finalized only). Use for settlement, stats, and bulk queries.
Query parameters
| Param | Type | Default | Description |
finalized | string | true | true | false | all |
sport | string | - | Filter by sport type (1, 2, …) |
team | string | - | Filter by team name (partial) |
startDate | number | - | Unix timestamp (inclusive) |
endDate | number | - | Unix timestamp (inclusive) |
limit | number | 50 | Max 200 |
offset | number | 0 | Pagination offset |
Example
GET /api/feed/games?finalized=true&sport=2&limit=20
Response
{
"success": true,
"data": [
{
"gameId": "0x...",
"homeTeam": "Lakers",
"awayTeam": "Celtics",
"sportType": "2",
"gameDate": "1738540800",
"finalized": true,
"reporterCount": "5",
"homeScore": 98,
"awayScore": 95,
"verification": {
"blockNumber": "12345678",
"tokenContract": "0x...",
"source": "consensus"
}
}
],
"meta": { "total": 42, "limit": 20, "offset": 0, "blockNumber": "12345678" }
}
GET /api/feed/game/:gameId
Single game by ID. Use bytes32 hex or a string (hashed with keccak256).
Example
GET /api/feed/game/Lakers-Celtics-2024-02-01
GET /api/feed/teams
List all teams. Optional ?sport=1 filter.
GET /api/feed/info
Metadata and contract addresses for on-chain verification.
Live feed (reporter network)
For non-finalized games, the API may return a live score when reporters have pushed updates during the game (no gas). Use GET /api/feed/games?finalized=false or GET /api/feed/game/:gameId. When live data is present: verification.source is "live_feed" and the response includes liveFeed (lastUpdatedBy, updatedAt, updateCount). Reporters (on-chain role) push updates via POST /api/live/update with a signed message; see Data Feed API doc for body format.
On-chain verification
For trustless verification, call queryGameResult(gameId) on the SportsDataToken
contract with QUERY_FEE (≈0.00005 ETH). Returns
(homeTeamId, awayTeamId, homeScore, awayScore, finalized).
The verification.blockNumber in API responses is the block at which data was read;
you can verify contract state at that block.
Integration example
// Fetch finalized games
const res = await fetch('/api/feed/games?finalized=true&limit=50');
const { data: games } = await res.json();
// Resolve a bet
const game = games.find(g => g.gameId === betGameId);
if (game?.finalized) {
const winner = game.homeScore > game.awayScore ? 'home' : 'away';
// settle bet...
}