Teams

Every country, league, and season has multiple teams included. The team endpoints are important to show the teams, team stats, and other team data.

This section will briefly discuss all the options available to request teams.

An overview of all the options available:

  • GET All Teams: returns all the teams that are accessible within your subscription.

  • GET Team by ID: returns the single team you’ve requested by id.

  • GET Team by Country ID: returns all the teams from your requested country id.

  • GET Team by Season ID: returns all the teams from your requested season id.

  • GET Team Search by Name: returns all the teams that match your search query.

  • GET Team Current Leagues by ID: returns all the current leagues from your requested team id.

  • GET Team All Leagues by ID: returns all the current and historical leagues from your requested team id.

The base URL is the same for all team endpoints:

https://api.sportmonks.com/v3/football/teams

Per endpoint, the rest of the URL requires additional information. We will explain this per endpoint.

Requesting Teams

GET All Teams

To get your database filled with all teams in your subscription, you can gather all teams via the GET All Teams endpoint. The URL to get all your teams is the same as the base URL for teams. All you have to do is authorize the request with your API token. Check our authentication section for more info.

https://api.sportmonks.com/v3/football/teams?api_token=YOUR_TOKEN
Response
{
  "data": [
    {
      "id": 53,
      "sport_id": 1,
      "country_id": 1161,
      "venue_id": 8909,
      "gender": "male",
      "name": "Celtic",
      "short_code": "CEL",
      "image_path": "https://cdn.sportmonks.com/images/soccer/teams/21/53.png",
      "founded": 1888,
      "type": "domestic",
      "placeholder": false,
      "last_played_at": "2023-02-26 15:00:00"
    },
    {
      "id": 62,
      "sport_id": 1,
      "country_id": 1161,
      "venue_id": 8914,
      "gender": "male",
      "name": "Rangers",
      "short_code": "RAN",
      "image_path": "https://cdn.sportmonks.com/images/soccer/teams/30/62.png",
      "founded": 1873,
      "type": "domestic",
      "placeholder": false,
      "last_played_at": "2023-02-26 15:00:00"
    },
    //and more

Let’s take a look together at what the API returns. As you can see, the API returns all the teams available in the free plan.

You can see the team id, country id, venue id, gender, name, shortcode and image. You can see details about when the club was founded and played its last match.

Now that you've requested all the teams, you also know their unique team id. You can use this id in the second option: GET Team by ID.

GET Teams by ID

This endpoint is useful if you only want information about one particular team. You need to add the team_id to your request:

https://api.sportmonks.com/v3/football/teams/{team_id}

For example, if you’re interested in information about Celtic (team id: 53).

https://api.sportmonks.com/v3/football/teams/53?api_token=YOUR_TOKEN
Response
{
  "data": {
    "id": 53,
    "sport_id": 1,
    "country_id": 1161,
    "venue_id": 8909,
    "gender": "male",
    "name": "Celtic",
    "short_code": "CEL",
    "image_path": "https://cdn.sportmonks.com/images/soccer/teams/21/53.png",
    "founded": 1888,
    "type": "domestic",
    "placeholder": false,
    "last_played_at": "2023-02-26 15:00:00"
  },

Easy isn’t it? You can now request information per team. Now let’s imagine you want an overview of all the teams in a specific country. The GET Teams by Country ID option could be just the endpoint you’re looking for.

GET Teams by Country ID

This endpoint is useful if you only want information about teams from a specific country. You need to add the country_id to your request:

https://api.sportmonks.com/v3/football/teams/countries/{country_id}

For example, if you’re interested in all available Scottish teams in your subscription. (team id: 1161).

https://api.sportmonks.com/v3/football/teams/countries/1161?api_token=YOUR_TOKEN
Response
{
  "data": [
    {
      "id": 53,
      "sport_id": 1,
      "country_id": 1161,
      "venue_id": 8909,
      "gender": "male",
      "name": "Celtic",
      "short_code": "CEL",
      "image_path": "https://cdn.sportmonks.com/images/soccer/teams/21/53.png",
      "founded": 1888,
      "type": "domestic",
      "placeholder": false,
      "last_played_at": "2023-02-26 15:00:00"
    },
    {
      "id": 734,
      "sport_id": 1,
      "country_id": 1161,
      "venue_id": 219,
      "gender": "male",
      "name": "St. Johnstone",
      "short_code": "STJ",
      "image_path": "https://cdn.sportmonks.com/images/soccer/teams/30/734.png",
      "founded": 1885,
      "type": "domestic",
      "placeholder": false,
      "last_played_at": "2023-02-25 15:00:00"
    },

GET Teams by Season ID

The fourth option is to retrieve all teams from a specific season. This endpoint is useful if you want team information about current or historical seasons. You need to add the season_id to your request:

https://api.sportmonks.com/v3/football/teams/seasons/{season_id}

For example, if you’re interested in all the teams participating in the 2022/2023 Scottish Premiership. (season id: 19735).

https://api.sportmonks.com/v3/football/teams/seasons/19735?api_token=YOUR_TOKEN
Response
{
  "data": [
    {
      "id": 309,
      "sport_id": 1,
      "country_id": 1161,
      "venue_id": 8922,
      "gender": "male",
      "name": "Motherwell",
      "short_code": "MOT",
      "image_path": "https://cdn.sportmonks.com/images/soccer/teams/21/309.png",
      "founded": 1886,
      "type": "domestic",
      "placeholder": false,
      "last_played_at": "2023-02-25 15:00:00"
    },
    {
      "id": 180,
      "sport_id": 1,
      "country_id": 1161,
      "venue_id": 8906,
      "gender": "male",
      "name": "Kilmarnock",
      "short_code": "KIL",
      "image_path": "https://cdn.sportmonks.com/images/soccer/teams/20/180.png",
      "founded": 1869,
      "type": "domestic",
      "placeholder": false,
      "last_played_at": "2023-02-25 15:00:00"
    },
    
  //And more

GET Teams Search by Name

This endpoint returns all the teams based on your search query. This might come in handy if you cannot find a team. To search on a team name, you’ll need to add /search/{search_query} to the teams base URL:

https://api.sportmonks.com/v3/football/teams/search/{search_query}

For example, if you could not find Celtic:

https://api.sportmonks.com/v3/football/teams/search/Celtic?api_token=YOUR_TOKEN
Response
{
  "data": [
    {
      "id": 53,
      "sport_id": 1,
      "country_id": 1161,
      "venue_id": 8909,
      "gender": "male",
      "name": "Celtic",
      "short_code": "CEL",
      "image_path": "https://cdn.sportmonks.com/images/soccer/teams/21/53.png",
      "founded": 1888,
      "type": "domestic",
      "placeholder": false,
      "last_played_at": "2023-02-26 15:00:00"
    }
  ],

The more complete your search query is, the more relevant response you’ll get.

Adding useful information

As you’ve learnt in the includes tutorial, you can enrich your request with includes. This section will discuss some of the most common requests on the teams’ endpoints.

First of all, you can find a list of all available includes on the endpoint pages. For teams the most common includes are: players, seasons, statistics and sidelined.

For example, if you’re interested in all the statistics of Celtic (team id: 53)

https://api.sportmonks.com/v3/football/teams/53?api_token=YOUR_TOKEN&include=statistics.details.type
Response
{
  "data": {
    "id": 53,
    "sport_id": 1,
    "country_id": 1161,
    "venue_id": 8909,
    "gender": "male",
    "name": "Celtic",
    "short_code": "CEL",
    "image_path": "https://cdn.sportmonks.com/images/soccer/teams/21/53.png",
    "founded": 1888,
    "type": "domestic",
    "placeholder": false,
    "last_played_at": "2023-02-26 15:00:00",
    "statistics": [
      {
        "id": 38080,
        "team_id": 53,
        "season_id": 718,
        "has_values": true,
        "details": [
          {
            "id": 345190,
            "team_statistic_id": 38080,
            "type_id": 194,
            "value": {
              "all": {
                "count": 1,
                "percentage": 8.33
              },
              "home": {
                "count": 1,
                "percentage": 100
              },
              "away": {
                "count": 0,
                "percentage": 0
              }
            },
            "type": {
              "id": 194,
              "name": "Cleansheets",
              "code": "cleansheets",
              "developer_name": "CLEANSHEET",
              "model_type": "statistic",
              "stat_group": null
            }
          },

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.

Selecting and filtering

In our filtering tutorial, you’ve learnt how to select specific fields or filter only on the data you’re interested in. Our API returns a set of data related to the team by default. We imagine you’re not interested in all the team data the API returns. Let’s say you’re only interested in the team name and logo of Celtic.

You can add the &select= parameter followed by the fields you want. In our case: &select=name,image_path. This results in the below request and response:

https://api.sportmonks.com/v3/football/teams/53?api_token=YOUR_TOKEN&select=name,image_path
Response
{
  "data": {
    "name": "Celtic",
    "image_path": "https://cdn.sportmonks.com/images/soccer/teams/21/53.png",
    "id": 53,
    "sport_id": 1,
    "country_id": 1161,
    "venue_id": 8909
  },

Check our filtering tutorial for more information and tips.

Last updated