Cricket API developer documentation

Cricket API Documentation

Learn how to authenticate, request fixtures, retrieve live cricket scores, process ball-by-ball events, access statistics, odds and predictions, connect to WebSocket streams and handle errors safely.

REST API WebSocket Structured JSON
Quick Start REST JSON
GET /v1/cricket/matches/live

Authorization:
Bearer YOUR_API_KEY

Accept:
application/json
Access Live Data Fixtures, scores and match events
Build With One API Statistics, odds and predictions
Implementation notice: The base URL, endpoint paths, authentication header, field names, quotas and example responses on this page are documentation placeholders until the final Cricket API specification is supplied. Replace them with the confirmed production values before launch.

Documentation Contents

Quick Start

Make your first authenticated Cricket API request.

Authentication

Protect and send your API credential correctly.

Fixtures

Retrieve upcoming and historical cricket matches.

Live Scores

Load current innings, scores and match status.

Ball-by-Ball

Process delivery-level cricket match events.

Statistics

Access player, team and match performance data.

Odds

Retrieve supported bookmakers, markets and prices.

Predictions

Use supported probability and forecast outputs.

WebSocket

Subscribe to live cricket events where available.

Rate Limits

Manage quotas, caching and retry behaviour.

Errors

Handle validation, authentication and server errors.

Best Practices

Build secure and reliable production integrations.

Quick start

Make Your First Cricket API Request

A typical integration sends an authenticated HTTP request to the API and receives a structured JSON response. Keep private API credentials on your server whenever possible.

Example Base URL

https://api.example.com/v1

Replace the example host with the confirmed production API base URL.

Example Request

GET https://api.example.com/v1/cricket/matches/live

Authorization: Bearer YOUR_API_KEY
Accept: application/json

Example Response

{
  "data": [
    {
      "match_id": "match_84219",
      "status": "live",
      "format": "T20",
      "competition": {
        "id": "competition_91",
        "name": "Example T20 League"
      },
      "teams": {
        "home": {
          "id": "team_18",
          "name": "Team A"
        },
        "away": {
          "id": "team_29",
          "name": "Team B"
        }
      },
      "current_innings": {
        "number": 2,
        "runs": 148,
        "wickets": 4,
        "overs": "16.2",
        "target": 181
      },
      "updated_at": "2026-08-04T09:30:00Z"
    }
  ]
}
Authentication

Authenticate Cricket API Requests

Every protected request must include a valid API credential using the authentication method confirmed by the provider.

Illustrative Bearer Authentication

Authorization: Bearer YOUR_API_KEY

Credential Security

  • Store production credentials in server environment variables
  • Do not paste private keys into WordPress page content
  • Do not expose private keys in browser JavaScript
  • Do not commit credentials to public source repositories
  • Rotate any key that may have been exposed
  • Use IP, domain or application restrictions when supported

Authentication Errors

Status Meaning Recommended action
401 Missing, invalid or expired credential Verify the key and authentication format
403 Credential does not have access to the resource Check plan, permissions and competition coverage
Fixtures

Retrieve Cricket Fixtures and Match Schedules

The fixtures endpoint can support upcoming matches, calendars, competition pages and historical match searches.

Illustrative Endpoint

GET /v1/cricket/matches

Example Query Parameters

Parameter Example Purpose
competition_id competition_91 Filter by competition
season 2026 Filter by season
status scheduled Filter by match status
date_from 2026-08-01 Start of date range
date_to 2026-08-31 End of date range
page 1 Pagination page

Example Request

GET /v1/cricket/matches?competition_id=competition_91&season=2026&status=scheduled

Common Match Status Values

  • scheduled
  • delayed
  • live
  • innings_break
  • interrupted
  • completed
  • abandoned
  • cancelled
Live scores

Retrieve Live Cricket Scores

All Live Matches

GET /v1/cricket/matches/live

One Match

GET /v1/cricket/matches/{match_id}

Example Match Response

{
  "data": {
    "match_id": "match_84219",
    "status": "live",
    "format": "T20",
    "innings": {
      "number": 2,
      "batting_team_id": "team_18",
      "runs": 148,
      "wickets": 4,
      "overs": "16.2",
      "target": 181,
      "current_run_rate": 9.06,
      "required_run_rate": 8.68
    },
    "current_players": {
      "striker_id": "player_301",
      "non_striker_id": "player_447",
      "bowler_id": "player_112"
    },
    "updated_at": "2026-08-04T09:30:00Z"
  }
}

Integration Guidance

  • Use the match identifier as the stable primary reference
  • Preserve the official match status
  • Show the last-updated time in live interfaces
  • Do not treat cricket overs as decimal values
  • Stop frequent polling after a match is completed
  • Use a shared server-side cache for multiple users
Ball-by-ball

Retrieve Ball-by-Ball Cricket Events

Illustrative Endpoint

GET /v1/cricket/matches/{match_id}/events

Example Event Response

{
  "data": [
    {
      "event_id": "event_991827",
      "match_id": "match_84219",
      "innings": 2,
      "over": 16,
      "ball": 2,
      "type": "boundary",
      "runs": {
        "batter": 4,
        "extras": 0,
        "total": 4
      },
      "striker_id": "player_301",
      "non_striker_id": "player_447",
      "bowler_id": "player_112",
      "score_after_event": {
        "runs": 148,
        "wickets": 4
      },
      "created_at": "2026-08-04T09:30:00Z"
    }
  ]
}

Prevent Duplicate Processing

  • Store every unique event identifier
  • Apply each event only once
  • Track sequence numbers when provided
  • Reconcile local data after a connection interruption
  • Handle provider corrections explicitly
Statistics

Retrieve Cricket Player and Team Statistics

Player Statistics

GET /v1/cricket/players/{player_id}/statistics

Example Filters

?format=t20&competition_id=competition_91&season=2026

Team Statistics

GET /v1/cricket/teams/{team_id}/statistics

Example Player Response

{
  "data": {
    "player": {
      "id": "player_301",
      "name": "A. Khan"
    },
    "scope": {
      "format": "T20",
      "season": "2026"
    },
    "batting": {
      "matches": 18,
      "innings": 17,
      "runs": 642,
      "average": 40.12,
      "strike_rate": 146.57
    },
    "bowling": {
      "innings": 8,
      "wickets": 7,
      "economy": 7.92
    }
  }
}

Statistics Best Practices

  • Show format, competition, season and sample size
  • Distinguish unavailable values from genuine zero values
  • Use stable player and team identifiers
  • Cache historical statistics appropriately
Odds

Retrieve Cricket Betting Markets and Prices

Odds endpoints may be restricted by plan, competition, bookmaker and jurisdiction.

Illustrative Endpoint

GET /v1/cricket/matches/{match_id}/odds

Example Odds Response

{
  "data": {
    "match_id": "match_84219",
    "updated_at": "2026-08-04T09:30:00Z",
    "bookmakers": [
      {
        "bookmaker_id": "bookmaker_12",
        "name": "Example Sportsbook",
        "markets": [
          {
            "market_id": "match_winner",
            "status": "open",
            "is_live": true,
            "outcomes": [
              {
                "selection_id": "team_18",
                "name": "Team A",
                "price": 1.72
              },
              {
                "selection_id": "team_29",
                "name": "Team B",
                "price": 2.10
              }
            ]
          }
        ]
      }
    ]
  }
}

Odds Handling

  • Display bookmaker attribution where required
  • Preserve market and selection identifiers
  • Show update timestamps
  • Do not present suspended prices as active
  • Confirm storage and commercial-use rights
Predictions

Retrieve Cricket Predictions and Win Probability

Illustrative Endpoint

GET /v1/cricket/matches/{match_id}/prediction

Example Prediction Response

{
  "data": {
    "match_id": "match_84219",
    "prediction_type": "pre_match",
    "generated_at": "2026-08-04T09:00:00Z",
    "outcomes": [
      {
        "team_id": "team_18",
        "win_probability": 0.58
      },
      {
        "team_id": "team_29",
        "win_probability": 0.42
      }
    ],
    "expected_scores": {
      "team_18": 176,
      "team_29": 168
    },
    "confidence": "moderate"
  }
}
Predictions are probability-based estimates, not guaranteed outcomes. Display confidence, generation time and uncertainty clearly.
WebSocket

Subscribe to Live Cricket Events

WebSocket access may be available for supported plans and competitions. Use REST to load the complete match state before subscribing.

Illustrative WebSocket URL

wss://stream.example.com/v1/cricket

Example Subscription Message

{
  "action": "subscribe",
  "match_ids": [
    "match_84219"
  ]
}

Example Live Event

{
  "event_id": "event_991827",
  "match_id": "match_84219",
  "type": "wicket",
  "innings": 2,
  "over": 16,
  "ball": 3,
  "score": {
    "runs": 148,
    "wickets": 5
  },
  "created_at": "2026-08-04T09:30:11Z"
}

Recommended WebSocket Workflow

  1. Load the current match state through REST
  2. Open the authenticated WebSocket connection
  3. Subscribe to the required matches
  4. Apply each unique event once
  5. Reconnect with controlled backoff after interruption
  6. Request the latest REST state again
  7. Reconcile and continue streaming
Pagination

Paginate Large Cricket Data Responses

List endpoints may return results in pages. Follow the confirmed pagination fields in the production specification.

Example Request

GET /v1/cricket/matches?page=2&page_size=100

Example Pagination Object

{
  "pagination": {
    "page": 2,
    "page_size": 100,
    "total_items": 438,
    "total_pages": 5,
    "has_next_page": true
  }
}
Rate limits

Manage Cricket API Rate Limits

Final quotas and response headers depend on the selected plan. Do not publish numeric limits until they are confirmed.

Possible Rate-Limit Headers

X-RateLimit-Limit: PLAN_LIMIT
X-RateLimit-Remaining: REMAINING_REQUESTS
X-RateLimit-Reset: RESET_TIMESTAMP
Retry-After: RETRY_SECONDS

Rate-Limit Best Practices

  • Cache fixtures and historical data on your server
  • Share one live response across multiple users
  • Stop polling completed matches
  • Use WebSocket delivery where appropriate
  • Respect Retry-After guidance
  • Monitor usage before major competitions
Errors

Handle API Errors

Example Error Response

{
  "error": {
    "code": "invalid_parameter",
    "message": "The supplied match identifier is invalid.",
    "request_id": "request_781922"
  }
}
Status Meaning Recommended action
400 Invalid request or parameter Validate the request before retrying
401 Authentication failed Verify the API credential
403 Resource not available to the plan Check permissions and coverage
404 Resource not found Verify the identifier
409 Request conflicts with current state Refresh the resource before retrying
422 Validation failed Review field-level error details
429 Rate limit exceeded Wait and follow retry guidance
500 Temporary server error Retry with controlled backoff
503 Service temporarily unavailable Use cached state and retry later
Code examples

Cricket API Request Examples

These examples are illustrative. Use the confirmed production host and authentication format.

JavaScript

const response = await fetch(
  'https://api.example.com/v1/cricket/matches/live',
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Accept': 'application/json'
    }
  }
);

if (!response.ok) {
  throw new Error(`API error: ${response.status}`);
}

const data = await response.json();

Python

import requests

response = requests.get(
    "https://api.example.com/v1/cricket/matches/live",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Accept": "application/json",
    },
    timeout=15,
)

response.raise_for_status()
data = response.json()

PHP Request Pattern

1. Create a server-side HTTP request
2. Add the confirmed authentication header
3. Set an appropriate timeout
4. Verify the HTTP status
5. Decode the JSON response
6. Handle temporary and permanent errors separately
Production guidance

Cricket API Integration Best Practices

Protect Credentials

Route requests through your backend and keep private credentials outside public code.

Use Stable IDs

Store match, team, player, competition, bookmaker and event identifiers.

Cache by Data Type

Cache historical data longer than live match state.

Handle Status Correctly

Respect scheduled, delayed, live, interrupted and completed states.

Prevent Duplicates

Process each event once and reconcile after connection failures.

Monitor Freshness

Display update times and avoid showing stale information as live.

Frequently asked questions

Cricket API Documentation FAQs

Where do I get an API key?

Obtain the credential through the confirmed account dashboard, subscription process or support channel.

Can I use the API directly in browser JavaScript?

Only when the provider explicitly supports safe public-client access. Private credentials should remain on your backend.

Does every competition include every endpoint?

No. Fixtures, live scores, statistics, odds, predictions and history can have different coverage.

Should I use REST or WebSocket?

Use REST for complete state and WebSocket for incremental live updates where supported.

How do I handle duplicate events?

Store unique event identifiers and apply each event only once.

How do I confirm the final endpoint structure?

Replace all placeholders on this page with the official production specification before publishing.

Start building

Integrate Cricket Data Into Your Product

Confirm your required competitions, endpoints, request volume and commercial use before selecting a production plan.

Chat on WhatsApp