# Tips and tricks

## Fixture score

Are you interested in the score of the fixture?&#x20;

You can retrieve the scores of a fixture by using the `&include=scores` parameter when calling the API endpoint for that fixture.

The scores will be returned in the response, along with a description and type to help you understand when the goals were scored, for example, `1ST_HALF` and `2ND_HALF`.&#x20;

To display the latest scores for a game, including any extra time that may have been played, use the `CURRENT` indicator.&#x20;

Here’s an example of how to retrieve the scores for a fixture:

{% tabs %}
{% tab title="Example request" %}

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript"><strong>https://api.sportmonks.com/v3/football/fixtures/18804545?api_token=YOUR_TOKEN&#x26;include=scores
</strong></code></pre>

{% endtab %}

{% tab title="Example response" %}

```javascript
{
  "data": {
    "id": 18804545,
    "sport_id": 1,
    "league_id": 2286,
    "season_id": 19724,
    "stage_id": 77457819,
    "group_id": null,
    "aggregate_id": null,
    "round_id": null,
    "state_id": 5,
    "venue_id": 5530,
    "name": "Fiorentina vs West Ham United",
    "starting_at": "2023-06-07 19:00:00",
    "result_info": "West Ham United won after full-time.",
    "leg": "1/1",
    "details": null,
    "length": 90,
    "placeholder": false,
    "has_odds": true,
    "starting_at_timestamp": 1686164400,
    "scores": [
      {
        "id": 12813095,
        "fixture_id": 18804545,
        "type_id": 1,
        "participant_id": 1,
        "score": {
          "goals": 0,
          "participant": "away"
        },
        "description": "1ST_HALF"
      },
      {
        "id": 12813094,
        "fixture_id": 18804545,
        "type_id": 1,
        "participant_id": 109,
        "score": {
          "goals": 0,
          "participant": "home"
        },
        "description": "1ST_HALF"
      },
      {
        "id": 12813168,
        "fixture_id": 18804545,
        "type_id": 2,
        "participant_id": 109,
        "score": {
          "goals": 1,
          "participant": "home"
        },
        "description": "2ND_HALF"
      },
      {
        "id": 12813096,
        "fixture_id": 18804545,
        "type_id": 1525,
        "participant_id": 109,
        "score": {
          "goals": 1,
          "participant": "home"
        },
        "description": "CURRENT"
      },
      {
        "id": 12813097,
        "fixture_id": 18804545,
        "type_id": 1525,
        "participant_id": 1,
        "score": {
          "goals": 2,
          "participant": "away"
        },
        "description": "CURRENT"
      },
      {
        "id": 12813169,
        "fixture_id": 18804545,
        "type_id": 2,
        "participant_id": 1,
        "score": {
          "goals": 2,
          "participant": "away"
        },
        "description": "2ND_HALF"
      }
    ]
  },
```

{% endtab %}
{% endtabs %}

## Fixture events

You probably know that you can use the events include to obtain all fixture events like goals, substitutions and cards, but did you also know you can enrich this data?&#x20;

Let’s take a look at some features you might have missed.

### **Add player information**

Interested in more information about the players related to the fixture event? Use the .player include for detailed player info:

{% tabs %}
{% tab title="Example request" %}

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript"><strong>https://api.sportmonks.com/v3/football/fixtures/18804545?api_token=YOUR_TOKEN&#x26;include=events.player
</strong></code></pre>

{% endtab %}

{% tab title="Example response" %}

```javascript
{
  "data": {
    "id": 18804545,
    "sport_id": 1,
    "league_id": 2286,
    "season_id": 19724,
    "stage_id": 77457819,
    "group_id": null,
    "aggregate_id": null,
    "round_id": null,
    "state_id": 5,
    "venue_id": 5530,
    "name": "Fiorentina vs West Ham United",
    "starting_at": "2023-06-07 19:00:00",
    "result_info": "West Ham United won after full-time.",
    "leg": "1/1",
    "details": null,
    "length": 90,
    "placeholder": false,
    "has_odds": true,
    "starting_at_timestamp": 1686164400,
    "events": [
      {
        "id": 85639443,
        "fixture_id": 18804545,
        "period_id": 4852787,
        "participant_id": 1,
        "type_id": 19,
        "section": "event",
        "player_id": 96426,
        "related_player_id": null,
        "player_name": "Saïd Benrahma",
        "related_player_name": null,
        "result": null,
        "info": "Simulation",
        "addition": null,
        "minute": 31,
        "extra_minute": null,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1503,
        "player": {
          "id": 96426,
          "sport_id": 1,
          "country_id": 614,
          "nationality_id": 614,
          "city_id": null,
          "position_id": 27,
          "detailed_position_id": 152,
          "type_id": 27,
          "common_name": "M. Benrahma",
          "firstname": "Mohamed Saïd",
          "lastname": "Benrahma",
          "name": "Mohamed Saïd Benrahma",
          "display_name": "Saïd Benrahma",
          "image_path": "https://cdn.sportmonks.com/images/soccer/players/10/96426.png",
          "height": 172,
          "weight": 67,
          "date_of_birth": "1995-08-10",
          "gender": "male"
        }
      },
      {
        "id": 85639771,
        "fixture_id": 18804545,
        "period_id": 4852787,
        "participant_id": 1,
        "type_id": 10,
        "section": "event",
        "player_id": 161284,
        "related_player_id": null,
        "player_name": "Luka Jović ",
        "related_player_name": null,
        "result": null,
        "info": "Offside",
        "addition": "Goal Disallowed",
        "minute": 45,
        "extra_minute": 5,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": null,
        "player": {
          "id": 161284,
          "sport_id": 1,
          "country_id": 296,
          "nationality_id": 296,
          "city_id": null,
          "position_id": 27,
          "detailed_position_id": 151,
          "type_id": 27,
          "common_name": "L. Jović",
          "firstname": "Luka",
          "lastname": "Jović",
          "name": "Luka Jović",
          "display_name": "Luka Jović ",
          "image_path": "https://cdn.sportmonks.com/images/soccer/players/4/161284.png",
          "height": 182,
          "weight": 79,
          "date_of_birth": "1997-12-23",
          "gender": "male"
        }
      },
  //and more!
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The request also returns player information you might not need. You can use the select option only to retrieve the player info you want:&#x20;

`https://api.sportmonks.com/v3/football/fixtures/{fixture_id}?api_token=YOURTOKEN&include=events.player:image_path`&#x20;

More info can be found in our [select tutorial](https://docs.sportmonks.com/v3/tutorials-and-guides/tutorials/filter-and-select-fields/selecting-fields).
{% endhint %}

### Extra event info

The `events.subType` include is a powerful feature that provides additional information about a specific entity belonging to a particular type in the Sportmonks' [Football API](https://www.sportmonks.com/football-api/). It allows you to access more detailed data related to an [event](https://docs.sportmonks.com/v3/definitions/types/events), such as goals, that fall under a certain type. For example, in the case of events, the `type_id` can be `"GOAL" (id: 14)`, and the sub\_type can provide specific details about the goal, like whether it was scored with the right-foot or the-left foot or the head of the player.

When fetching events, you can use the following parameters: `&include=events.subType` This will return the `events.subType` information related to each event, allowing you to access additional details about the events based on their types.&#x20;

Let's consider an example to illustrate how to utilise the `events.subType` include in the API request:

{% tabs %}
{% tab title="Example request" %}

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript"><strong>https://api.sportmonks.com/v3/football/fixtures/18804545?api_token=YOUR_TOKEN&#x26;include=events.subType
</strong></code></pre>

{% endtab %}

{% tab title="Example response" %}

```javascript
{
  "data": {
    "id": 18804545,
    "sport_id": 1,
    "league_id": 2286,
    "season_id": 19724,
    "stage_id": 77457819,
    "group_id": null,
    "aggregate_id": null,
    "round_id": null,
    "state_id": 5,
    "venue_id": 5530,
    "name": "Fiorentina vs West Ham United",
    "starting_at": "2023-06-07 19:00:00",
    "result_info": "West Ham United won after full-time.",
    "leg": "1/1",
    "details": null,
    "length": 90,
    "placeholder": false,
    "has_odds": true,
    "starting_at_timestamp": 1686164400,
    "events": [
      {
        "id": 85639443,
        "fixture_id": 18804545,
        "period_id": 4852787,
        "participant_id": 1,
        "type_id": 19,
        "section": "event",
        "player_id": 96426,
        "related_player_id": null,
        "player_name": "Saïd Benrahma",
        "related_player_name": null,
        "result": null,
        "info": "Simulation",
        "addition": null,
        "minute": 31,
        "extra_minute": null,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1503,
        "subtype": {
          "id": 1503,
          "name": "Simulation",
          "code": "simulation",
          "developer_name": "SIMULATION",
          "model_type": "sub_event",
          "stat_group": null
        }
      },
     {
        "id": 85640523,
        "fixture_id": 18804545,
        "period_id": 4852817,
        "participant_id": 109,
        "type_id": 14,
        "section": "event",
        "player_id": 128736,
        "related_player_id": 215532,
        "player_name": "Giacomo Bonaventura",
        "related_player_name": "Nicolás González",
        "result": "1-1",
        "info": "Shot",
        "addition": "2nd Goal",
        "minute": 67,
        "extra_minute": null,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1522,
        "subtype": {
          "id": 1522,
          "name": "Right foot shot",
          "code": "right-foot-shot",
          "developer_name": "RIGHT_FOOT_SHOT",
          "model_type": "sub_event",
          "stat_group": null
        }
      },
      {
        "id": 85639957,
        "fixture_id": 18804545,
        "period_id": 4852817,
        "participant_id": 109,
        "type_id": 18,
        "section": "event",
        "player_id": 223943,
        "related_player_id": 161284,
        "player_name": "Arthur Cabral",
        "related_player_name": "Luka Jović ",
        "result": null,
        "info": null,
        "addition": null,
        "minute": 46,
        "extra_minute": null,
        "injured": true,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1524,
        "subtype": {
          "id": 1524,
          "name": "Substitution because of injury",
          "code": "sub-because-of-injury",
          "developer_name": "SUB_BECAUSE_OF_INJURY",
          "model_type": "sub_event",
          "stat_group": null
        }
      },
//and more
```

{% endtab %}
{% endtabs %}

In this example, we retrieve a list of events, and by including the `events.subType`, we gain access to the additional information associated with each event's type.

The response will contain the relevant `events.subType` details for each event, providing more context and specificity about the events within the result set.

## Extra fixture information

The fixture and livescore endpoint return basic information by default. You can use the `metadata` include if you’re interested in information about the pitch, team colours, formations, if the lineup is confirmed or not and, when available, a fixture hashtag.&#x20;

{% tabs %}
{% tab title="Example request" %}
{% code overflow="wrap" %}

```javascript
​​https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=metadata.type
```

{% endcode %}
{% endtab %}

{% tab title="Example response" %}

```javascript
{
  "data": {
    "id": 18804545,
    "sport_id": 1,
    "league_id": 2286,
    "season_id": 19724,
    "stage_id": 77457819,
    "group_id": null,
    "aggregate_id": null,
    "round_id": null,
    "state_id": 5,
    "venue_id": 5530,
    "name": "Fiorentina vs West Ham United",
    "starting_at": "2023-06-07 19:00:00",
    "result_info": "West Ham United won after full-time.",
    "leg": "1/1",
    "details": null,
    "length": 90,
    "placeholder": false,
    "has_odds": true,
    "starting_at_timestamp": 1686164400,
    "metadata": [
      {
        "id": 2511667,
        "metadatable_id": 18804545,
        "type_id": 35,
        "value_type": "object",
        "values": {
          "neutral": false
        },
        "type": {
          "id": 35,
          "name": "Neutral Venue",
          "code": "neutral_venue",
          "developer_name": "NEUTRAL_VENUE",
          "model_type": "metadata",
          "stat_group": null
        }
      },
      {
        "id": 2525219,
        "metadatable_id": 18804545,
        "type_id": 159,
        "value_type": "object",
        "values": {
          "home": "4-2-1-3",
          "away": "4-2-3-1"
        },
        "type": {
          "id": 159,
          "name": "Formation",
          "code": "formation",
          "developer_name": "FORMATION",
          "model_type": "metadata",
          "stat_group": null
        }
      },
      {
        "id": 2527724,
        "metadatable_id": 18804545,
        "type_id": 161,
        "value_type": "object",
        "values": {
          "participant": "#7C45CA",
          "kit": "#7C45CA,#482F8A,#F0F0F0,#7C45CA,#482F8A,#482F8A,#7C45CA,#7C45CA,#F0F0F0,#7C45CA,#7C45CA",
          "location": "home"
        },
        "type": {
          "id": 161,
          "name": "Home Participant Colors",
          "code": "home-participany-colors",
          "developer_name": "HOME_PARTICIPANT_COLORS",
          "model_type": "metadata",
          "stat_group": null
        }
      },
      {
        "id": 2527725,
        "metadatable_id": 18804545,
        "type_id": 162,
        "value_type": "object",
        "values": {
          "participant": "#F0F0F0",
          "kit": "#F0F0F0,#F0F0F0,#F0F0F0,#D94B14,#C40010,#0046A8,#F0F0F0,#F0F0F0,#0A0A0A,#F0F0F0,#F0F0F0",
          "location": "away"
        },
        "type": {
          "id": 162,
          "name": "Away Participant Colors",
          "code": "away-participany-colors",
          "developer_name": "AWAY_PARTICIPANT_COLORS",
          "model_type": "metadata",
          "stat_group": null
        }
      },
      {
        "id": 2527729,
        "metadatable_id": 18804545,
        "type_id": 567,
        "value_type": "object",
        "values": {
          "pitch": "GOOD"
        },
        "type": {
          "id": 567,
          "name": "Pitch",
          "code": "pitch",
          "developer_name": "PITCH",
          "model_type": "metadata",
          "stat_group": null
        }
      },
      {
        "id": 2511668,
        "metadatable_id": 18804545,
        "type_id": 572,
        "value_type": "object",
        "values": {
          "confirmed": true
        },
        "type": {
          "id": 572,
          "name": "Lineup Confirmed",
          "code": "lineup-confirmed",
          "developer_name": "LINEUP_CONFIRMED",
          "model_type": "metadata",
          "stat_group": null
        }
      },
      {
        "id": 2528684,
        "metadatable_id": 18804545,
        "type_id": 578,
        "value_type": "object",
        "values": {
          "attendance": 17363
        },
        "type": {
          "id": 578,
          "name": "Attendance",
          "code": "attendance",
          "developer_name": "ATTENDANCE",
          "model_type": "metadata",
          "stat_group": "overall"
        }
      },
      {
        "id": 2512067,
        "metadatable_id": 18804545,
        "type_id": 613,
        "value_type": "string",
        "values": "#FIOWHU",
        "type": {
          "id": 613,
          "name": "Hashtag",
          "code": "hashtag",
          "developer_name": "HASHTAG",
          "model_type": "metadata",
          "stat_group": null
        }
      }
    ]
  },
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The recommended way to obtain formations is via the formations include:

​​`https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=formations` more info can be found in our [Lineups and Formations tutorial](https://docs.sportmonks.com/v3/tutorials-and-guides/tutorials/lineups-and-formations).
{% endhint %}

{% hint style="danger" %}
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.
{% endhint %}

## Extra player information

Are you interested in building a complete player profile? With our [Player by ID endpoint](https://docs.sportmonks.com/v3/endpoints-and-entities/endpoints/players/get-player-by-id), you can do just that, but did you know that you can also obtain information about the preferred foot of players? Use the `metadata` for more info about a player:

{% tabs %}
{% tab title="Example request" %}

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript"><strong>https://api.sportmonks.com/v3/football/players/580?api_token=YOUR_TOKEN&#x26;include=metadata.type
</strong></code></pre>

{% endtab %}

{% tab title="Example response" %}

```javascript
{
  "data": {
    "id": 580,
    "sport_id": 1,
    "country_id": 20,
    "nationality_id": 20,
    "city_id": null,
    "position_id": 27,
    "detailed_position_id": 151,
    "type_id": 27,
    "common_name": "C. Ronaldo",
    "firstname": "Cristiano Ronaldo",
    "lastname": "dos Santos Aveiro",
    "name": "Cristiano Ronaldo dos Santos Aveiro",
    "display_name": "Cristiano Ronaldo",
    "image_path": "https://cdn.sportmonks.com/images/soccer/players/4/580.png",
    "height": 187,
    "weight": 83,
    "date_of_birth": "1985-02-05",
    "gender": "male",
    "metadata": [
      {
        "id": 145194,
        "metadatable_id": 580,
        "type_id": 229,
        "value_type": "string",
        "values": "right",
        "type": {
          "id": 229,
          "name": "Preferred Foot",
          "code": "preferred-foot",
          "developer_name": "PREFERRED_FOOT",
          "model_type": "metadata",
          "stat_group": null
        }
      }
    ]
  },
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
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.
{% endhint %}

## Extra topscorer details

Often players make transfers during the transfer winter period. Sometimes, they transfer to the same league. How do you know for which team they scored a certain number of goals?&#x20;

When using the `topscores` include on stages and seasons, you can now use the nested `topscorers.topscorer` include. This include shows more information about how the record was established. For a player, it shows for which individual teams the player scored goals which counted towards the total.

{% tabs %}
{% tab title="Example request" %}
{% code overflow="wrap" %}

```javascript
https://api.sportmonks.com/v3/football/seasons/19734?api_token=YOURTOKEN&filters=seasonTopscorerTypes:208&include=topscorers.topscorer
```

{% endcode %}
{% endtab %}

{% tab title="Example response" %}

```javascript
{
  "data": {
    "id": 19734,
    "sport_id": 1,
    "league_id": 8,
    "tie_breaker_rule_id": 1526,
    "name": "2022/2023",
    "finished": true,
    "pending": false,
    "is_current": true,
    "starting_at": "2022-08-05",
    "ending_at": "2023-05-28",
    "standings_recalculated_at": "2023-05-31 14:40:03",
    "games_in_current_week": false,
    "topscorers": [
      {
        "season_id": 19734,
        "player_id": 53,
        "type_id": 208,
        "position": 137,
        "total": 2,
        "participant_id": 65,
        "topscorer": [
          {
            "id": 20481836,
            "topscorer_id": 10678599,
            "participant_id": 65,
            "amount": 2
          }
        ]
      },
      {
        "season_id": 19734,
        "player_id": 165,
        "type_id": 208,
        "position": 261,
        "total": 1,
        "participant_id": 15,
        "topscorer": [
          {
            "id": 3219644,
            "topscorer_id": 1540153,
            "participant_id": 15,
            "amount": 1
          }
        ]
      },
      {
        "season_id": 19734,
        "player_id": 174,
        "type_id": 208,
        "position": 218,
        "total": 1,
        "participant_id": 42,
        "topscorer": [
          {
            "id": 3219579,
            "topscorer_id": 1540128,
            "participant_id": 42,
            "amount": 1
          }
        ]
      },
      {
        "season_id": 19734,
        "player_id": 336,
        "type_id": 208,
        "position": 224,
        "total": 1,
        "participant_id": 51,
        "topscorer": [
          {
            "id": 4436423,
            "topscorer_id": 2161272,
            "participant_id": 51,
            "amount": 1
          }
        ]
      },
   //and more!
```

{% endtab %}
{% endtabs %}
