# NBA Games, Scores & Schedule (`tonzzz-ccc/nba-games-scores`) Actor

NBA schedules, live and final scores by date, season or team. Uses the licensed balldontlie API with your own free key. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/tonzzz-ccc/nba-games-scores.md
- **Developed by:** [Triston Molina](https://apify.com/tonzzz-ccc) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

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 Games, Scores & Schedule

Get NBA games with scores, status and start times (also shown in Philippine time) as clean JSON, CSV or Excel. Data comes from the licensed **balldontlie API**, not from scraping a website.

### Bring your own API key

1. Create a free account at https://www.balldontlie.io and copy your API key.
2. Paste it into **balldontlie API key**. Your key is stored encrypted.
3. The free balldontlie plan allows 5 requests per minute and includes Games. This Actor spaces its requests to stay within that limit.

This Actor is not affiliated with balldontlie or the NBA.

### Input

| Field | Meaning |
|---|---|
| startDate / endDate | Date range, YYYY-MM-DD |
| season | Season start year, e.g. 2025 for 2025-26 |
| seasonType | Regular, playoffs, play-in, NBA Cup, preseason |
| teams | Only games involving these teams |
| onlyFinished | Skip scheduled and live games |
| maxItems | Limit games saved |
| requestsPerMinute | Match your API plan |

### Output example

```json
{
  "gameId": 1234567,
  "date": "2025-12-25",
  "startTimePh": "Dec 26, 2025, 1:00 AM",
  "state": "final",
  "season": 2025,
  "postseason": false,
  "homeTeam": "New York Knicks",
  "homeAbbr": "NYK",
  "homeScore": 110,
  "visitorTeam": "San Antonio Spurs",
  "visitorAbbr": "SAS",
  "visitorScore": 104,
  "winner": "New York Knicks"
}
```

### Notes

- Scheduled games have no score yet, so their scores are empty.
- One request returns up to 100 games, so long ranges take a few requests on the free plan.

# Actor input Schema

## `apiKey` (type: `string`):

Your free API key from https://www.balldontlie.io (create an account, copy the key). Required for normal use. Stored encrypted.

## `startDate` (type: `string`):

First game date, format YYYY-MM-DD.

## `endDate` (type: `string`):

Last game date, format YYYY-MM-DD. Leave empty for a single start date or open range.

## `season` (type: `integer`):

For example 2025 means the 2025-26 season. Optional.

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

Filter by part of the season.

## `teams` (type: `array`):

Only games involving these teams. Leave empty for all.

## `onlyFinished` (type: `boolean`):

Skip scheduled and live games.

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

Maximum games to save. 0 means no limit.

## `requestsPerMinute` (type: `integer`):

Match your API plan. The free balldontlie plan allows 5 per minute.

## Actor input object example

```json
{
  "startDate": "2025-12-25",
  "endDate": "2025-12-25",
  "seasonType": "any",
  "onlyFinished": false,
  "maxItems": 20,
  "requestsPerMinute": 5
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `results` (type: `string`):

No description

# 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 = {
    "startDate": "2025-12-25",
    "endDate": "2025-12-25",
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("tonzzz-ccc/nba-games-scores").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 = {
    "startDate": "2025-12-25",
    "endDate": "2025-12-25",
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("tonzzz-ccc/nba-games-scores").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 '{
  "startDate": "2025-12-25",
  "endDate": "2025-12-25",
  "maxItems": 20
}' |
apify call tonzzz-ccc/nba-games-scores --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tonzzz-ccc/nba-games-scores"
        }
    }
}
```

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/v38mjhg5WL0LW5QYP/builds/djbmhZqZnNpxYnHib/openapi.json
