Dev.to WebDev 🛠 Dev 👁 0 📖 4 min read

How to Build a Live Line & Fantasy Cricket App with a Cricket API (India 2026)

India's cricket market is the biggest in the world. During every IPL match, crores of users are checking live scores, building fantasy teams, and actively using live line platforms. If you want to build a live line app o

India's cricket market is the biggest in the world. During every IPL match, crores of users are checking live scores, building fantasy teams, and actively using live line platforms. If you want to build a live line app or a fantasy cricket platform, you need a solid, fast, and reliable cricket API.

This guide covers everything you need to know.

What is a Live Line API?

A live line is a real-time cricket data feed used by odds and prediction platforms. It's not just scores — it includes:

  • Ball-by-ball live updates — score updated after every delivery
  • Session rates — how many runs in the next 5 overs
  • Match odds — who's winning and at what rate
  • Fancy markets — individual player runs, wickets, boundaries
  • Over/Under lines — total runs prediction markets

For live line platforms, latency is the most critical factor. If data arrives 5-10 seconds late, the platform becomes useless. CricLive API is optimized specifically for low-latency delivery.

What Does a Fantasy Cricket API Need?

1. Playing XI (Before Toss)

Fantasy users need to lock their team before the match starts. The earlier you get Playing XI data, the better. CricLive API provides Playing XI 30-60 minutes before the match — as soon as the official announcement is made.

2. Real-Time Fantasy Points

Fantasy points need to update after every ball. CricLive API automatically calculates fantasy points according to standard BCCI/ICC rules — runs, wickets, catches, stumpings, economy rate, strike rate — all included. You don't need to build your own calculation engine.

3. Live Scorecard

Ball-by-ball commentary and live scorecard — runs, wickets, overs, partnerships, fall of wickets — all in real-time.

4. Match Schedule

Upcoming matches — IPL, T20 World Cup, ODI series, Test matches, PSL, BBL — all in one place.

Getting Started

Step 1: Sign up at cricketliveapi.com/register — no credit card required.

Step 2: Copy your API key from the dashboard.

Step 3: Make your first call:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://cricketliveapi.com/api/v1/live-scores

Fetch Live Score — Python

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://cricketliveapi.com/api/v1"

def get_live_scores():
    response = requests.get(
        f"{BASE_URL}/live-scores",
        headers={"Authorization": f"Bearer {API_KEY}"}
    )
    data = response.json()
    for match in data["data"]:
        print(f"{match['teams']} — {match['score']} ({match['overs']} ov)")

get_live_scores()

Fantasy Points — Real-Time Tracking

import requests, time

API_KEY = "your_api_key_here"
MATCH_ID = "ipl-2025-mi-vs-csk-42"

def track_fantasy_points():
    while True:
        r = requests.get(
            f"https://cricketliveapi.com/api/v1/fantasy/points/{MATCH_ID}",
            headers={"Authorization": f"Bearer {API_KEY}"}
        )
        players = sorted(r.json()["players"], key=lambda p: p["fantasy_points"], reverse=True)
        print(f"\n--- Top Fantasy Scorers ---")
        for p in players[:5]:
            print(f"{p['name']:20} {p['fantasy_points']:6.1f} pts")
        time.sleep(5)  # Poll every 5 seconds

track_fantasy_points()

JavaScript — Playing XI Before Match

const API_KEY = 'your_api_key_here';
const MATCH_ID = 'ipl-2025-mi-vs-csk-42';

async function getPlayingXI() {
    const response = await fetch(
        `https://cricketliveapi.com/api/v1/fantasy/playing-xi/${MATCH_ID}`,
        { headers: { Authorization: `Bearer ${API_KEY}` } }
    );
    const data = await response.json();

    console.log('Playing XI:');
    data.teams.forEach(team => {
        console.log(`\n${team.name}:`);
        team.players.forEach(p => {
            console.log(`  ${p.name} (${p.role}) — Credits: ${p.credits}`);
        });
    });
}

getPlayingXI();

Sample API Response with Fantasy Points

{
  "match_id": "IPL-2025-MI-vs-CSK-42",
  "status": "live",
  "batting_team": "Mumbai Indians",
  "score": "156/4",
  "overs": "18.2",
  "current_batsmen": [
    {
      "name": "Rohit Sharma",
      "runs": 72,
      "balls": 48,
      "fours": 8,
      "sixes": 3,
      "fantasy_points": 94
    }
  ],
  "last_ball": "6",
  "required_rate": 11.4,
  "session": {
    "label": "Next 2 overs runs",
    "line": 18.5
  }
}

Available Endpoints

Endpoint Description
GET /live-scores All live matches with scores
GET /match/{id}/scorecard Full scorecard
GET /match/{id}/commentary Ball-by-ball commentary
GET /fantasy/matches Fantasy-ready match list
GET /fantasy/playing-xi/{id} Confirmed Playing XI
GET /fantasy/points/{id} Live fantasy points
GET /fantasy/player-points/{id} Individual player fantasy points
GET /contest/leaderboard/{id} Contest leaderboard

What Can You Build?

  • 🏏 Fantasy Cricket App — Your own Dream11-style platform
  • 📊 Live Line Platform — Real-time odds and session markets
  • 📱 Cricket Score App — Fast, clean score tracker
  • 🤖 Telegram/WhatsApp Bot — Automated score updates for fan groups
  • 📈 Sports Analytics Tool — Deep player and team analysis

Pricing

Plan Calls/Day Price
Free 500 ₹0
Starter 5,000 ₹999/month
Pro 50,000 ₹2,999/month
Enterprise Unlimited Custom

Why CricLive API?

  • ✅ India-First Infrastructure — Low latency, high uptime even during IPL
  • ✅ 500+ Series Coverage — IPL, Ranji, T20 WC, Women's cricket, PSL, BBL
  • ✅ Fantasy Points API — Auto-calculated, Dream11-compatible, ball-by-ball
  • ✅ Simple REST API — Works with Flutter, React Native, Android, Node.js, PHP, Python
  • ✅ INR Pricing — No USD conversion, plans from ₹999/month
  • ✅ Free Tier — 500 calls/day, no credit card, no expiry

Ready to build? Get your free API key at cricketliveapi.com/register — takes 2 minutes.

No credit card. No commitment. Start building your live line or fantasy cricket app today. 🏏

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.