# Basketball Stats API
> Basketball efficiency-stats maths as an API, computed locally and deterministically — the shooting-efficiency and box-score numbers an analyst, coach or sports app rates a performance by. The true-shooting endpoint folds twos, threes and free throws into one number: TS% = points ÷ (2 × (field-goal attempts + 0.44 × free-throw attempts)) × 100, where the 0.44 approximates how many possessions a free-throw trip really uses — 25 points on 18 field goals and 6 free throws is about 60.6 %, against a league average near 56–58 %. The effective-field-goal endpoint credits a three for being worth 50 % more than a two: eFG% = (field goals made + 0.5 × threes made) ÷ field-goal attempts × 100, so 9 makes including 3 threes on 18 attempts is 58.3 % versus a raw 50 %, the gap being the value of the long ball. The game-score endpoint computes John Hollinger's Game Score, a single-game productivity rating scaled like points — PTS + 0.4·FGM − 0.7·FGA − 0.4·(FTA−FTM) + 0.7·ORB + 0.3·DRB + STL + 0.7·AST + 0.7·BLK − 0.4·PF − TOV — where about 10 is an average game, 20+ excellent and 40+ historic, rewarding efficient scoring and all-round play while docking misses and turnovers. Everything is computed locally and deterministically, so it is instant and private. Ideal for basketball analytics and box-score tools, fantasy and commentary apps, and sports calculators. Pure local computation — no key, no third-party service, instant. 3 compute endpoints. For baseball stats use a baseball API; for cricket a cricket 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/basketball-api/..."
```

## Pricing
- **Free** (Free) — 7,900 calls/Mo, 2 req/s
- **Starter** ($8/Mo) — 65,500 calls/Mo, 6 req/s
- **Pro** ($26/Mo) — 256,000 calls/Mo, 15 req/s
- **Mega** ($80/Mo) — 1,185,000 calls/Mo, 40 req/s

## Endpoints

### Basketball

#### `GET /v1/effective-fg` — Effective field-goal percentage

**Parameters:**
- `fgm` (query, required, string) — Field goals made Example: `9`
- `fg3m` (query, required, string) — Three-pointers made Example: `3`
- `fga` (query, required, string) — Field-goal attempts Example: `18`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/basketball-api/v1/effective-fg?fgm=9&fg3m=3&fga=18"
```

**Response:**
```json
{
    "data": {
        "note": "Effective field-goal percentage credits a three-pointer for being worth 50 % more than a two: eFG% = (field goals made + 0.5 × threes made) ÷ field-goal attempts × 100. 9 makes including 3 threes on 18 attempts is 58.3 %, versus a raw 50 % field-goal percentage — the gap is the value of the long ball. It is the simplest way to compare a high-volume three-point shooter with an inside scorer.",
        "inputs": {
            "fga": 18,
            "fgm": 9,
            "fg3m": 3
        },
        "effective_fg_pct": 58.33
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:50.654Z",
        "request_id": "f4b7da63-a1f4-4d58-abe1-8e943d565b4e"
    },
    "status": "ok",
    "message": "Effective FG",
    "success": true
}
```

#### `GET /v1/game-score` — Hollinger Game Score

**Parameters:**
- `points` (query, optional, string) — Points Example: `25`
- `fgm` (query, optional, string) — Field goals made Example: `9`
- `fga` (query, optional, string) — Field-goal attempts Example: `18`
- `fta` (query, optional, string) — Free-throw attempts Example: `6`
- `ftm` (query, optional, string) — Free throws made Example: `5`
- `orb` (query, optional, string) — Offensive rebounds Example: `2`
- `drb` (query, optional, string) — Defensive rebounds Example: `5`
- `stl` (query, optional, string) — Steals Example: `2`
- `ast` (query, optional, string) — Assists Example: `4`
- `blk` (query, optional, string) — Blocks Example: `1`
- `pf` (query, optional, string) — Personal fouls Example: `2`
- `tov` (query, optional, string) — Turnovers Example: `3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/basketball-api/v1/game-score?points=25&fgm=9&fga=18&fta=6&ftm=5&orb=2&drb=5&stl=2&ast=4&blk=1&pf=2&tov=3"
```

**Response:**
```json
{
    "data": {
        "note": "Game Score (John Hollinger) rolls a full box-score line into one productivity number for a single game, scaled like points: PTS + 0.4·FGM − 0.7·FGA − 0.4·(FTA−FTM) + 0.7·ORB + 0.3·DRB + STL + 0.7·AST + 0.7·BLK − 0.4·PF − TOV. Around 10 is an average game, 20+ is excellent and 40+ is historic. It rewards efficient scoring and all-round contribution while docking missed shots and turnovers.",
        "inputs": {
            "pf": 2,
            "ast": 4,
            "blk": 1,
            "drb": 5,
            "fga": 18,
            "fgm": 9,
            "fta": 6,
            "ftm": 5,
            "orb": 2,
            "stl": 2,
            "tov": 3,
            "points": 25
        },
        "game_score": 20.2
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:50.760Z",
        "request_id": "6c9ffe5e-6acf-4a60-ac3c-b1e5c3b22e7c"
    },
    "status": "ok",
    "message": "Game score",
    "success": true
}
```

#### `GET /v1/true-shooting` — True shooting percentage

**Parameters:**
- `points` (query, required, string) — Points scored Example: `25`
- `fga` (query, required, string) — Field-goal attempts Example: `18`
- `fta` (query, required, string) — Free-throw attempts Example: `6`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/basketball-api/v1/true-shooting?points=25&fga=18&fta=6"
```

**Response:**
```json
{
    "data": {
        "note": "True shooting percentage weighs every way a player scores — twos, threes and free throws — into one number: TS% = points ÷ (2 × (field-goal attempts + 0.44 × free-throw attempts)) × 100. The 0.44 approximates how many possessions a trip to the line really uses. 25 points on 18 field goals and 6 free throws is about 60.6 % — an efficient night; league-average is near 56–58 %, and elite scorers top 62 %.",
        "inputs": {
            "fga": 18,
            "fta": 6,
            "points": 25
        },
        "true_shooting_pct": 60.56,
        "scoring_possessions": 20.64
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:50.864Z",
        "request_id": "c73e50a8-42a3-4508-a098-95f3d397ea0a"
    },
    "status": "ok",
    "message": "True shooting",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "TS% = PTS/(2·(FGA+0.44·FTA))·100; eFG% = (FGM+0.5·3PM)/FGA·100; Game Score = Hollinger formula. For baseball use a baseball API; for cricket a cricket API.",
        "service": "basketball-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/game-score": "Hollinger Game Score from a box-score line.",
            "GET /v1/effective-fg": "Effective field-goal % from FGM, threes made and FGA.",
            "GET /v1/true-shooting": "True shooting % from points, FGA and FTA."
        },
        "description": "Basketball efficiency stats: true shooting %, effective field-goal %, and Hollinger Game Score."
    },
    "meta": {
        "timestamp": "2026-06-07T08:17:50.959Z",
        "request_id": "6e014b2c-4c02-4153-8387-ab2a7a7ad51e"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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