Game Info JSON Views
We can query upcoming and live game information at the following endpoint:
https://site.api.espn.com/apis/fantasy/v2/games/ffl/games
The above end poitn we give us all game information for the current week. If we want a different week, we need to specify the dates
parameter, with a date range value in the format of yyyyMMdd-yyyyMMdd
. That looks like this:
https://site.api.espn.com/apis/fantasy/v2/games/ffl/games?dates=20230928-20231003
which is a Thursday through a Tuesday.
The API response has two arrays called statistics
and events
.
Info
statistics
: An array of Statlines for each player that accumulated some stat
events
: An array of Event
Event
: contains information like the currentperiod
,clock
,competitionId
,percentComplete
,lastPlay
, currentdrive
information, info on allscoringPlays
,odds
,fullStatus
.
Let's breack down the full json view starting with the overview. The api will return the following
statistics
¶
The statistics
array contains objects that have fields showing the total value for each stat id for a player. At the time of writing, I'm not certain on what these objects actually map to. We see objects with the same proTeamId and positionId, so you would think these represent player stats, however, the id
value is not a player id, so I'm not sure how to know who it maps to.
{
"statistics": [
{
"id": 15235,
"gameId": "401547426",
"proTeamId": "25",
"positionId": "13",
"stats": {
"210": 1.0,
"107": 1.0,
"108": 4.0,
"109": 5.0,
"110": 1.0,
"111": 1.0,
"155": 1
}
},
}
events
¶
For our purposes, we're only really interested in the game state, because this is going to help us out later when it comes to determine the percent chance of beating our opponent.
Here is an event that is currently in play, scheduled, and previous.
Event Currently in play
"events": [
{
"id": "401547442",
"competitionId": "401547442",
"uid": "s:20~l:28~e:401547442~c:401547442",
"date": "2023-09-29T00:15:00Z",
"timeValid": true,
"period": 4,
"clock": "4:18",
"links": [],
"status": "in",
"summary": "4:18 - 4th",
"lastPlay": {
"playId": "4015474423777",
"playType": {
"id": "74",
"text": "Official Timeout",
"abbreviation": "Off TO"
},
"text": "Timeout at 04:18.",
"shortText": "Timeout",
"scoringPlay": false,
"players": [],
"period": 4,
"clock": 258.0,
"homeScore": 17,
"awayScore": 34,
"start": {
"down": 2,
"distance": 5,
"yardLine": 86,
"yardsToEndzone": 14,
"team": "9"
},
"end": {
"down": 2,
"distance": 5,
"yardLine": 86,
"yardsToEndzone": 14,
"downDistanceText": "2nd & 5 at DET 14",
"shortDownDistanceText": "2nd & 5",
"possessionText": "DET 14",
"team": "9"
}
},
"drive": {
"id": "40154744221",
"start": {
"period": {
"type": "quarter",
"number": 4
},
"clock": {
"value": 360.0,
"displayValue": "6:00"
},
"yardLine": 17,
"text": "GB 17"
},
"teamId": "9",
"numberOfPlays": 7,
"isRedZone": true,
"plays": [
{
"playId": "4015474423588",
"playType": {
"id": "53",
"text": "Kickoff",
"abbreviation": "K"
},
"text": "J.Fox kicks 69 yards from DET 35 to GB -4. K.Nixon to GB 17 for 21 yards (C.Reynolds).",
"shortText": "Jack Fox 69 Yd Kickoff , Keisean Nixon 21 Yd Return",
"scoringPlay": false,
"players": [
{
"playerId": "3916370",
"order": 1,
"position": "23"
},
{
"playerId": "4259493",
"order": 2,
"position": "29"
},
{
"playerId": "4421446",
"order": 3,
"position": "9"
}
],
"period": 4,
"clock": 360.0,
"homeScore": 17,
"awayScore": 34,
"sequenceNumber": "358800",
"start": {
"down": 0,
"distance": 0,
"yardLine": 65,
"yardsToEndzone": 65,
"team": "8"
},
"end": {
"down": 1,
"distance": 10,
"yardLine": 17,
"yardsToEndzone": 83,
"downDistanceText": "1st & 10 at GB 17",
"shortDownDistanceText": "1st & 10",
"possessionText": "GB 17",
"team": "9"
},
"wallclock": "2023-09-29T02:57:37Z"
},
... // additional plays
]
},
"percentComplete": 92.83,
"scoringPlays": [
{
"playId": "401547442213",
"playType": {
"id": "59",
"text": "Field Goal Good",
"abbreviation": "FG"
},
"text": "A.Carlson 34 yard field goal is GOOD, Center-M.Orzech, Holder-D.Whelan.",
"shortText": "Anders Carlson Made 34 Yd Field Goal",
"scoringPlay": true,
"players": [
{
"playerId": "4242519",
"order": 1,
"position": "22"
},
{
"playerId": "4242519",
"order": 2,
"position": "22"
}
],
"period": 1,
"clock": 719.0,
"homeScore": 3,
"awayScore": 0,
"sequenceNumber": "21300",
"start": {
"down": 4,
"distance": 10,
"yardLine": 84,
"yardsToEndzone": 16,
"downDistanceText": "4th & 10 at DET 16",
"shortDownDistanceText": "4th & 10",
"possessionText": "DET 16",
"team": "9"
},
"end": {
"down": -1,
"distance": 10,
"yardLine": 100,
"yardsToEndzone": 65,
"team": "9"
},
"wallclock": "2023-09-29T00:20:45Z"
},
... // Additional scoring plays
],
"odds": "DET -2.5",
"fullStatus": {
"clock": 258.0,
"displayClock": "4:18",
"period": 4,
"type": {
"id": "2",
"name": "STATUS_IN_PROGRESS",
"state": "in",
"completed": false,
"description": "In Progress",
"detail": "4:18 - 4th Quarter",
"shortDetail": "4:18 - 4th"
}
},
"link": "",
"broadcasts": [
{
"type": "Web",
"lang": "en",
"region": "us",
"typeId": 4,
"isNational": true,
"shortName": "PRIME VIDEO"
}
],
"broadcast": "PRIME VIDEO",
"fantasySource": {
"id": "2",
"description": "feed",
"state": "full"
},
"competitors": [
{
"id": "9",
"type": "team",
"homeAway": "home",
"abbreviation": "GB",
"score": 17.0,
"winner": false,
"record": "2-1",
"name": "Packers",
"lineup": []
},
{
"id": "8",
"type": "team",
"homeAway": "away",
"abbreviation": "DET",
"score": 34.0,
"winner": false,
"record": "2-1",
"name": "Lions",
"lineup": []
}
]
},
...
]
Scheduled Event
"events": [
{
"id": "401547227",
"competitionId": "401547227",
"uid": "s:20~l:28~e:401547227~c:401547227",
"date": "2023-10-01T13:30:00Z",
"timeValid": true,
"period": 0,
"clock": "0:00",
"links": [
{
"language": "en-US",
"rel": [
"summary",
"desktop",
"event"
],
"href": "https://www.espn.com/nfl/game/_/gameId/401547227",
"text": "Gamecast",
"shortText": "Summary",
"isExternal": false,
"isPremium": false
}
],
"status": "pre",
"summary": "10/1 - 9:30 AM EDT",
"lastPlay": {},
"percentComplete": 0,
"scoringPlays": [],
"odds": "JAX -3.0",
"fullStatus": {
"clock": 0.0,
"displayClock": "0:00",
"period": 0,
"type": {
"id": "1",
"name": "STATUS_SCHEDULED",
"state": "pre",
"completed": false,
"description": "Scheduled",
"detail": "Sun, October 1st at 9:30 AM EDT",
"shortDetail": "10/1 - 9:30 AM EDT"
}
},
"link": "https://www.espn.com/nfl/game/_/gameId/401547227",
"broadcasts": [
{
"type": "Web",
"lang": "en",
"region": "us",
"typeId": 4,
"isNational": true,
"shortName": "ESPN+"
}
],
"broadcast": "ESPN+",
"fantasySource": {
"id": "0",
"description": "none",
"state": "none"
},
"competitors": [
{
"id": "30",
"type": "team",
"homeAway": "home",
"abbreviation": "JAX",
"score": "",
"winner": false,
"record": "1-2",
"name": "Jaguars",
"lineup": []
},
{
"id": "1",
"type": "team",
"homeAway": "away",
"abbreviation": "ATL",
"score": "",
"winner": false,
"record": "2-1",
"name": "Falcons",
"lineup": []
}
]
},
...
]
Completed Event
"events": [
{
"id": "401547426",
"competitionId": "401547426",
"uid": "s:20~l:28~e:401547426~c:401547426",
"date": "2023-09-22T00:15:00Z",
"timeValid": true,
"period": 4,
"clock": "0:00",
"links": [
{
"language": "en-US",
"rel": [
"summary",
"desktop",
"event"
],
"href": "https://www.espn.com/nfl/game/_/gameId/401547426",
"text": "Gamecast",
"shortText": "Summary",
"isExternal": false,
"isPremium": false
}
],
"status": "post",
"summary": "Final",
"lastPlay": {
"playId": "4015474264282",
"playType": {
"id": "66",
"text": "End of Game",
"abbreviation": "EG"
},
"text": "END GAME",
"shortText": "End Quarter 4",
"scoringPlay": false,
"players": [],
"period": 4,
"clock": 0.0,
"homeScore": 30,
"awayScore": 12,
"start": {
"down": 0,
"distance": 0,
"yardLine": 0,
"yardsToEndzone": 0
},
"end": {
"down": 2,
"distance": 11,
"yardLine": 59,
"yardsToEndzone": 41,
"team": "25"
}
},
"drive": {
"id": "40154742621",
"start": {
"period": {
"type": "quarter",
"number": 4
},
"clock": {
"value": 121.0,
"displayValue": "2:01"
},
"yardLine": 49,
"text": "SF 49"
},
"end": {
"period": {
"type": "quarter",
"number": 4
},
"yardLine": 60,
"text": "NYG 40"
},
"teamId": "25",
"numberOfPlays": 4,
"isRedZone": false,
"plays": [
{
"playId": "4015474264187",
"playType": {
"id": "5",
"text": "Rush",
"abbreviation": "RUSH"
},
"text": "J.Mason right end to NYG 46 for 5 yards (I.Simmons).",
"shortText": "Jordan Mason 5 Yd Rush",
"scoringPlay": false,
"players": [
{
"playerId": "4360569",
"order": 1,
"position": "9"
},
{
"playerId": "4035462",
"order": 2,
"position": "36"
}
],
"period": 4,
"clock": 121.0,
"homeScore": 30,
"awayScore": 12,
"sequenceNumber": "418700",
"start": {
"down": 1,
"distance": 10,
"yardLine": 49,
"yardsToEndzone": 51,
"downDistanceText": "1st & 10 at SF 49",
"shortDownDistanceText": "1st & 10",
"possessionText": "SF 49",
"team": "25"
},
"end": {
"down": 2,
"distance": 11,
"yardLine": 54,
"yardsToEndzone": 46,
"downDistanceText": "2nd & 11 at NYG 46",
"shortDownDistanceText": "2nd & 11",
"possessionText": "NYG 46",
"team": "25"
},
"wallclock": "2023-09-22T03:22:05Z"
},
...
]
},
"percentComplete": 100,
"scoringPlays": [
{
"playId": "401547426380",
"playType": {
"id": "59",
"text": "Field Goal Good",
"abbreviation": "FG"
},
"text": "J.Moody 28 yard field goal is GOOD, Center-T.Pepper, Holder-M.Wishnowsky.",
"shortText": "Jake Moody 28 Yd Field Goal ",
"scoringPlay": true,
"players": [
{
"playerId": "4372066",
"order": 1,
"position": "22"
},
{
"playerId": "4372066",
"order": 2,
"position": "22"
}
],
"period": 1,
"clock": 524.0,
"homeScore": 3,
"awayScore": 0,
"sequenceNumber": "38000",
"start": {
"down": 4,
"distance": 10,
"yardLine": 89,
"yardsToEndzone": 11,
"downDistanceText": "4th & 10 at NYG 11",
"shortDownDistanceText": "4th & 10",
"possessionText": "NYG 11",
"team": "25"
},
"end": {
"down": -1,
"distance": 10,
"yardLine": 100,
"yardsToEndzone": 65,
"team": "25"
},
"wallclock": "2023-09-22T00:26:06Z"
},
... // More scoring plays
],
"odds": "SF -10.5",
"fullStatus": {
"clock": 0.0,
"displayClock": "0:00",
"period": 4,
"type": {
"id": "3",
"name": "STATUS_FINAL",
"state": "post",
"completed": true,
"description": "Final",
"detail": "Final",
"shortDetail": "Final"
}
},
"link": "https://www.espn.com/nfl/game/_/gameId/401547426",
"broadcasts": [
{
"type": "Web",
"lang": "en",
"region": "us",
"typeId": 4,
"isNational": true,
"shortName": "PRIME VIDEO"
}
],
"broadcast": "PRIME VIDEO",
"fantasySource": {
"id": "3",
"description": "scrubbed",
"state": "full"
},
"competitors": [
{
"id": "25",
"type": "team",
"homeAway": "home",
"abbreviation": "SF",
"score": 30.0,
"winner": true,
"record": "3-0",
"name": "49ers",
"lineup": []
},
{
"id": "19",
"type": "team",
"homeAway": "away",
"abbreviation": "NYG",
"score": 12.0,
"winner": false,
"record": "1-2",
"name": "Giants",
"lineup": []
}
]
},,
...
]