> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fieldfunded.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build an Esports Odds App with Live CS2 and LoL Data

> Build a real-time esports odds app covering CS2, Dota 2, LoL, and Valorant. Live markets, map odds, and automatic settlement via API.

# Build a Live Esports Odds App with Real-Time Market Data

Get live odds for CS2, League of Legends, Dota 2, Valorant, and 4 more esports titles — all from a single API. This guide shows you how to build a real-time esports odds dashboard with map-level markets, live scores, and automatic settlement.

## Why Esports API Data Is Hard to Find

Most sports data APIs treat esports as an afterthought — limited coverage, delayed odds, and zero settlement support. FieldFunded covers **8 esports titles** with the same depth as traditional sports: 1,000+ markets per event, sub-second latency, and full automatic settlement including map winner, total maps, handicap, and player-specific props.

## Supported Esports Titles

| Title                | Key                 | Markets                                                            | Example Leagues                    |
| -------------------- | ------------------- | ------------------------------------------------------------------ | ---------------------------------- |
| Counter-Strike (CS2) | `counter-strike`    | Match Winner, Map Winner, Map Handicap, Total Maps, Round Handicap | ESL Pro League, BLAST, IEM, Majors |
| Dota 2               | `dota-2`            | Match Winner, Map Winner, Total Maps, First Blood, Handicap        | The International, DPC, ESL One    |
| League of Legends    | `league-of-legends` | Match Winner, Map Winner, Total Maps, First Tower, Handicap        | Worlds, LCK, LEC, LCS, MSI         |
| Valorant             | `valorant`          | Match Winner, Map Winner, Total Maps, Map Handicap                 | VCT, Champions, Masters            |
| Rainbow Six          | `rainbow-six`       | Match Winner, Map Winner, Total Maps                               | Six Invitational, Pro League       |
| King of Glory        | `king-of-glory`     | Match Winner, Map Winner                                           | KPL                                |
| Call of Duty         | `call-of-duty`      | Match Winner, Map Winner, Total Maps                               | CDL Major, Champs                  |
| Mobile Legends       | `mobile-legends`    | Match Winner, Map Winner                                           | MPL, M-Series                      |

## What You'll Use

| SDK Method       | Endpoint                   | Purpose                       |
| ---------------- | -------------------------- | ----------------------------- |
| `getEvents()`    | `GET /v1/events`           | List upcoming esports matches |
| `getLive()`      | `GET /v1/live`             | Get live esports events       |
| `getEventOdds()` | `GET /v1/events/{id}/odds` | Get odds with all markets     |
| `getScores()`    | `GET /v1/scores`           | Live scores and map scores    |
| `checkBets()`    | `POST /v1/bets/check`      | Settle bets automatically     |

## Step 1: Fetch Live Esports Events

Filter by sport key to get only esports events:

```typescript theme={null}
import { FieldFundedSDK } from '@fieldfunded/sdk';

const ff = new FieldFundedSDK({
  apiKey: process.env.FIELDFUNDED_API_KEY!,
  baseUrl: 'https://api.fieldfunded.com/v1',
});

// Get all live CS2 matches
const cs2Live = await ff.getLive({ sport: 'counter-strike' });

// Get all live LoL matches
const lolLive = await ff.getLive({ sport: 'league-of-legends' });

// Get all live esports (all titles at once)
const allEsports = await ff.getLive();
const esportsSlugs = [
  'counter-strike', 'dota-2', 'league-of-legends', 'valorant',
  'rainbow-six', 'king-of-glory', 'call-of-duty', 'mobile-legends'
];
const esportsOnly = allEsports.events?.filter(
  (e: any) => esportsSlugs.includes(e.sport_key)
) || [];

console.log(`${esportsOnly.length} live esports matches right now`);
```

## Step 2: Get Deep Market Odds

Esports events support the same market depth as traditional sports. A typical CS2 match includes Match Winner, Map Winner (per map), Map Handicap, Total Maps Over/Under, and more:

```typescript theme={null}
// Get all odds for a CS2 match
const odds = await ff.getEventOdds(eventId);

// Filter by market type
const mapMarkets = odds.markets?.filter(
  (m: any) => m.name.toLowerCase().includes('map')
) || [];

const matchWinner = odds.markets?.find(
  (m: any) => m.name === 'Winner' || m.name === 'Match Winner'
);

// Display
if (matchWinner) {
  console.log('Match Winner:');
  for (const sel of matchWinner.selections) {
    console.log(`  ${sel.name}: ${sel.odds}`);
  }
}

console.log(`\n${mapMarkets.length} map-level markets available`);
for (const market of mapMarkets.slice(0, 5)) {
  console.log(`  ${market.name}:`);
  for (const sel of market.selections) {
    console.log(`    ${sel.name}: ${sel.odds}`);
  }
}
```

## Step 3: Live Scores with Map Tracking

Esports scores include per-map breakdowns:

```typescript theme={null}
// Poll scores every 30 seconds
const scores = await ff.getScores({ sport: 'counter-strike' });

for (const match of scores.scores || []) {
  console.log(`${match.home_team} vs ${match.away_team}`);
  console.log(`  Score: ${match.score.home} - ${match.score.away} (maps)`);

  // Period scores contain per-map round scores
  if (match.score.period_scores) {
    for (const period of match.score.period_scores) {
      console.log(`  Map ${period.period}: ${period.home} - ${period.away}`);
    }
  }
}
```

## Step 4: Settle Esports Bets Automatically

Settlement works identically for esports and traditional sports — markets resolve within seconds after a match ends:

```typescript theme={null}
// Check if a bet on "Natus Vincere to win Map 1" settled
const result = await ff.checkBets({
  event_id: eventId,
  market: 'Map 1 Winner',
  selection: 'Natus Vincere',
  stake: 25,
  odds: 1.85,
});

console.log(`Status: ${result.status}`);      // "won" | "lost" | "refund"
console.log(`Payout: $${result.payout}`);      // 46.25 if won
console.log(`Profit: $${result.profit}`);      // 21.25 if won
```

For multi-map parlays, use the [parlay resolution endpoint](/api-reference/settlement/check-parlay):

```typescript theme={null}
// Parlay: NAVI wins Map 1 + Over 2.5 maps
const parlay = await ff.checkParlay({
  legs: [
    { event_id: eventId, market: 'Map 1 Winner', selection: 'Natus Vincere', odds: 1.85 },
    { event_id: eventId, market: 'Total Maps', selection: 'Over 2.5', odds: 2.10 },
  ],
  stake: 10,
});

console.log(`Combined odds: ${parlay.combined_odds}`);
console.log(`Payout: $${parlay.payout}`);
```

## Rate Limit Math

On the free tier (10,000 req/month, 2 req/s):

* Polling live esports events every 30s = **2,880 req/day** (1 sport)
* Polling 3 esports titles every 60s = **4,320 req/day**
* On-demand odds checks = \~1-2 req per user action

For a dashboard tracking CS2 + LoL + Valorant with 60s polling: **\~4,300 req/day = \~130,000 req/month** → [Starter plan](/compare/pricing) (\$29/mo) covers this comfortably.

## Architecture for Production

```mermaid theme={null}
graph LR
    A["Frontend<br/>(React/Vue)"] <-->|requests/responses| B["Your Server<br/>(Node.js)"]
    B <-->|API calls| C["FieldFunded<br/>API"]
    B --> D["Cache Layer<br/>(Redis/mem)"]
```

Cache odds for 5-10 seconds to reduce API calls. Live scores can be cached for 15-30 seconds since round scores don't change sub-second.

<CardGroup cols={2}>
  <Card title="Supported Sports List" icon="gamepad" href="/reference/supported-sports">
    Full list of all 30+ sports and esports with sport keys →
  </Card>

  <Card title="Market Types Reference" icon="chart-mixed" href="/reference/market-types">
    All market types including esports-specific markets →
  </Card>
</CardGroup>

***

## Related Guides

* [Build a Twitch Overlay](/guides/build-twitch-overlay) — display esports odds live on stream with OBS
* [Build a Discord Bot](/guides/build-discord-bot) — serve odds in your gaming community
* [Build a Settlement Engine](/guides/build-settlement-engine) — production-grade bet resolution
* [FieldFunded vs Sportradar](/compare/vs-sportradar) — see how esports coverage compares

<Card title="Get Your Free API Key" icon="key" href="/quickstart">
  Start building in 5 minutes — 10,000 free requests/month, all esports titles included
</Card>
