Match statistics
On this page, we will show how you can use our football API to get match statistics.
Any football website would be incomplete without being able to show its visitors the statistics of the match. In fact, this applies to any football-related product, including mobile apps, TV shows, and even radio shows. Match statistics allow people to compare the teams and predict the outcome of the game in real-time. Using our head to head football api endpoint, you can compare the two teams before the start of the match. Using our statistics football api endpoint you can compare them as their rivalry unfolds. That is why we are glad to have this api endpoint included in our service.
Endpoint
When using our football api endpoint for match statistics all you need is the match_id that you get from the livescore api endpoint and the history api endpoint. The match needs to have started in order to have statistics available. Thus, this api endpoint will not work for fixtures that you get our fixtures api endpoint.
Check this Football API endpoint in our postman collection. Download it now!
In the example above, our football API will provide you with the match statistics of the game between Real Madrid and Bayern Munchen. The response is a list of all the statistics that we have for this match for both teams. An example JSON response is shown below. Then follows an explanation of what is what in it. First, we will look at the parameters table, which luckily contains only one parameter.
If you provide the lang parameter, the names of the different statistics will be translated in that language.
Parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| lang | string | fr | A language in which you want the statistics | |
| match_id | number | 1 | 172252 | The id of the match which statistics we are going to get. |
Response
The response, from the match statistics football api endpoint, is pretty concise and straight forward, but we are going to explain it just in case. Each statistic is a separate object inside the array of data. There are four elements type, label, home, and away. The type never changes and indicates the type of the statistic. the label changes based on the language that you have chosen or it remains in English if the lang parameter is not provided. The home and away numbers are the respective values for this statistic for the home and away teams. When it comes to the yellow and red cards, using this api endpoint you will get the number of cards, and if you want to get the details of which players received the cards, you can use our match events api endpoint.
{
"success": true,
"data": [
{
"type": "attacks",
"label": "Attacks",
"home": 0,
"away": 0
},
{
"type": "attempts_on_goal",
"label": "Attempts on Goal",
"home": 21,
"away": 12
},
{
"type": "corners",
"label": "Corners",
"home": 9,
"away": 2
},
{
"type": "dangerous_attacks",
"label": "Dangerous Attacks",
"home": 0,
"away": 0
},
{
"type": "fauls",
"label": "Fouls",
"home": 10,
"away": 12
},
{
"type": "free_kicks",
"label": "Free Kicks",
"home": 0,
"away": 0
},
{
"type": "goal_kicks",
"label": "Goal Kicks",
"home": 0,
"away": 0
},
{
"type": "offsides",
"label": "Offsides",
"home": 2,
"away": 1
},
{
"type": "penalties",
"label": "Penalties",
"home": 0,
"away": 0
},
{
"type": "possesion",
"label": "Possession",
"home": 69,
"away": 31
},
{
"type": "red_cards",
"label": "Red Cards",
"home": 0,
"away": 2
},
{
"type": "saves",
"label": "Saves",
"home": 2,
"away": 4
},
{
"type": "shots_blocked",
"label": "Shots Blocked",
"home": 8,
"away": 3
},
{
"type": "shots_off_target",
"label": "Shots off Target",
"home": 5,
"away": 4
},
{
"type": "shots_on_target",
"label": "Shots on Target",
"home": 9,
"away": 5
},
{
"type": "substitutions",
"label": "Substitutions",
"home": 0,
"away": 0
},
{
"type": "throw_ins",
"label": "Throw Ins",
"home": 0,
"away": 0
},
{
"type": "treatments",
"label": "Treatments",
"home": 0,
"away": 0
},
{
"type": "yellow_cards",
"label": "Yellow Cards",
"home": 1,
"away": 6
}
]
}| Name | Type | Example | Description |
|---|---|---|---|
| away | number | 2 | The value of this statistic for the away team |
| home | number | 1 | The value of this statistic for the home team |
| label | string | Corners | The human-readable label of the statistic. It can put straight in an user interface of an app/website etc. It will change based on the lang parameter. |
| type | string | corners | The type of statistic that this object contains. |
Getting translated match statistics
To get the match statistics translated into Dasnish for example: cUrl:
curl -XGET "https://livescore-api.com/api-client/statistics/matches.json?key=demo_key&secret=demo_secret&match_id=702913&lang=da"
PHP:
file_get_contents('https://livescore-api.com/api-client/statistics/matches.json?key=demo_key\&secret=demo_secret\&match_id=702913\&lang=da');
Python:
import urllib2
req = urllib2.Request('https://livescore-api.com/api-client/matches/statistics.json?key=demo_key\&secret=demo_secret\&match_id=702913\&lang=da')
response = urllib2.urlopen(req)
print response.read()