Games

Retrieve information about NBA games.

Get All Games

Use this endpoint to retrieve NBA games.

import { Time4BoostAPI } from "@time4boost/sdk";

const api = new Time4BoostAPI({ apiKey: "YOUR_API_KEY" });
const games = await api.nba.getGames({ dates: ["2023-12-25"] });

The above command returns JSON structured like this:

{
  "data": [
    {
      "id": 857289,
      "date": "2023-12-25T00:00:00.000Z",
      "home_team": {
        "id": 20,
        "abbreviation": "NYK",
        "city": "New York",
        "conference": "East",
        "division": "Atlantic",
        "full_name": "New York Knicks",
        "name": "Knicks"
      },
      "home_team_score": 119,
      "period": 4,
      "postseason": false,
      "season": 2023,
      "status": "Final",
      "time": " ",
      "visitor_team": {
        "id": 16,
        "abbreviation": "MIL",
        "city": "Milwaukee",
        "conference": "East",
        "division": "Central",
        "full_name": "Milwaukee Bucks",
        "name": "Bucks"
      },
      "visitor_team_score": 122
    },
    // ... more games
  ],
  "meta": {
    "next_cursor": 857290,
    "per_page": 25
  }
}

HTTP Request

GET https://api.time4boost.com/v1/games

Query Parameters

ParameterRequiredDescription
cursorfalseCursor for pagination, use the value from meta.next_cursor
per_pagefalseNumber of results per page (default: 25, max: 100)
datesfalseComma-separated list of dates (YYYY-MM-DD) to filter games
seasonsfalseComma-separated list of seasons to filter games
team_idsfalseComma-separated list of team IDs to filter games
Get Game by ID

Use this endpoint to retrieve information about a specific NBA game by its ID.

import { Time4BoostAPI } from "@time4boost/sdk";

const api = new Time4BoostAPI({ apiKey: "YOUR_API_KEY" });
const game = await api.nba.getGame(857289);

The above command returns JSON structured like this:

{
  "data": {
    "id": 857289,
    "date": "2023-12-25T00:00:00.000Z",
    "home_team": {
      "id": 20,
      "abbreviation": "NYK",
      "city": "New York",
      "conference": "East",
      "division": "Atlantic",
      "full_name": "New York Knicks",
      "name": "Knicks"
    },
    "home_team_score": 119,
    "period": 4,
    "postseason": false,
    "season": 2023,
    "status": "Final",
    "time": " ",
    "visitor_team": {
      "id": 16,
      "abbreviation": "MIL",
      "city": "Milwaukee",
      "conference": "East",
      "division": "Central",
      "full_name": "Milwaukee Bucks",
      "name": "Bucks"
    },
    "visitor_team_score": 122
  }
}

HTTP Request

GET https://api.time4boost.com/v1/games/:id

URL Parameters

ParameterRequiredDescription
idtrueThe ID of the game to retrieve
Error Responses

The API uses the following error codes:

Error CodeMeaning
400Bad Request -- Your request is invalid.
401Unauthorized -- Your API key is wrong.
403Forbidden -- The requested resource is hidden for administrators only.
404Not Found -- The specified game could not be found.
429Too Many Requests -- You're requesting too many resources! Slow down!
500Internal Server Error -- We had a problem with our server. Try again later.
Rate Limiting

The API is rate limited to prevent abuse and ensure a fair usage for all users. The rate limits depend on your account tier:

  • Free tier: 30 requests per minute
  • ALL-STAR tier: 60 requests per minute
  • GOAT tier: 120 requests per minute

If you exceed the rate limit, you'll receive a 429 Too Many Requests response. The response will include headers indicating your current rate limit status:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1623423149

The X-RateLimit-Reset header contains a Unix timestamp indicating when your rate limit will reset.