# Cricket Stats API
> Cricket statistics maths as an API, computed locally and deterministically — the run-rate, strike-rate and chase numbers a scorer, commentator or cricket app works a match by. An over is six legal balls, and overs are given as whole overs plus balls, never as decimal overs — '20.3 overs' means 20 overs and 3 balls (20.5 in real terms), the classic cricket-maths trap this API avoids. The run-rate endpoint gives the runs per over = runs ÷ (balls ÷ 6), so 150 runs off 20 overs is 7.50 an over, and with a target overs figure it projects the innings score at the current pace. The strike-rate endpoint gives a batter's strike rate = runs ÷ balls faced × 100, the runs per 100 balls — 75 off 50 is a strike rate of 150, fast scoring in the limited-overs game; in Tests a lower strike rate with a high average is prized instead. The required-rate endpoint handles a chase: the required run rate = the runs still needed ÷ the balls left × 6, so needing 80 to win with 10 overs left is 8.00 an over — a figure that climbs sharply as balls run out, which is why a comfortable chase can tip away in a couple of tight overs. Everything is computed locally and deterministically, so it is instant and private. Ideal for cricket scoring and live-score apps, fantasy and commentary tools, and sports calculators. Pure local computation — no key, no third-party service, instant. 3 compute endpoints. For baseball stats use a baseball API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/cricket-api/..."
```

## Pricing
- **Free** (Free) — 7,700 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 64,500 calls/Mo, 6 req/s
- **Pro** ($25/Mo) — 253,000 calls/Mo, 15 req/s
- **Mega** ($79/Mo) — 1,175,000 calls/Mo, 40 req/s

## Endpoints

### Cricket

#### `GET /v1/required-rate` — Required run rate to chase

**Parameters:**
- `target_runs` (query, required, string) — Target to win Example: `200`
- `current_runs` (query, required, string) — Current score Example: `120`
- `overs_remaining` (query, required, string) — Whole overs left Example: `10`
- `balls_remaining` (query, optional, string) — Extra balls left (0–5) Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cricket-api/v1/required-rate?target_runs=200&current_runs=120&overs_remaining=10&balls_remaining=0"
```

**Response:**
```json
{
    "data": {
        "note": "Chasing a target, the required run rate = the runs still needed ÷ the balls left × 6. Needing 80 to win (target 200, on 120) with 10 overs left means 8.00 an over. It climbs sharply as balls run out, which is why a chase that looks comfortable can tip away in a couple of tight overs; compare it with the current run rate to read the game.",
        "inputs": {
            "target_runs": 200,
            "current_runs": 120,
            "balls_remaining": 0,
            "overs_remaining": 10
        },
        "runs_needed": 80,
        "balls_remaining": 60,
        "required_run_rate": 8
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:51.097Z",
        "request_id": "1d634b22-2ab8-471a-ab49-b0e9db13593d"
    },
    "status": "ok",
    "message": "Required run rate",
    "success": true
}
```

#### `GET /v1/run-rate` — Run rate and projected score

**Parameters:**
- `runs` (query, required, string) — Runs scored Example: `150`
- `overs` (query, required, string) — Whole overs bowled Example: `20`
- `balls` (query, optional, string) — Extra balls in current over (0–5) Example: `0`
- `target_overs` (query, optional, string) — Innings overs for projection Example: `50`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cricket-api/v1/run-rate?runs=150&overs=20&balls=0&target_overs=50"
```

**Response:**
```json
{
    "data": {
        "note": "The run rate is the runs scored per over = runs ÷ (balls ÷ 6); an over is six legal balls, so 150 runs off 20 overs is 7.50 an over. Note overs are whole overs plus balls, not a decimal — '20.3 overs' means 20 overs and 3 balls (20.5 in real terms), the classic cricket-maths trap. Multiply the run rate by the innings overs for a projected score at the current pace.",
        "inputs": {
            "runs": 150,
            "balls": 0,
            "overs": 20,
            "target_overs": 50
        },
        "run_rate": 7.5,
        "balls_faced": 120,
        "projected_score": 375
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:51.188Z",
        "request_id": "e6e4972c-5d9f-4c17-bb29-9a4ae7361ed5"
    },
    "status": "ok",
    "message": "Run rate",
    "success": true
}
```

#### `GET /v1/strike-rate` — Batter strike rate

**Parameters:**
- `runs` (query, required, string) — Runs scored Example: `75`
- `balls_faced` (query, required, string) — Balls faced Example: `50`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cricket-api/v1/strike-rate?runs=75&balls_faced=50"
```

**Response:**
```json
{
    "data": {
        "note": "A batter's strike rate = runs ÷ balls faced × 100, the runs they would score per 100 balls. 75 off 50 is a strike rate of 150 — fast scoring for the limited-overs game, where strike rate measures aggression; in Tests a lower strike rate with a high average is prized instead. (A bowler's strike rate is the opposite idea: balls per wicket.)",
        "inputs": {
            "runs": 75,
            "balls_faced": 50
        },
        "strike_rate": 150
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:51.258Z",
        "request_id": "bd7f2520-d5f3-4b9f-8af8-fdf9e379632c"
    },
    "status": "ok",
    "message": "Strike rate",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cricket-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "notes": "An over is 6 balls; overs are whole overs + balls, not decimal. run rate = runs/(balls/6); strike rate = runs/balls·100; RRR = runs_needed/balls_left·6. For baseball stats use a baseball API.",
        "service": "cricket-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/run-rate": "Run rate and projected score from runs and overs.",
            "GET /v1/strike-rate": "Batter strike rate from runs and balls faced.",
            "GET /v1/required-rate": "Required run rate to chase a target."
        },
        "description": "Cricket statistics: run rate and projected score, batter strike rate, and the required run rate to chase a target."
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:51.330Z",
        "request_id": "f84134b0-b5fa-4dbf-a51b-780513e40a63"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/cricket-api
OpenAPI spec: https://www.oanor.com/api/cricket-api/openapi.json
