GridTracker Event API Overview ¶
Authentication
All requests to the REST API must be signed using the ShotTracker issued username and secret. A ShotTracker API username/secret pair contains specific privileges; be sure to keep both secured.
Signing a request is done using HMAC. The following headers are needed for signing and required to be sent with each request.
Header Name | Description |
---|---|
date | Standard UTC date; be sure to keep the current time as the clock must not skew more than 5 minutes |
host | The servers host |
Authorization | The full hmac value with signature; see example below |
Below is a nodejs example illustrating the data required and how to formulate the data into the signing stream.
var crypto = require("crypto");
var userName = 'ShotTracker supplied user name here';
var secret = 'ShotTracker supplied secret here';
var host = 'api.shottracker.com';
var pathUriWithoutQueryString = '/v1/data/live/_search';
var method = 'GET';
var date = new Date().toUTCString();
var requestLine = method + ' ' + pathUriWithoutQueryString + ' HTTP/1.1';
var stringToSign = 'date: ' + date.trim() + '\n'
+ 'host: ' + host + '\n'
+ requestLine;
var encodedSignature = crypto.createHmac("sha1", secret).update(stringToSign).digest("base64");
var hmacAuth = 'hmac username="' + userName + '",algorithm="hmac-sha1",headers="date host request-line",signature="' + encodedSignature + '"';
console.log('date: ' + date);
console.log('Authorization: ' + hmacAuth);
Note Only the API (REST Resources) require a signed request. Authentication to the websocket is done by only providing the acquired subscription token.
Environment Endpoints
Development/ShotTracker Lab
-
Development Service API Environment - https://devapi-gridtracker.ddsports.com
-
Development Websocket - wss://devapi-gridtracker.ddsports.com/live/v2/games
Production
-
Production Service API Environment - https://api-gridtracker.ddsports.com
-
Production Websocket - wss://api-gridtracker.ddsports.com/live/v2/games
Locations XY Orientation
Team Events And Schedules ¶
Search Team Events ¶
Search Team EventsGET/v1/data/teams/{team_id}/events{?from,to,gamesonly}
The response will include both practice and/or game events. If the event is a game, additional fields are returned; game_type, is returned in the event node to indicate whether the game is halves (HALF) or quarters (QUARTER); and totals which will include links to the full game stats.
Example URI
- team_id
number
(required)ID of the team
- from
number
(required)The starting epoch timestamp (in milliseconds)
- to
number
(required)The ending epoch timestamp (in milliseconds)
- gamesonly
boolean
(optional)If the field is present and true on the request only games will be returned
200
Headers
Content-Type: application/json
Body
{
"id": "b9ace3d8-0a88-11ef-95e3-0242bac85d4d",
"name": "PSLSanFranciscovsMileHighPrep",
"results": [
{
"id": "85aef7f4-0afb-11ef-95e3-0242bac85d4d",
"name": "Q1",
"type": "FOOTBALL_GAME_QUARTER",
"started_at": 1714926086789,
"ended_at": 1714929738438,
"_stats": "https://api-gridtracker.ddsports.com/v1/data/stats/85aef7f4-0afb-11ef-95e3-0242bac85d4d/stats",
"_stats_details": "https://api-gridtracker.ddsports.com/v1/data/stats/85aef7f4-0afb-11ef-95e3-0242bac85d4d/stats/details",
"_shots": "https://api-gridtracker.ddsports.com/v1/data/stats/85aef7f4-0afb-11ef-95e3-0242bac85d4d/shots",
"_locations": [
"https://api.shottracker.com/v1/data/sensors/locations?id=85aef7f4-0afb-11ef-95e3-0242bac85d4d&from=1714926086789&to=1714926686789",
"https://api.shottracker.com/v1/data/sensors/locations?id=85aef7f4-0afb-11ef-95e3-0242bac85d4d&from=1714926686790&to=1714927286790",
"https://api.shottracker.com/v1/data/sensors/locations?id=85aef7f4-0afb-11ef-95e3-0242bac85d4d&from=1714927286791&to=1714927886791",
"https://api.shottracker.com/v1/data/sensors/locations?id=85aef7f4-0afb-11ef-95e3-0242bac85d4d&from=1714927886792&to=1714928486792",
"https://api.shottracker.com/v1/data/sensors/locations?id=85aef7f4-0afb-11ef-95e3-0242bac85d4d&from=1714928486793&to=1714929086793",
"https://api.shottracker.com/v1/data/sensors/locations?id=85aef7f4-0afb-11ef-95e3-0242bac85d4d&from=1714929086794&to=1714929686794",
"https://api.shottracker.com/v1/data/sensors/locations?id=85aef7f4-0afb-11ef-95e3-0242bac85d4d&from=1714929686795&to=1714930286795"
]
},
{
"id": "08686a59-0b04-11ef-95e3-0242bac85d4d",
"name": "Q2",
"type": "FOOTBALL_GAME_QUARTER",
"started_at": 1714929742083,
"ended_at": 1714931474935,
"_stats": "https://api-gridtracker.ddsports.com/v1/data/stats/08686a59-0b04-11ef-95e3-0242bac85d4d/stats",
"_stats_details": "https://api-gridtracker.ddsports.com/v1/data/stats/08686a59-0b04-11ef-95e3-0242bac85d4d/stats/details",
"_shots": "https://api-gridtracker.ddsports.com/v1/data/stats/08686a59-0b04-11ef-95e3-0242bac85d4d/shots",
"_locations": [
"https://api.shottracker.com/v1/data/sensors/locations?id=08686a59-0b04-11ef-95e3-0242bac85d4d&from=1714929742083&to=1714930342083",
"https://api.shottracker.com/v1/data/sensors/locations?id=08686a59-0b04-11ef-95e3-0242bac85d4d&from=1714930342084&to=1714930942084",
"https://api.shottracker.com/v1/data/sensors/locations?id=08686a59-0b04-11ef-95e3-0242bac85d4d&from=1714930942085&to=1714931542085"
]
},
{
"id": "14868a42-0b08-11ef-95e3-0242bac85d4d",
"name": "Q3",
"type": "FOOTBALL_GAME_QUARTER",
"started_at": 1714931480398,
"ended_at": 1714933150186,
"_stats": "https://api-gridtracker.ddsports.com/v1/data/stats/14868a42-0b08-11ef-95e3-0242bac85d4d/stats",
"_stats_details": "https://api-gridtracker.ddsports.com/v1/data/stats/14868a42-0b08-11ef-95e3-0242bac85d4d/stats/details",
"_shots": "https://api-gridtracker.ddsports.com/v1/data/stats/14868a42-0b08-11ef-95e3-0242bac85d4d/shots",
"_locations": [
"https://api.shottracker.com/v1/data/sensors/locations?id=14868a42-0b08-11ef-95e3-0242bac85d4d&from=1714931480398&to=1714932080398",
"https://api.shottracker.com/v1/data/sensors/locations?id=14868a42-0b08-11ef-95e3-0242bac85d4d&from=1714932080399&to=1714932680399",
"https://api.shottracker.com/v1/data/sensors/locations?id=14868a42-0b08-11ef-95e3-0242bac85d4d&from=1714932680400&to=1714933280400"
]
},
{
"id": "fa54777a-0b0b-11ef-95e3-0242bac85d4d",
"name": "Q4",
"type": "FOOTBALL_GAME_QUARTER",
"started_at": 1714933154439,
"ended_at": 1714934051533,
"_stats": "https://api-gridtracker.ddsports.com/v1/data/stats/fa54777a-0b0b-11ef-95e3-0242bac85d4d/stats",
"_stats_details": "https://api-gridtracker.ddsports.com/v1/data/stats/fa54777a-0b0b-11ef-95e3-0242bac85d4d/stats/details",
"_shots": "https://api-gridtracker.ddsports.com/v1/data/stats/fa54777a-0b0b-11ef-95e3-0242bac85d4d/shots",
"_locations": [
"https://api.shottracker.com/v1/data/sensors/locations?id=fa54777a-0b0b-11ef-95e3-0242bac85d4d&from=1714933154439&to=1714933754439",
"https://api.shottracker.com/v1/data/sensors/locations?id=fa54777a-0b0b-11ef-95e3-0242bac85d4d&from=1714933754440&to=1714934354440"
]
}
],
"source": "SHOTTRACKER",
"is_practice_event": false,
"is_game_event": true,
"started_at": 1714926086789,
"ended_at": 1714934051533,
"game_type": "QUARTER",
"_self": "https://api-gridtracker.ddsports.com/v1/data/games/b9ace3d8-0a88-11ef-95e3-0242bac85d4d",
"totals": {
"_stats_details": "https://api-gridtracker.ddsports.com/v1/data/stats/games/b9ace3d8-0a88-11ef-95e3-0242bac85d4d/stats/details"
},
"game_attributes": {
"home_team_id": 5879,
"home_team_name": "MileHighPrep",
"away_team_id": 5884,
"away_team_name": "PSLSanFrancisco"
}
}
422
Headers
Content-Type: application/json
Body
{
"status": 422,
"message": "Both from and to must be greater than 0 | from timestamp must be less than to timestamp | Request may not exceed more than 8 months",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
500
Headers
Content-Type: application/json
Body
{
"status": 500,
"message": "<General System Error Message>",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
Game Schedule ¶
Game ScheduleGET/v1/data/schedule/games{?type,from,to,team_id,location_id}
Example URI
- type
string
(optional)games by type (one of BASKETBALL, FOOTBALL - default: BASKETBALL)
- from
number
(required)starting event scheduled timestamp; epoch UTC milliseconds
- to
number
(optional)ending event schedule timestamp; epoch UTC milliseconds; if not provided the search range starting from the ‘from’ parameter will default to 1 day
- team_id
number
(optional)ID of the team
- location_id
string
(optional)composite location ID that consists of the court ID and facility ID separated by @
200
Headers
Content-Type: application/json
Body
{
"games": [
{
"event_id": "062a3726-3b0f-11eb-86c4-02420043683b",
"facility_name": "ShotTracker Lab",
"court_name": "main court",
"location_id": "6e4118d4-2e50-11e6-b4a4-deecc6e6f586@6e4118d4-2e50-11e6-b4a4-deecc6e6f581",
"tournament": null,
"tipoff_at": 1604052000000,
"gender": "MEN",
"status": "ACTIVE",
"type": "BASKETBALL",
"home_team_id": 481,
"home_team_name": "ShotTrackerW",
"home_team_reference_id": "938104592",
"away_team_id": 493,
"away_team_name": "BWB",
"away_team_reference_id": "938104593",
"officials_team_id": 0,
"_results": "https://api-gridtracker.ddsports.com/v1/data/games/cf3ba789-06c4-11e8-bb65-0242286dfad2",
"reference_id": "938104592",
"fan_engagement_enabled": false,
"source": "SHOTTRACKER"
}
]
}
Teams ¶
List Teams ¶
List TeamsGET/v1/data/teams
Example URI
200
Headers
Content-Type: application/json
Body
{
"teams": [
{
"id": 46,
"name": "Test Team",
"gender": "MEN",
"conference_name": "ACC",
"league_name": "NCAA",
"sport": "BASKETBALL",
"reference_id": "938104592"
}
]
}
Team Roster ¶
Team RosterGET/v1/data/teams/{team_id}{?game_event_id},{reference}
The current active players on the team. The game_event_id parameter can be used to look up all of the players on the team at the time of a game. Players who are no longer on the team will have an ‘is_active’ false. The special_services field returns items for specific special events; possible type values are MIC, VIDEO.
Basketball Player Positions
Abbreviation | Description |
---|---|
G | GUARD |
F | FORWARD |
C | CENTER |
Example URI
- team_id
number
(required)ID of the team
- game_event_id
string
(optional)ID of the game
- reference
string
(optional)indicates the system of origin for IDs passed in the query; default: SHOTTRACKER
200
Headers
Content-Type: application/json
Body
{
"id": 46,
"name": "Test Team",
"gender": "MEN",
"conference_name": "ACC",
"league_name": "NCAA",
"sport": "BASKETBALL",
"reference_id": "938104592",
"logo_image_link": "...",
"team_images": {
"logo_small_light": "...",
"logo_small_dark": "...",
"logo_small_light_transparent": "...",
"logo_small_dark_transparent": "...",
"logo_light": "...",
"logo_dark": "...",
"logo_light_transparent": "...",
"logo_dark_transparent": "..."
},
"players": [
{
"id": 1,
"first_name": "john",
"last_name": "doe",
"jersey_number": 1,
"jersey_number_str": "1",
"position": "center",
"profile_image_link": "...",
"display_name": "john doe",
"is_active": true,
"special_services": [
{
"type": "MIC",
"value": "mic6"
}
],
"reference_id": "42589513",
"sensor": 100630,
"is_starter": true,
"is_scout": false,
"team_player_images": {
"image_light": "...",
"image_dark": "...",
"image_light_transparent": "...",
"image_dark_transparent": "...",
"headshot_light": "...",
"headshot_dark": "...",
"headshot_transparent": "...",
"image_profile": "..."
}
}
]
}
403
Headers
Content-Type: application/json
Body
{
"status": 403,
"message": "Restricted resource",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
404
Headers
Content-Type: application/json
Body
{
"status": 404,
"message": "Game not found | Team not found in game",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
500
Headers
Content-Type: application/json
Body
{
"status": 500,
"message": "<General System Error Message>",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
Game Stats and Events ¶
Team Game Stats ¶
Team Game StatsGET/v1/data/teams/{team_id}/players/game/stats{?from,to,event_id}
Example URI
- team_id
number
(required)ID of the team
- from
number
(required)The starting epoch timestamp (in milliseconds)
- to
number
(required)The ending epoch timestamp (in milliseconds)
- event_id
string
(required)The game id; if provided from and to are ignored
200
Headers
Content-Type: application/json
Body
{
"id": 461,
"name": "team name",
"logo_image_link": "<image link>",
"player_stats": [
{
"id": 123,
"player_details": {
"id": 123,
"firstname": "John",
"lastname": "Doe",
"profile_image_link": "<image link>"
},
"version": 1,
"games_played": 1,
"stats": {
"FG": 1,
"FGA": 2,
"PTS": 2
}
}
]
}
403
Headers
Content-Type: application/json
Body
{
"status": 403,
"message": "No access to STATS data",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
422
Headers
Content-Type: application/json
Body
{
"status": 422,
"message": "Both from and to must be greater than 0 | from timestamp must be less than to timestamp | Request may not exceed more than 8 months",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
500
Headers
Content-Type: application/json
Body
{
"status": 500,
"message": "<General System Error Message>",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
Full Game Events ¶
Full Game EventsGET/v1/data/games/{event_id}/events
Example URI
- team_id
number
(required)ID of the team
- event_id
string
(required)The game id
200
Headers
Content-Type: application/json
Body
{}
403
Headers
Content-Type: application/json
Body
{
"status": 403,
"message": "Access denied to resource",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
500
Headers
Content-Type: application/json
Body
{
"status": 500,
"message": "<General System Error Message>",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
Specific Quarter Stats ¶
Stats ¶
StatsGET/v1/data/stats/{id}/stats
Returns all team and player box score stats. Team stats are included under player_stats with an id of 0.
Example URI
- id
string
(required)ID of the session
200
Headers
Content-Type: application/json
Body
{
"teams": [
{
"id": 461,
"name": "team name",
"logo_image_link": "<image link>",
"player_stats": [
{
"id": 123,
"player_details": {
"id": 123,
"firstname": "John",
"lastname": "Doe",
"profile_image_link": "<image link>"
},
"version": 1,
"stats": {
"FG": 1,
"FGA": 2,
"PTS": 2
}
}
]
}
]
}
403
Headers
Content-Type: application/json
Body
{
"status": 403,
"message": "No access to STATS data",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
404
Headers
Content-Type: application/json
Body
{
"status": 404,
"message": "Invalid id",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
500
Headers
Content-Type: application/json
Body
{
"status": 500,
"message": "<General System Error Message>",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
Stats Details ¶
Stats DetailsGET/v1/data/stats/{id}/stats/details
Returns all team and player stat details. Team stats are included under player_stats with an id of 0.
Example URI
- id
string
(required)ID of the session
200
Headers
Content-Type: application/json
Body
{
"teams": [
{
"id": 461,
"name": "team name",
"logo_image_link": "<image link>",
"player_stats": [
{
"id": 123,
"player_details": {
"id": 123,
"firstname": "John",
"lastname": "Doe",
"profile_image_link": "<image link>"
},
"stats": {
"FGA": [
{
"occurred_at": 123456789,
"value": 1,
"game_clock": "1:2.3",
"shot_clock": "4.5",
"period": "Q1",
"x": 30,
"y": 20,
"z": 10,
"hoop_to_event_x": 50,
"hoop_to_event_y": 60
},
{
"occurred_at": 234567890,
"value": 1,
"game_clock": "1:2.3",
"shot_clock": "4.5",
"period": "Q1",
"x": 30,
"y": 20,
"z": 10,
"hoop_to_event_x": 50,
"hoop_to_event_y": 60
}
],
"FG": [
{
"occurred_at": 123456789,
"value": 1,
"game_clock": "1:2.3",
"shot_clock": "4.5",
"period": "Q1",
"x": 30,
"y": 20,
"z": 10,
"hoop_to_event_x": 50,
"hoop_to_event_y": 60
}
],
"PTS": [
{
"occurred_at": 123456789,
"value": 2,
"game_clock": "1:2.3",
"shot_clock": "4.5",
"period": "Q1",
"x": 30,
"y": 20,
"z": 10,
"hoop_to_event_x": 50,
"hoop_to_event_y": 60
}
]
}
},
{
"id": 0,
"player_details": null,
"stats": {
"TO": [
{
"occurred_at": 123456789,
"value": 1,
"game_clock": "1:2.3",
"shot_clock": "4.5",
"period": "Q1",
"x": 30,
"y": 20,
"z": 10,
"hoop_to_event_x": 50,
"hoop_to_event_y": 60
}
]
}
}
]
}
]
}
403
Headers
Content-Type: application/json
Body
{
"status": 403,
"message": "No access to STATS data",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
404
Headers
Content-Type: application/json
Body
{
"status": 404,
"message": "Invalid id",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
500
Headers
Content-Type: application/json
Body
{
"status": 500,
"message": "<General System Error Message>",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
Stats Possessions ¶
Stats PossessionsGET/v1/data/stats/{id}/possessions
Example URI
- id
string
(required)ID of the session
200
Headers
Content-Type: application/json
Body
{
"teams": [
{
"id": 515,
"name": "STQA",
"team_player_details": [
{
"id": 3403,
"first_name": "John",
"last_name": "Doe",
"profile_image_link": ""
},
{
"id": 3932,
"first_name": "Jim",
"last_name": "Doe",
"profile_image_link": ""
}
],
"possessions": [
{
"_locations": "https://api-shottracker.ddsports.com/v1/data/sensors/locations?id=abc-123&from=1580408461984&to=1580408463984",
"start_timestamp": 1580408461984,
"end_timestamp": 1580408463984,
"start_game_clock": "12:30.0",
"end_game_clock": "12:25.0",
"period": "Q1",
"player_ids": [
3065,
3403,
3531,
3532,
3932
],
"opposing_player_ids": [
6833,
6835,
6836,
6837,
6838
],
"stats": [
{
"timestamp": 1580408461984,
"possession_type": "DEFENSIVE_REB",
"details": [
"DEFENSIVE_REB",
"REB"
],
"player_id": 3403
},
{
"timestamp": 1580408463984,
"game_clock": "12:30.0",
"shot_clock": "10.0",
"possession_type": "FGA",
"details": [
"FGA",
"FGA3",
"FGA_OTD",
"FGA3_OTD"
],
"player_id": 3932,
"shot_attributes": {
"shot_distance_cm": 755.0178607158906,
"x": 4096,
"y": 5320,
"z": -1,
"zone": 12,
"advanced_zone": 18,
"is_3point": true
}
}
],
"possession_attributes": {
"turnover": 0,
"passes": 1,
"half_court": false,
"paint_touch": true,
"ball_reversals": 1,
"ball_screens": 1,
"ball_screens_left_wing": 1,
"ball_screens_middle_wing": 0,
"ball_screens_right_wing": 0,
"ball_screens_pick_n_pop": 1,
"ball_screens_pick_n_roll": 0,
"ball_screens_pick_n_short_roll": 0,
"ball_screens_screened_shot": 0,
"ball_screens_handoff": 0,
"ball_screens_drag": 0,
"ball_screens_pop": 0,
"ball_screens_roll": 0,
"ball_screens_slip": 0,
"ball_screens_short_roll": 0,
"ball_screens_reject": 0,
"ball_screens_re_screen": 0,
"ball_screens_stay": 0,
"ball_screens_step_up": 0,
"ball_screens_snake": 0,
"ball_screens_split": 0,
"ball_screens_other": 0
}
}
]
}
]
}
403
Headers
Content-Type: application/json
Body
{
"status": 403,
"message": "No access to STATS data",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
404
Headers
Content-Type: application/json
Body
{
"status": 404,
"message": "Invalid id",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}
500
Headers
Content-Type: application/json
Body
{
"status": 500,
"message": "<General System Error Message>",
"shottrackerRequestId": "f1e80480-e1d5-4684-a619-402984b5c9ba"
}