Skip to content
DDataNest

Sports · 4 min read

How to use the Cricket Stats API in Python & JavaScript

Sports apps live or die on fresh data. This guide gets cricket stats into your product fast.

By DataNest · Published May 2026

What the Cricket Stats API does

Live scores, player career stats, upcoming schedules, leaderboards, and Dream11-style fantasy point calculation for IPL, T20, and international cricket. Responses are JSON, the API runs behind the RapidAPI gateway for auth and rate limiting, and there's a free tier for prototyping.

When to use it

fantasy sports apps
cricket analytics
live score widgets

The example request

GET https://cricket-stats-by-datanest.p.rapidapi.com/matches/upcoming

Example JSON response

An illustrative response body — run the live demo for the real thing.

{
  "matchId": "ipl-2026-42",
  "status": "live",
  "teams": {
    "home": "MI",
    "away": "CSK"
  },
  "score": {
    "home": "172/4 (18.2)",
    "away": "—"
  },
  "topPlayer": {
    "name": "R. Sharma",
    "runs": 64,
    "strikeRate": 152.3,
    "fantasyPoints": 88
  }
}

Common parameters

Every request also needs your RapidAPI auth headers.

ParameterInRequiredExample
x-rapidapi-keyheaderYesYOUR_RAPIDAPI_KEY
x-rapidapi-hostheaderYescricket-stats-by-datanest.p.rapidapi.com

Step by step

1. Subscribe and get your key

Open the Cricket Stats API on RapidAPI, subscribe to the free BASIC plan, and copy your X-RapidAPI-Key.

2. Call the endpoint

The example call for this API is shown above. The quick-start snippets below send exactly that request in cURL, Python and Node so you get a real response on the first try.

3. Try it without code first

The Cricket Stats page has a live "Try it" panel — change the input, run it, and inspect the real JSON before you integrate.

4. Integrate and cache

Call it from your backend and cache responses where it makes sense. Most responses change slowly, so even a daily cache keeps you well within the free tier.

Quick-start code

curl --request GET \
  --url 'https://cricket-stats-by-datanest.p.rapidapi.com/matches/upcoming' \
  --header 'x-rapidapi-host: cricket-stats-by-datanest.p.rapidapi.com' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY'

What you can build

Fantasy points engine

Update Dream11-style team scores live as wickets and runs happen.

Live score widget

Embed ball-by-ball scores into a sports news feed.

Player analytics

Chart batting and bowling form across a tournament.

Wrapping up

If your project needs fantasy sports apps, the Cricket Stats API removes the part nobody enjoys building. It's one of 23 in the DataNest collection — grab a free key and make your first call.

Cricket Stats updates

New Cricket Stats guides and endpoint updates, occasionally.