Statistics types
A brief introduction about types
We introduced states and types to ensure data quality and consistency for specific fields. Something has a type when there are multiple variants of a particular variant. Sounds difficult? Let's explain with an example:
Hint: you can request all possible types with their unique id via the types endpoint: https://api.sportmonks.com/v3/core/types?api_token=YOUR_TOKEN
Fixture statistics
As youβve learned in our includes tutorial, you can quickly enrich your request by using includes. You can obtain the statistics for your favourite fixture by adding the &include=statistics to your request. So, for example, the Celtic vs. Rangers fixture:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_tokenYOUR_TOKEN&include=statisticsResponse
{
"data": {
"id": 18535517,
"sport_id": 1,
"league_id": 501,
"season_id": 19735,
"stage_id": 77457866,
"group_id": null,
"aggregate_id": null,
"round_id": 274719,
"state_id": 5,
"venue_id": 8909,
"name": "Celtic vs Rangers",
"starting_at": "2022-09-03 11:30:00",
"result_info": "Celtic won after full-time.",
"leg": "1/1",
"details": null,
"length": 90,
"placeholder": false,
"last_processed_at": "2023-03-02 17:47:38",
"has_odds": true,
"starting_at_timestamp": 1662204600,
"statistics": [
{
"id": 5914502,
"fixture_id": 18535517,
"type_id": 86,
"participant_id": 53,
"data": {
"value": 6
},
"location": "home"
},
{
"id": 5914520,
"fixture_id": 18535517,
"type_id": 78,
"participant_id": 62,
"data": {
"value": 17
},
"location": "away"
},
//And MoreThis request returns all the match statistics of both teams for the requested fixture. As you might have noticed, you receive a lot of values belonging to different type ids. What does this mean exactly?
Just add the nested &include=statistics.type to receive a textual representation:
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=statistics.typeResponse
{
"data": {
"id": 18535517,
"sport_id": 1,
"league_id": 501,
"season_id": 19735,
"stage_id": 77457866,
"group_id": null,
"aggregate_id": null,
"round_id": 274719,
"state_id": 5,
"venue_id": 8909,
"name": "Celtic vs Rangers",
"starting_at": "2022-09-03 11:30:00",
"result_info": "Celtic won after full-time.",
"leg": "1/1",
"details": null,
"length": 90,
"placeholder": false,
"last_processed_at": "2023-03-02 17:47:38",
"has_odds": true,
"starting_at_timestamp": 1662204600,
"statistics": [
{
"id": 5914502,
"fixture_id": 18535517,
"type_id": 86,
"participant_id": 53,
"data": {
"value": 6
},
"location": "home",
"type": {
"id": 86,
"name": "Shots On Target",
"code": "shots-on-target",
"developer_name": "SHOTS_ON_TARGET",
"model_type": "statistic",
"stat_group": "offensive"
}
},
{
"id": 5914520,
"fixture_id": 18535517,
"type_id": 78,
"participant_id": 62,
"data": {
"value": 17
},
"location": "away",
"type": {
"id": 78,
"name": "Tackles",
"code": "tackles",
"developer_name": "TACKLES",
"model_type": "statistic",
"stat_group": "defensive"
}
},
//And moreNow you can distinguish between the various match statistics for both teams.
Interested in an overview of all statistics types? Check our statistics types overview page.
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.
See also
Related tutorials
Fixture Statistics - Learn how to retrieve match statistics
Player Statistics - Access individual player stats
Season Statistics - Get league-wide statistics
Team Statistics - Retrieve team performance data
Reference
Statistics Types List - Complete reference of all statistic type IDs and descriptions
Includes Tutorial - Learn how to use nested includes for type data
Best practices
Filter and Select Fields - Filter statistics by specific type IDs
Last updated
Was this helpful?