Includes
Last updated
Was this helpful?
Last updated
Was this helpful?
Includes are the cornerstone of our API and allow you to enrich and customize your requests. This flexibility is what distinguishes Sportmonks from all competitors. This manner of flexibility lets you receive the specific data that interests you. Each endpoint comes with a list of includes. For more information, please refer to our
You can see includes as something like an add-on to an endpoint. In this tutorial, we will show and explain what includes are and how you can make use of them. Don’t worry, though; using includes is relatively straightforward!
In this tutorial, our goal is to analyze a match played on the 2nd of August 2020. We want to know who the teams are and what events (goals, cards, substitutions) happened during the match. Our starting endpoint will be :
The date is in YYYY-MM-DD format:
This request will give you all the fixtures of a specific date. In our case, the 2nd of August 2020, which is what we want.
All of our endpoints will give you a ‘basic’ response by default. As you can see, we will receive information mostly containing unique ids.
You can see the fixture id, the local and visitor teams’ id, and the full-time score. However, what if we want to know more about the participating teams, their team names, or what their logos look like?
This is where includes come into play. By merely adding&include=localTeam,visitorTeam
to the request, we have successfully used includes. This request will show you the extra data about the home and visitor teams because we've ‘included’ information about the local and visitor teams.
As you can see, there is an extra part included in comparison to the basic response:
The API will give you all the information about the local and visitor teams. You can see the team names, the logos when the team was founded, the venue id, and the id of the current season they’re participating in.
Like shooting fish in a barrel, right?
But we’re not done yet! We still want to know about the events (goals, cards, and substitutions) that happened during the match.
Our API has close to no limit on the number of includes per endpoint. This allows you to request all the extra data you want in the same request. So, we can simply add the include events
to our request:
And we'll get all the events per fixture. You can view a snippet of the response below.
Now we have extra information about the participating teams and all the events of a fixture! Just like that, we have achieved our goal. Includes are basically add-ons that you can use with your request for additional information. The endpoint provides basic data, while the include gives you extra information.
Opens an array of weather details. Possible values of the data in this array can be found in our
Gives information about the pitch. Possible values can be found in our
Opens an array containing the lineup formations of the teams. Possible values can be found in our
Indicates in which phase the fixture is in. Possible values can be found in our
Indicates if the team was deleted. More information:
The event type. Possible values can be found in our
The outcome of the Video Assistant Referee intervention. Possible values can be found in our
Not all includes work with every endpoint. So please make sure that you check which includes are available per endpoint in our
There are also more advanced, includes called nested includes. These are relationships of relationships. You can already check out our for more information.
Not seeing all the data you expected to see? Check out our tutorial about .