Stats
Retrieve player statistics for NBA games.
Get Player Stats
Use this endpoint to retrieve player statistics for NBA games.
import { Time4BoostAPI } from "@time4boost/sdk";
const api = new Time4BoostAPI({ apiKey: "YOUR_API_KEY" });
const stats = await api.nba.getStats({ dates: ["2023-12-25"] });
The above command returns JSON structured like this:
{
"data": [
{
"id": 1234567,
"ast": 6,
"blk": 0,
"dreb": 5,
"fg3_pct": 0.333,
"fg3a": 6,
"fg3m": 2,
"fg_pct": 0.474,
"fga": 19,
"fgm": 9,
"ft_pct": 0.75,
"fta": 4,
"ftm": 3,
"game": {
"id": 857289,
"date": "2023-12-25T00:00:00.000Z",
"home_team_id": 20,
"home_team_score": 119,
"period": 4,
"postseason": false,
"season": 2023,
"status": "Final",
"time": " ",
"visitor_team_id": 16,
"visitor_team_score": 122
},
"min": "36:47",
"oreb": 1,
"pf": 1,
"player": {
"id": 246,
"first_name": "Giannis",
"last_name": "Antetokounmpo",
"position": "F",
"team_id": 16
},
"pts": 23,
"reb": 6,
"stl": 2,
"team": {
"id": 16,
"abbreviation": "MIL",
"city": "Milwaukee",
"conference": "East",
"division": "Central",
"full_name": "Milwaukee Bucks",
"name": "Bucks"
},
"turnover": 3
},
// ... more stats
],
"meta": {
"next_cursor": 1234568,
"per_page": 25
}
}
HTTP Request
GET https://api.time4boost.com/v1/stats
Query Parameters
Parameter | Required | Description |
---|---|---|
cursor | false | Cursor for pagination, use the value from meta.next_cursor |
per_page | false | Number of results per page (default: 25, max: 100) |
dates | false | Comma-separated list of dates (YYYY-MM-DD) to filter stats |
seasons | false | Comma-separated list of seasons to filter stats |
player_ids | false | Comma-separated list of player IDs to filter stats |
game_ids | false | Comma-separated list of game IDs to filter stats |
Error Responses
The API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The requested resource is hidden for administrators only. |
404 | Not Found -- The specified resource could not be found. |
429 | Too Many Requests -- You're requesting too many resources! Slow down! |
500 | Internal 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.