⚽
API 3.0
OddsCoreFootball APIAPI 2 (Deprecated)WidgetsContact
Football API 3.0
Football API 3.0
  • Welcome
    • 🛬Welcome
    • 🙋‍♂️Getting Started
    • 🤓What can you do with Sportmonks' data?
    • 🆕Differences between API 2 and API 3
      • API Changes
      • Syntax and filters
      • New endpoints and data features
    • 🔐Authentication
    • 👶Making your first request
    • 🔧Best Practices
  • API coach (BETA)
  • Changelog
    • 📄Changelog
    • 📁Changelog (BETA)
  • API
    • 💡Request options
      • Includes
        • Nested includes
      • Selecting fields
      • Filtering
      • Selecting and filtering
      • Ordering and sorting
    • 🔤Syntax
    • ♾️Rate limit
    • 👀Meta description
    • 📔Error codes
      • Include Exceptions
      • Filtering and Complexity Exceptions
      • Other Exceptions
    • 📚Code libraries
    • Translations (beta)
    • Demo response files
    • Data corrections
    • API 2.0 (Deprecated)
  • Endpoints and Entities
    • Endpoints
      • 📡Livescores
        • GET Inplay Livescores
        • GET All Livescores
        • GET Latest Updated Livescores
      • 🥅Fixtures
        • GET All Fixtures
        • GET Fixture by ID
        • GET Fixtures by Multiple IDs
        • GET Fixtures by Date
        • GET Fixtures by Date Range
        • GET Fixtures by Date Range for Team
        • GET Fixtures by Head To Head
        • GET Fixtures by Search by Name
        • GET Upcoming Fixtures by Market ID
        • GET Upcoming Fixtures by TV Station ID
        • GET Past Fixtures by TV Station ID
        • GET Latest Updated Fixtures
      • 🛰️States
        • GET All States
        • GET State by ID
      • ⌨️Types
        • GET All Types
        • GET Type by ID
        • GET Type by Entity
      • 🏆Leagues
        • GET All Leagues
        • GET League by ID
        • GET Leagues by Live
        • GET Leagues by Fixture Date
        • GET Leagues by Country ID
        • GET Leagues Search by Name
        • GET All Leagues by Team ID
        • GET Current Leagues by Team ID
      • 🗓️Seasons
        • GET All Seasons
        • GET Seasons by ID
        • GET Seasons by Team ID
        • GET Seasons by Search by Name
      • 📊Statistics
        • GET Season Statistics by Participant
        • GET Stage Statistics by ID
        • GET Round Statistics by ID
      • 📅Schedules
        • GET Schedules by Season ID
        • GET Schedules by Team ID
        • GET Schedules by Season ID and Team ID
      • 🪜Stages
        • GET All Stages
        • GET Stage by ID
        • GET Stages by Season ID
        • GET Stages by Search by Name
      • 🔂Rounds
        • GET All Rounds
        • GET Round by ID
        • GET Rounds by Season ID
        • GET Rounds by Search by Name
      • 🔢Standings
        • GET All Standings
        • GET Standings by Season ID
        • GET Standings by Round ID
        • GET Standing Correction by Season ID
        • Get Live Standings by League ID
      • 🥇Topscorers
        • GET Topscorers by Season ID
        • GET Topscorers by Stage ID
      • 🏃Teams
        • GET All Teams
        • GET Team by ID
        • GET Teams by Country ID
        • GET Teams by Season ID
        • GET Teams by Search by Name
      • 🧑Players
        • GET All Players
        • GET Player by ID
        • GET Players by Country ID
        • GET Players by Search by Name
        • GET Last Updated Players
      • 🧑‍🦱Team Squads
        • GET Team Squad by Team ID
        • GET Extended Team Squad by Team ID
        • GET Team Squad by Team and Season ID
      • 👨‍🏫Coaches
        • GET All Coaches
        • GET Coach by ID
        • GET Coaches by Country ID
        • GET Coaches Search by Name
        • GET Last Updated Coaches
      • 🕴️Referees
        • GET All Referees
        • GET Referee by ID
        • GET Referees by Country ID
        • GET Referees by Season ID
        • GET Referees Search by Name
      • ↔️Transfers
        • GET All Transfers
        • GET Transfer by ID
        • GET Latest Transfers
        • GET Transfers Between Date Range
        • GET Transfers by Team ID
        • GET Transfers by Player ID
      • 🏟️Venues
        • GET All Venues
        • GET Venue by ID
        • GET Venues by Season ID
        • GET Venues by Search by Name
      • 📺TV Stations
        • GET All TV Stations
        • GET TV Station by ID
        • GET TV Stations by Fixture ID
      • 🔮Expected (xG)
        • GET Expected by Team
        • GET Expected by Player
      • 🔭Predictions
        • GET Probabilities
        • GET Predictability by League ID
        • GET Probabilities by Fixture ID
        • GET Value Bets
        • GET Value Bets by Fixture ID
      • 🧙Standard Odds Feed
        • 👓Pre-match Odds
          • GET All Odds
          • Get Odds by Fixture ID
          • GET Odds by Fixture ID and Bookmaker ID
          • GET Odds by Fixture ID and Market ID
          • GET Last Updated Odds
        • 🧠Inplay Odds
          • GET All Inplay Odds
          • GET Inplay Odds by Fixture ID
          • GET Inplay Odds by Fixture ID and Bookmaker ID
          • GET Inplay Odds by Fixture ID and Market ID
          • GET Last Updated Inplay Odds
      • 🧙‍♂️Premium Odds Feed
        • 🕶️Premium Pre-match Odds
          • GET All Premium Odds
          • Get Premium Odds by Fixture ID
          • GET Premium Odds by Fixture ID and Bookmaker ID
          • GET Premium Odds by Fixture ID and Market ID
          • GET Updated Premium Odds Between Time Range
          • GET Updated Historical Odds Between Time Range
          • GET All Historical Odds
      • 🛒Markets
        • GET All Markets
        • GET All Premium Markets
        • GET Market by ID
        • GET Market by Search
      • 📑Bookmakers
        • GET All Bookmakers
        • GET All Premium Bookmakers
        • GET Bookmaker by ID
        • GET Bookmaker by Search
        • GET Bookmaker by Fixture ID
      • 📰News
        • GET Pre-Match News
        • GET Pre-Match News by Season ID
        • GET Pre-Match News for Upcoming Fixtures
        • GET Post-Match News
        • GET Post-Match News by Season ID
      • ⚔️Rivals
        • GET All Rivals
        • GET Rivals by Team ID
      • 🎙️Commentaries
        • GET All Commentaries
        • GET Commentaries by Fixture ID
    • Entities
      • 🥅Fixture
      • 🏆League, Season, Schedule, Stage and Round
      • 🧑‍🤝‍🧑Team, Player, Squad, Coach and Referee
      • 🔢Statistic
      • 🔮Expected
      • 🥇Standing and Topscorer
      • 🔭Odd and Prediction
      • Other
  • Tutorials and Guides
    • Tutorials
      • Introduction
        • Make your first request
        • Set your time zone
        • Pagination
      • Enrich your response
        • Nested includes
          • Syntax and relations
      • Includes
        • Events
        • States
        • Periods
        • Scores
        • Participants
        • Lineups
        • ballCoordinates
        • Pressure Index
        • Tips and tricks
      • Filter and select fields
        • Selecting fields
        • Filtering
        • Selecting and filtering
      • Leagues and seasons
        • Leagues
        • Seasons
      • Season schedule
        • Schedules
        • Stages
        • Rounds
      • Livescores and fixtures
        • Livescores
        • Fixtures
      • Lineups and formations
      • Statistics
        • Statistics types
        • Season statistics
        • Fixture statistics
        • Team statistics
        • Players statistics
      • Teams, players, coaches and referees
        • Teams
        • Players
        • Coaches
        • Referees
      • Standings
        • Season standings
        • Topscorer standings
      • Odds and predictions
        • Bookmakers
        • Markets
        • Pre-match odds
        • Live(Inplay) odds
        • hasOdds
        • Predictions
          • Probabilities
          • Value Bet
      • Expected
        • Endpoints
        • Includes
        • Coverage
      • News
        • Pre-match News
        • Post-match News
      • Placeholders
      • Timezone parameters on different endpoints
    • Guides
      • How-to use components
      • How-to use the Football API with Postman
      • How-to use the Football API tester
      • How-to use the Football API ID finder
      • How-to build a livescore website
      • How-to use the Predictions API
      • How-to build a match page
      • How-to build a custom plan
      • How-to build a match page with odds
      • How-to use xG data
      • How-to build a news website
      • How-to build a fantasy game guide
      • How-to use the new Champions League data
      • How-to build your World Cup application
      • How-to build a team page
      • How-to keep your database in SYNC
      • How-to use team mode in MySportmonks
    • Programming languages
      • A developers guide: Unleashing the power of the football API with JSON
      • A developers guide: Unleashing the power of the football API with PHP
      • A developers guide: Unleashing the power of the football API with Python
  • Definitions
    • 📔Response Codes
    • 🛰️States
    • ⌨️Types
      • Lineups, positions and formations
      • Events
      • Statistics
        • Coach statistics
        • Referee statistics
        • Stage statistics
        • Season statistics
        • Fixture statistics
        • Team statistics
        • Player statistics
      • Expected
      • Leagues and stages
      • Standings
      • Transfers
      • Highlights
      • Weather and pitch
  • FAQ
    • API 3.0
    • Odds
    • Integration
    • Sportmonks
  • Quicklinks
    • Postman
    • ID Finder
    • Sportmonks
    • MySportmonks
    • Football widgets
    • Plans and Pricing
    • Data features
    • FAQ
Powered by GitBook
On this page
  • Field selection
  • Only select a specific field
  • Select a specific field on an include

Was this helpful?

  1. Tutorials and Guides
  2. Tutorials
  3. Filter and select fields

Selecting fields

PreviousFilter and select fieldsNextFiltering

Last updated 1 year ago

Was this helpful?

Field selection

API 3.0 introduces the possibility to request specific fields on entities. This possibility comes in handy when you only use particular fields in an API response. The advantage of selecting specific fields is that it reduces the response speed in mainly large responses. In addition to reducing response time, the response size can also be drastically reduced. Let's take a look together at an example.

Only select a specific field

One of our new additions to API 3.0 is a name field on the fixtures. The name field contains a textual representation of the participants playing the fixture. Without selecting a specific field, the API request and response would look like this:

https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN
Response
{
  "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-02-17 10:19:55",
    "has_odds": true,
    "starting_at_timestamp": 1662204600
  },

As you can see, the API response is rather large if you're only interested in the fixture's name. Let's select that API field to reduce the response length and size.

We're using the fixtures endpoint. This means we can select on all the fields of the You can do this by adding &select={specific fields on the base entity}.

In our example, this would result in the below API request and response:

https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&select=name
Response
{
  "data": {
    "name": "Celtic vs Rangers",
    "id": 18535517,
    "sport_id": 1,
    "round_id": 274719,
    "stage_id": 77457866,
    "group_id": null,
    "aggregate_id": null,
    "league_id": 501,
    "season_id": 19735,
    "venue_id": 8909,
    "state_id": 5,
    "starting_at_timestamp": null
  },

As you can see in the example response above, the 'name' field is only returned for the fixture.

Please note that the fields that have relations are also automatically included for technical reasons.

Select a specific field on an include

You can also use field selection based on includes. Imagine you want to access fixture lineup information from Celtic vs Rangers (fixture id: 18535517). Additional to the lineups, you also wish to receive the display names, player images and country details.

Please note that we only copied the first players in the lineup in the below examples

Without selecting specific fields, you will receive a lot of information you don't need. The API request and partial API response would look like this:

https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=lineups.player;lineups.player.country
Response
{
  "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-02-17 10:19:55",
    "has_odds": true,
    "starting_at_timestamp": 1662204600,
    "lineups": [
      {
        "id": 296138906,
        "sport_id": 1,
        "fixture_id": 18535517,
        "player_id": 275,
        "team_id": 53,
        "position_id": 24,
        "formation_field": "1:1",
        "type_id": 11,
        "formation_position": 1,
        "player_name": "Joe Hart",
        "jersey_number": 1,
        "player": {
          "id": 275,
          "sport_id": 1,
          "country_id": 462,
          "nationality_id": 462,
          "city_id": null,
          "position_id": 24,
          "detailed_position_id": 24,
          "type_id": 24,
          "common_name": "J. Hart",
          "firstname": "Joe",
          "lastname": "Hart",
          "name": "Joe Hart",
          "display_name": "Joe Hart",
          "image_path": "https://cdn.sportmonks.com/images/soccer/players/19/275.png",
          "height": 196,
          "weight": 91,
          "date_of_birth": "1987-04-19",
          "gender": "male",
          "country": {
            "id": 462,
            "continent_id": 1,
            "name": "United Kingdom",
            "official_name": "United Kingdom of Great Britain and Northern Ireland",
            "fifa_name": "ENG,NIR,SCO,WAL",
            "iso2": "GB",
            "iso3": "GBR",
            "latitude": "54.56088638305664",
            "longitude": "-2.2125117778778076",
            "borders": [
              "IRL"
            ],
            "image_path": "https://cdn.sportmonks.com/images/countries/png/short/gb.png"
          }
        }
      },
      {
        "id": 296138902,
        "sport_id": 1,
        "fixture_id": 18535517,
        "player_id": 173080,
        "team_id": 53,
        "position_id": 25,
        "formation_field": "2:4",
        "type_id": 11,
        "formation_position": 5,
        "player_name": "Greg Taylor",
        "jersey_number": 3,
        "player": {
          "id": 173080,
          "sport_id": 1,
          "country_id": 1161,
          "nationality_id": 1161,
          "city_id": null,
          "position_id": 25,
          "detailed_position_id": 155,
          "type_id": 25,
          "common_name": "G. Taylor",
          "firstname": "Greg",
          "lastname": "Taylor",
          "name": "Greg Taylor",
          "display_name": "Greg Taylor",
          "image_path": "https://cdn.sportmonks.com/images/soccer/players/24/173080.png",
          "height": 173,
          "weight": null,
          "date_of_birth": "1997-11-05",
          "gender": "male",
          "country": {
            "id": 1161,
            "continent_id": 1,
            "name": "Scotland",
            "official_name": "United Kingdom of Great Britain and Northern Ireland",
            "fifa_name": "ENG,NIR,SCO,WAL",
            "iso2": "GB",
            "iso3": "GBR",
            "latitude": "54.56088638305664",
            "longitude": "-2.2125117778778076",
            "borders": [
              "IRL"
            ],
            "image_path": "https://cdn.sportmonks.com/images/countries/png/short/gb.png"
          }
        }
      },
      //And more!

Now, let's select specific fields on the base entities used.

The second base entity is countries. Just like on the player entity, we can select on all the fields of the countries entity. In our example, you need to select name and image_path.

The new API request and partial API response would look like this:

https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=lineups.player:display_name,image_path;lineups.player.country:name,image_path
Response
{
  "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-02-17 10:19:55",
    "has_odds": true,
    "starting_at_timestamp": 1662204600,
    "lineups": [
      {
        "id": 296138906,
        "sport_id": 1,
        "fixture_id": 18535517,
        "player_id": 275,
        "team_id": 53,
        "position_id": 24,
        "formation_field": "1:1",
        "type_id": 11,
        "formation_position": 1,
        "player_name": "Joe Hart",
        "jersey_number": 1,
        "player": {
          "id": 275,
          "country_id": 462,
          "sport_id": 1,
          "city_id": null,
          "position_id": 24,
          "detailed_position_id": 24,
          "nationality_id": 462,
          "display_name": "Joe Hart",
          "image_path": "https://cdn.sportmonks.com/images/soccer/players/19/275.png",
          "country": {
            "id": 462,
            "continent_id": 1,
            "name": "United Kingdom",
            "image_path": "https://cdn.sportmonks.com/images/countries/png/short/gb.png"
          }
        }
      },
      {
        "id": 296138902,
        "sport_id": 1,
        "fixture_id": 18535517,
        "player_id": 173080,
        "team_id": 53,
        "position_id": 25,
        "formation_field": "2:4",
        "type_id": 11,
        "formation_position": 5,
        "player_name": "Greg Taylor",
        "jersey_number": 3,
        "player": {
          "id": 173080,
          "country_id": 1161,
          "sport_id": 1,
          "city_id": null,
          "position_id": 25,
          "detailed_position_id": 155,
          "nationality_id": 1161,
          "display_name": "Greg Taylor",
          "image_path": "https://cdn.sportmonks.com/images/soccer/players/24/173080.png",
          "country": {
            "id": 1161,
            "continent_id": 1,
            "name": "Scotland",
            "image_path": "https://cdn.sportmonks.com/images/countries/png/short/gb.png"
          }
        }
      },
      //and more

See how the size of the response is reduced? Next to selecting specific fields on the base entity or includes, it’s possible to filter your request. Check the next section for more info.

Since we're using the lineups.player include, the first base entity is . We can select on all the fields of that entity. In our example, you need to select display_name and image_path.

players
fixtures entity.