Fixture statistics
Team fixture statistics
Fixture statistics are available for the teams participating in the fixture and the players. You can access a fixture via one of our fixtures endpoints. For this example, we will be using the GET Fixtures by ID endpoint.
Let's take a look at the match statistics for Celtic vs Rangers (id: 18535517) by using the statistics
include:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=statistics
The statistics include returns the match statistics for both teams. Our API returns many values, but what do they mean exactly? And how can you display the type of statistic? You can use the nested include statistics.type
for this:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=statistics.type
Please check the response carefully to see the correct values with the types.
Including .type
is not recommended as an include on any endpoint. Types are used throughout the entire API. We recommend retrieving all types from the types endpoint and storing them in your database or other data structure. Only include the type if no other option is available or when testing the API.
Filtering team fixture statistics
The API returns a lot of statistics, but we can imagine you're interested in only some of them.
Check our filtering tutorial for valuable tips and tricks.
What if you're only interested in specific statistics like shots on target? To filter your request, you need to:
Add the parameter
&filters=
Select the entity you want to filter on
Select the field you want to filter on
Fill in the IDs you're interested in
Let's say you're only interested in the shots on goal. In our case, this will result in the following steps:
Add the parameter
&filters=
Select the entity you want to filter on:
fixtureStatistic
Select the field you want to filter on:
Types
(the statistics types)Fill in the IDs you're interested in:
86
(You can retrieve them via the Types endpoint or by looking at the previous request)
It's important to note that you can retrieve statistics from multiple entities. Therefore, you also need to specify for which entity you want to filter the statistics. You can do this by prefixing the filter with the entity's name. So in our case: fixtureStatistic
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=statistics.type&filters=fixtureStatisticTypes:86
Are you interested in more statistics? Add more statistics IDs to your request by separating them with a comma (,
). Check our syntax section for more helpful information.
Player fixture statistics
You might wonder, how can I retrieve the statistics of the players per fixture? While the statistics include only returns the team statistics, the lineups
include produces the player statistics.
Let's look at how to retrieve these statistics for Celtic vs Rangers (id: 18535517).
As mentioned, player statistics for a specific fixture are available in the lineups include:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=lineups
However, as you can see, the lineups only return player info by default: not the statistics. To retrieve the statistics, you need to add the nested include .details
to your request. This results in the below request:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=lineups.details
Just like with the other statistics include, you can add .type
to your include to obtain the statistics' names:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=lineups.details.type
Please check the response carefully to see the correct values with the types.
Including .type
is not recommended as an include on any endpoint. Types are used throughout the entire API. We recommend retrieving all types from the types endpoint and storing them in your database or other data structure. Only include the type if no other option is available or when testing the API.
Filtering player fixture statistics
What if you're only interested in specific statistics like passes? To filter your request, you need to:
Add the parameter
&filters=
Select the entity you want to filter on
Select the field you want to filter on
Fill in the IDs you're interested in
Let's say you're only interested in the passes. In our case, this will result in the following steps:
Add the parameter
&filters=
Select the entity you want to filter on:
lineupDetail
Select the field you want to filter on:
Types
(the statistics types)Fill in the IDs you're interested in:
80
(You can retrieve them via the Types endpoint or by looking at the previous request)
It's important to note that you can retrieve statistics from multiple entities. Therefore, you also need to specify for which entity you want to filter the statistics. You can do this by prefixing the filter with the entity's name. So in our case: lineupDetail
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token={your_token}&include=lineups.details.type&filters=lineupDetailTypes:80
Want to combine the match and player stats? Easy, add the extra includes:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=statistics.type;lineups.details.type
Want to filter it?
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=statistics.type;lineups.details.type&filters=lineupDetailTypes:80,119,116;fixtureStatisticTypes:86,78
Last updated
Was this helpful?