⚽
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
  • Syntax
  • Filters
  • Select the fields you need
  • Custom Sorting
  • Usage
  • Examples

Was this helpful?

  1. Welcome
  2. Differences between API 2 and API 3

Syntax and filters

PreviousAPI ChangesNextNew endpoints and data features

Last updated 1 year ago

Was this helpful?

Syntax

The syntax for filtering and including works differently from API V2. The syntax is used across all endpoints: the documentation for each endpoint describes the exceptions regarding exclusions of some fields/relations. Find out everything about the new .

Filters

The filter system changed compared to the previous version. You can now select specific fields on the base entity or includes, and it’s possible to filter your request. Below is a fixture shown with events.

Example Fixture with Events
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=events
{
  "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,
    "events": [
      {
        "id": 42683644,
        "fixture_id": 18535517,
        "period_id": 4296154,
        "participant_id": 53,
        "type_id": 18,
        "section": "event",
        "player_id": 3298,
        "related_player_id": 10966261,
        "player_name": "Aaron Mooy",
        "related_player_name": "R. Hatate",
        "result": null,
        "info": null,
        "addition": null,
        "minute": 73,
        "extra_minute": null,
        "injured": false,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": null
      },
      {
        "id": 42683195,
        "fixture_id": 18535517,
        "period_id": 4296154,
        "participant_id": 53,
        "type_id": 18,
        "section": "event",
        "player_id": 319282,
        "related_player_id": 9939171,
        "player_name": "Daizen Maeda",
        "related_player_name": "L. Abada",
        "result": null,
        "info": null,
        "addition": null,
        "minute": 73,
        "extra_minute": null,
        "injured": false,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": null
      },
      {
        "id": 42703418,
        "fixture_id": 18535517,
        "period_id": 4296154,
        "participant_id": 62,
        "type_id": 19,
        "section": "event",
        "player_id": 2927,
        "related_player_id": null,
        "player_name": "Connor Goldson",
        "related_player_name": null,
        "result": null,
        "info": "Foul",
        "addition": "6th Yellow Card",
        "minute": 90,
        "extra_minute": null,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": null
      },
      {
        "id": 42688034,
        "fixture_id": 18535517,
        "period_id": 4296154,
        "participant_id": 62,
        "type_id": 18,
        "section": "event",
        "player_id": 1452870,
        "related_player_id": 3387,
        "player_name": "F. Sakala",
        "related_player_name": "Ryan Kent",
        "result": null,
        "info": null,
        "addition": null,
        "minute": 78,
        "extra_minute": null,
        "injured": false,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": null
      },
//And more      

As you can see in the response, you will receive all match events. But what if you’re only interested in a specific event like goals, cards or substitutions? You can filter on the specific data you're interested in. The URL now includes a &filters query parameter that shows the entity you want to filter on and the IDs you want to see in your results.

Example Fixture with Filtered Goal Events
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=events&filters=eventTypes:14
{
  "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,
    "events": [
      {
        "id": 42688040,
        "fixture_id": 18535517,
        "period_id": 4296154,
        "participant_id": 53,
        "type_id": 14,
        "section": "event",
        "player_id": 173160,
        "related_player_id": null,
        "player_name": "David Turnbull",
        "related_player_name": null,
        "result": "4-0",
        "info": "Shot",
        "addition": "4th Goal",
        "minute": 78,
        "extra_minute": null,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": null
      },
      {
        "id": 42646477,
        "fixture_id": 18535517,
        "period_id": 4295921,
        "participant_id": 53,
        "type_id": 14,
        "section": "event",
        "player_id": 9939171,
        "related_player_id": null,
        "player_name": "L. Abada",
        "related_player_name": null,
        "result": "1-0",
        "info": "Shot",
        "addition": "1st Goal",
        "minute": 8,
        "extra_minute": null,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": null
      },
      //And more

So, we already explained how to use filters and how to filter on one particular ID. But what if you're interested in filtering on multiple IDs? That is also possible! You can use filters on multiple IDs.

Example Fixture with Filtered Events on multiple IDs
https://api.sportmonks.com/v3/football/fixtures/18842556?api_token=YOUR_TOKEN&include=events.type&filters=eventTypes:14,18
{
  "data": {
    "id": 18842556,
    "sport_id": 1,
    "league_id": 8,
    "season_id": 21646,
    "stage_id": 77464011,
    "group_id": null,
    "aggregate_id": null,
    "round_id": 307169,
    "state_id": 5,
    "venue_id": 230,
    "name": "Liverpool vs Manchester City",
    "starting_at": "2024-03-10 15:45:00",
    "result_info": "Game ended in draw.",
    "leg": "1/1",
    "details": null,
    "length": 90,
    "placeholder": false,
    "has_odds": true,
    "starting_at_timestamp": 1710085500,
    "events": [
      {
        "id": 108388309,
        "fixture_id": 18842556,
        "period_id": 5277498,
        "participant_id": 9,
        "type_id": 14,
        "section": "event",
        "player_id": 982,
        "related_player_id": 1371,
        "player_name": "John Stones",
        "related_player_name": "Kevin De Bruyne",
        "result": "0-1",
        "info": "Shot",
        "addition": "1st Goal",
        "minute": 23,
        "extra_minute": null,
        "injured": null,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1522,
        "type": {
          "id": 14,
          "name": "Goal",
          "code": "goal",
          "developer_name": "GOAL",
          "model_type": "event",
          "stat_group": null
        }
      },
      {
        "id": 108406572,
        "fixture_id": 18842556,
        "period_id": 5277705,
        "participant_id": 8,
        "type_id": 18,
        "section": "event",
        "player_id": 30062,
        "related_player_id": 6013424,
        "player_name": "Cody Gakpo",
        "related_player_name": "Darwin Núñez",
        "result": null,
        "info": null,
        "addition": null,
        "minute": 76,
        "extra_minute": null,
        "injured": false,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1523,
        "type": {
          "id": 18,
          "name": "Substitution",
          "code": "substitution",
          "developer_name": "SUBSTITUTION",
          "model_type": "event",
          "stat_group": null
        }
      },
      {
        "id": 108400368,
        "fixture_id": 18842556,
        "period_id": 5277705,
        "participant_id": 9,
        "type_id": 18,
        "section": "event",
        "player_id": 34594,
        "related_player_id": 159142,
        "player_name": "Stefan Ortega",
        "related_player_name": "Ederson",
        "result": null,
        "info": null,
        "addition": null,
        "minute": 56,
        "extra_minute": null,
        "injured": true,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1524,
        "type": {
          "id": 18,
          "name": "Substitution",
          "code": "substitution",
          "developer_name": "SUBSTITUTION",
          "model_type": "event",
          "stat_group": null
        }
      },
      {
        "id": 108405790,
        "fixture_id": 18842556,
        "period_id": 5277705,
        "participant_id": 8,
        "type_id": 18,
        "section": "event",
        "player_id": 1078,
        "related_player_id": 37316835,
        "player_name": "Andrew Robertson",
        "related_player_name": "Conor Bradley",
        "result": null,
        "info": null,
        "addition": null,
        "minute": 61,
        "extra_minute": null,
        "injured": false,
        "on_bench": false,
        "coach_id": null,
        "sub_type_id": 1523,
        "type": {
          "id": 18,
          "name": "Substitution",
          "code": "substitution",
          "developer_name": "SUBSTITUTION",
          "model_type": "event",
          "stat_group": null
        }
      },

Select the fields you need

: can be used for filtering the fields you want to see in the response. For example, you only want the name of a certain team. In this case you need to use participants:name.

Custom Sorting

You can use custom sorts on endpoints; this enables the sorting of base entities returned in the endpoint responses. This feature is designed to enhance flexibility and customisation for users interacting with the API.

Usage

This provides users with the ability to customise sorting of returned data through the use of the sortBy and order parameters. This functionality is particularly useful when retrieving lists of fixtures in football, as it allows users to organise the data based on specific criteria.

Sorting Fixtures

When querying fixtures, users can specify the field to sort by and the desired order using the following parameters:

  • sortBy: Specifies the field by which the data will be sorted. Currently supported fields include starting_at and name.

  • order: Determines the order in which the data will be sorted. Users can choose between ascending (asc) and descending (desc) orders.

Examples

Sort by starting_at: This option sorts the fixtures based on their starting date and time.

https://api.sportmonks.com/v3/football/fixtures&sortBy=starting_at&order=desc

This URL sorts the fixtures in descending order of their starting date and time.

Sort by name: This option sorts the fixtures alphabetically based on their names.

https://api.sportmonks.com/v3/football/fixtures&sortBy=name&order=asc

This URL sorts the fixtures alphabetically by their names in ascending order.

Sorting on the name field currently works for all entities with a "name" field. For Fixtures, sorting also works on the starting_at field.

If an unsupported field is passed to sort on, an error is thrown, and the request returns a 400 Bad Request HTTP code.

More information and a more detailed explanation are covered on our

You can request only the fields you need by using the new . Filters can filter the data based on the fields you would like to display in your application.

A more detailed explanation is covered on our

🆕
syntax
request options page.
syntax
request options page