# NBA Shot Chart & Shot Location Scraper (`incognito_mode/nba-shot-chart-scraper`) Actor

Scrape every NBA field-goal attempt with exact court coordinates: true distance, angle, zone and plot-ready x/y. Adds expected points from the league's own per-zone baseline, so you can see which shots beat the league. Filter by game, player, team or date. No API key, no login.

- **URL**: https://apify.com/incognito\_mode/nba-shot-chart-scraper.md
- **Developed by:** [Elena Vance](https://apify.com/incognito_mode) (community)
- **Categories:** Sports, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 shots

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## NBA Shot Chart & Shot Location Scraper

Every NBA field-goal attempt, with **where on the floor it came from** — and the
spatial fields the league does not publish, computed and verified against a
full season.

No API key, no login, no browser. Filter by game, player, team, date or season.

### What you get

One row per shot. Real output from a 2026-04-12 game:

| Date | Player | Team | Made | Zone | Our distance | NBA's | Angle | Expected pts | Pts over expected |
|---|---|---|---|---|---|---|---|---|---|
| 2026-04-12 | Luka Garza | BOS | ✅ | Above the Break 3 | **25.778** | 25 | 28.75° | 1.038 | **+1.962** |
| 2026-04-12 | Franz Wagner | ORL | ✅ | Above the Break 3 | **27.777** | 27 | 27.67° | 1.038 | **+1.962** |
| 2026-04-12 | Paolo Banchero | ORL | ✅ | Restricted Area | **1.985** | 1 | 40.91° | 1.342 | +0.658 |
| 2026-04-12 | Paolo Banchero | ORL | ❌ | Restricted Area | **2.766** | 2 | −77.47° | 1.342 | −1.342 |
| 2026-04-12 | Desmond Bane | ORL | ✅ | Mid-Range | **18.623** | 18 | 35.82° | 0.800 | +1.200 |

Each row also carries the raw `LOC_X`/`LOC_Y`, plot-ready coordinates for the
standard 500×470 court grid in both orientations, the game clock as elapsed
seconds, home/away and opponent, and NBA's three zone labels.

### What makes this different

**The distance NBA publishes is wrong by design.** `SHOT_DISTANCE` is *floored*,
not rounded — verified across all **219,160** shots of the 2025-26 regular
season, where `floor` matched every row and `round` matched 54%. Every published
distance therefore runs short by up to a foot, always in the same direction. You
get the exact value and NBA's integer beside it.

**Expected points, from NBA's own numbers.** The endpoint ships a league FG%
table per zone alongside every query. Joining it turns a made/missed flag into
*points over expectation* — shot-making separated from shot selection, with no
model to trust. The baseline is fetched once for the whole season, deliberately:
scoring a single day's shots against that same day's average drives the number
to zero by construction.

**A season query that is actually complete.** `shotchartdetail` truncates at
102,400 rows and reports nothing — a 2023-24 season request returns a valid 200
whose data stops on 17 January. Summed month by month the same season holds
219,527 shots, so **53% is dropped silently**. This Actor splits every
league-wide query into windows before asking, and re-splits anything that still
comes back at the cap.

**Home/away that is right.** The obvious source for it, `MATCHUP`, is *usually*
written from the row team's point of view — in one captured slate, 17 rows of 18
were, and Orlando's own row read `MEM @ ORL`. Deriving the side from that string
mislabels roughly one row in twenty. This uses the shot row's own home-team
field instead.

**Works in the offseason.** The default run needs no input and returns the most
recent day actually played, resolving back a season when the newest one has been
announced but not started.

### Modes

| Give it | You get |
| --- | --- |
| *nothing* | The most recent day of play, league-wide |
| `gameIds` | Every shot in those games (~180 each) — the cheapest way to run it |
| `playerIds` | That player's whole season (~1,300 shots) |
| `playerIds` + `gameIds` | Just those players, in just those games |
| `teamIds` | That team's season (~7,400 shots) |
| `dateFrom` / `dateTo` | League-wide over that window, split automatically |
| `season` + `seasonType` | Regular season, playoffs, pre-season, play-in or All-Star |

`maxItems` caps both the result count and the cost. IDs are NBA Stats IDs —
`201939` is Stephen Curry, `1610612744` is Golden State.

### Why this is cheap to run

Runs in **256 MB** with no browser and no proxy on a healthy run, so the
`apify-actor-start` fee is charged once rather than four times. A default run
finishes in **3.5 seconds**; peak memory plateaus around 160 MB no matter how
long the run is.

### What this Actor does *not* return

- **Anything that is not a field-goal attempt.** Made and missed shots only — no
  free throws, rebounds, assists or turnovers.
- **Modelled shot quality.** `expectedPoints` is the league's average from that
  zone. It is an honest baseline, not an xG-style model — defender distance and
  shot clock are not in this feed, so no number here pretends to include them.
- **Player tracking or defender data.** Served by different `stats.nba.com`
  endpoints with a different shape; not joined here.
- **Seasons before 1996-97.** Shot locations do not exist before then, and the
  Actor refuses those rather than returning an empty result that looks like a
  quiet day.
- **`SHOT_ATTEMPTED_FLAG` / `GRID_TYPE`.** Constant on every row, so emitting
  them would cost you storage and tell you nothing.

### Example runs

```json
{ "gameIds": ["0022500578"], "maxItems": 200 }
```

```json
{ "playerIds": [201939], "season": "2025-26" }
```

```json
{ "teamIds": [1610612744], "season": "2025-26", "seasonType": "Playoffs" }
```

```json
{ "dateFrom": "2026-01-15", "dateTo": "2026-01-31", "maxItems": 20000 }
```

### Notes

Unofficial and not affiliated with or endorsed by the NBA. Data comes from the
same public endpoints nba.com's own statistics pages read.

`docs/architecture.md` records every measurement behind the claims above,
including the header/TLS matrix, the cap proof and the full-season geometry
verification.

# Changelog

This Actor's version history is a separate document: https://apify.com/incognito\_mode/nba-shot-chart-scraper/changelog.md

# Actor input Schema

## `season` (type: `string`):

NBA season to read, written as '2025-26'. Shot locations start in 1996-97. Leave this empty and the Actor uses the most recent season that has actually been played — which is what you want during the offseason, when the upcoming season exists but has no games yet.

## `seasonType` (type: `string`):

Which part of the season. Playoffs, Pre Season, All Star and PlayIn are separate datasets from the regular season, not filters on it.

## `gameIds` (type: `array`):

NBA 10-digit game IDs, e.g. '0022500578'. The cheapest way to run this Actor: one game is about 180 shots. Leading zeros matter, but a value that lost them in a spreadsheet is repaired automatically.

## `playerIds` (type: `array`):

NBA Stats player IDs — 201939 is Stephen Curry. These are not jersey numbers. Given alone, you get every shot that player took in the season; given together with Game IDs, you get only their shots in those games.

## `teamIds` (type: `array`):

NBA Stats team IDs — 1610612744 is Golden State. A team's full season is roughly 7,400 shots.

## `dateFrom` (type: `string`):

Only shots on or after this date (YYYY-MM-DD). Give one date alone and you get exactly that day.

## `dateTo` (type: `string`):

Only shots on or before this date (YYYY-MM-DD).

## `maxItems` (type: `integer`):

Hard cap on how many shots this run delivers, and therefore on what it costs — you are billed per shot returned. A single game is ~180 shots, one player's season ~1,300, a team's season ~7,400 and a whole league season ~220,000.

## `proxyConfiguration` (type: `object`):

Leave this off. The Actor calls stats.nba.com directly and only reaches for a proxy if a request is actually refused, so a healthy run spends nothing on proxy traffic.

## Actor input object example

```json
{
  "season": "2025-26",
  "seasonType": "Regular Season",
  "gameIds": [
    "0022500578"
  ],
  "playerIds": [
    201939
  ],
  "teamIds": [
    1610612744
  ],
  "maxItems": 1000,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing every scraped shot.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "seasonType": "Regular Season",
    "maxItems": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("incognito_mode/nba-shot-chart-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "seasonType": "Regular Season",
    "maxItems": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("incognito_mode/nba-shot-chart-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "seasonType": "Regular Season",
  "maxItems": 1000
}' |
apify call incognito_mode/nba-shot-chart-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,incognito_mode/nba-shot-chart-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/AwNQhozLqaPF2nVQO/builds/iptn87Naq5LE0uYY5/openapi.json
