Documentation

  • Version: 1.0.2
  • Created: 2019-01-08
  • Latest Update: 2019-01-08

Countries


Method

GET apifootball.com/api/?action=get_countries

Returns list of supported countries included in your current subscription plan


Parameters

Parameter Description
action API method name
APIkey Authorization code generated from your apifootball account

Request URL


JSON Response

[
    {
        "country_id":"169",
        "country_name":"England"
    },
    {
        "country_id":"170",
        "country_name":"Italy"
    },
    {
        "country_id":"171",
        "country_name":"Spain"
    },
    {
        "country_id":"172",
        "country_name":"Germany"
    },
    {
        "country_id":"173",
        "country_name":"France"
    },
    {
        "country_id":"174",
        "country_name":"Netherlands"
    },
    {
        "country_id":"175",
        "country_name":"Belgium"
    },
    {
        "country_id":"176",
        "country_name":"Portugal"
    },
    {
        "country_id":"177",
        "country_name":"Scotland"
    },
    ....
]
            

PHP call example


$APIkey='xxxxxxxxxxxxxx';

$curl_options = array(
  CURLOPT_URL => "https://apifootball.com/api/?action=get_countries&APIkey=$APIkey",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );

$result = (array) json_decode($result);

var_dump($result);

            

Competitions


Method

GET apifootball.com/api/?action=get_leagues

Returns list of supported competitions included in your current subscription plan


Parameters

Parameter Description
action API method name
APIkey Authorization code generated from your apifootball account
country_id Country ID - if set only leagues from specific country will be returned (Optional)

Request URL


JSON Response

[
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"62",
        "league_name":"Premier League"
    },
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"65",
        "league_name":"League 2"
    },
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"66",
        "league_name":"Nat. League"
    },
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"67",
        "league_name":"Nat. League North"
    },
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"68",
        "league_name":"Nat. League South"
    },
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"69",
        "league_name":"FA Cup"
    },
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"70",
        "league_name":"Capital One Cup"
    },
    {
        "country_id":"169",
        "country_name":"England",
        "league_id":"71",
        "league_name":"Community Shield"
    },
    ....
]
            

PHP call example


$APIkey='xxxxxxxxxxxxxx';
$country_id = 169;

$curl_options = array(
  CURLOPT_URL => "https://apifootball.com/api/?action=get_leagues&country_id=$country_id&APIkey=$APIkey",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );

$result = (array) json_decode($result);

var_dump($result);

            

Standings


Method

GET apifootball.com/api/?action=get_standings

Returns standings for leagues included in your current subscription plan


Parameters

Parameter Description
action API method name
APIkey Authorization code generated from your apifootball account
league_id League internal code

Request URL


JSON Response

[
    {
        "country_name":"England",
        "league_id":"62",
        "league_name":"Premier League",
        "team_name":"Arsenal",
        "overall_league_position":"4",
        "overall_league_payed":"11",
        "overall_league_W":"7",
        "overall_league_D":"3",
        "overall_league_L":"1",
        "overall_league_GF":"24",
        "overall_league_GA":"11",
        "overall_league_PTS":"24",
        "home_league_position":"7",
        "home_league_payed":"6",
        "home_league_W":"3",
        "home_league_D":"2",
        "home_league_L":"1",
        "home_league_GF":"12",
        "home_league_GA":"8",
        "home_league_PTS":"11",
        "away_league_position":"1",
        "away_league_payed":"5",
        "away_league_W":"4",
        "away_league_D":"1",
        "away_league_L":"0",
        "away_league_GF":"12",
        "away_league_GA":"3",
        "away_league_PTS":"13"
    },
    ....
]
            

PHP call example


$APIkey='xxxxxxxxxxxxxx';
$league_id = 62;

$curl_options = array(
  CURLOPT_URL => "https://apifootball.com/api/?action=get_standings&league_id=$league_id&APIkey=$APIkey",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );

$result = (array) json_decode($result);

var_dump($result);
?>

            

Events (Results / Fixtures)


Method

GET apifootball.com/api/?action=get_events

Returns events included in your current subscription plan


Parameters

Parameter Description
action API method name
APIkey Authorization code generated from your apifootball account
from Start date (yyyy-mm-dd)
to Stop date (yyyy-mm-dd)
country_id Country ID - if set only leagues from specific country will be returned (Optional)
league_id League ID - if set events from specific league will be returned (Optional)
match_id Match ID - if set only details from specific match will be returned (Optional)

Request URL


JSON Response

 [
  {
    "match_id": "277488",
    "country_id": "170",
    "country_name": "Italy",
    "league_id": "79",
    "league_name": "Serie A",
    "match_date": "2018-04-22",
    "match_status": "FT",
    "match_time": "15:00",
    "match_hometeam_name": "Juventus",
    "match_hometeam_score": "0",
    "match_awayteam_name": "SSC Napoli",
    "match_awayteam_score": "1",
    "match_hometeam_halftime_score": "0",
    "match_awayteam_halftime_score": "0",
    "match_hometeam_extra_score": "",
    "match_awayteam_extra_score": "",
    "match_hometeam_penalty_score": "",
    "match_awayteam_penalty_score": "",
    "match_hometeam_system": "4-3-2-1",
    "match_awayteam_system": "4-3-3",
    "match_live": "1",
    "goalscorer": [
      {
        "time": "90'",
        "home_scorer": "",
        "score": "0 - 1",
        "away_scorer": "K.  Kalidou Koulibaly"
      }
    ],
    "cards": [
      {
        "time": "9'",
        "home_fault": "M.  Medhi Benatia",
        "card": "yellowcard",
        "away_fault": ""
      },
      {
        "time": "10'",
        "home_fault": "K.  Kwadwo Asamoah",
        "card": "yellowcard",
        "away_fault": ""
      },
      {
        "time": "16'",
        "home_fault": "",
        "card": "yellowcard",
        "away_fault": "R.  Raul Albiol"
      },
      {
        "time": "27'",
        "home_fault": "M.  Miralem Pjanic",
        "card": "yellowcard",
        "away_fault": ""
      }
    ],
    "lineup": {
      "home": {
        "starting_lineups": [
          {
            "lineup_player": "Gianluigi Buffon",
            "lineup_number": "1",
            "lineup_position": "1"
          },
          {
            "lineup_player": "Giorgio Chiellini",
            "lineup_number": "3",
            "lineup_position": "2"
          },
          {
            "lineup_player": "Medhi Benatia",
            "lineup_number": "4",
            "lineup_position": "3"
          },
          {
            "lineup_player": "Benedikt Hoewedes",
            "lineup_number": "21",
            "lineup_position": "4"
          },
          {
            "lineup_player": "Kwadwo Asamoah",
            "lineup_number": "22",
            "lineup_position": "5"
          },
          {
            "lineup_player": "Sami Khedira",
            "lineup_number": "6",
            "lineup_position": "6"
          },
          {
            "lineup_player": "Miralem Pjanic",
            "lineup_number": "5",
            "lineup_position": "7"
          },
          {
            "lineup_player": "Blaise Matuidi",
            "lineup_number": "14",
            "lineup_position": "8"
          },
          {
            "lineup_player": "Douglas Costa",
            "lineup_number": "11",
            "lineup_position": "9"
          },
          {
            "lineup_player": "Paulo Dybala",
            "lineup_number": "10",
            "lineup_position": "10"
          },
          {
            "lineup_player": "Gonzalo Higuain",
            "lineup_number": "9",
            "lineup_position": "11"
          }
        ],
        "substitutes": [
          {
            "lineup_player": "Juan Cuadrado",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Alex Sandro",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Andrea Barzagli",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Carlo Pinsoglio",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Mario Mandzukic",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Wojciech Szczesny",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Daniele Rugani",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Stephan Lichtsteiner",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Rodrigo Bentancur",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Federico Bernardeschi",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": " ",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": " ",
            "lineup_number": "",
            "lineup_position": ""
          }
        ],
        "coach": [
          {
            "lineup_player": "Massimiliano Allegri",
            "lineup_number": "",
            "lineup_position": ""
          }
        ],
        "substitutions": [
          {
            "lineup_player": "Giorgio Chiellini | Stephan Lichtsteiner",
            "lineup_number": "",
            "lineup_position": "",
            "lineup_time": "11'"
          },
          {
            "lineup_player": "Paulo Dybala | Juan Cuadrado",
            "lineup_number": "",
            "lineup_position": "",
            "lineup_time": "46'"
          },
          {
            "lineup_player": "Douglas Costa | Mario Mandzukic",
            "lineup_number": "",
            "lineup_position": "",
            "lineup_time": "71'"
          }
        ]
      },
      "away": {
        "starting_lineups": [
          {
            "lineup_player": "Lorenzo Insigne",
            "lineup_number": "24",
            "lineup_position": "11"
          },
          {
            "lineup_player": "Dries Mertens",
            "lineup_number": "14",
            "lineup_position": "10"
          },
          {
            "lineup_player": "Jose Maria Callejon",
            "lineup_number": "7",
            "lineup_position": "9"
          },
          {
            "lineup_player": "Marek Hamsik",
            "lineup_number": "17",
            "lineup_position": "8"
          },
          {
            "lineup_player": "Jorginho",
            "lineup_number": "8",
            "lineup_position": "7"
          },
          {
            "lineup_player": "Allan",
            "lineup_number": "5",
            "lineup_position": "6"
          },
          {
            "lineup_player": "Mario Rui",
            "lineup_number": "6",
            "lineup_position": "5"
          },
          {
            "lineup_player": "Kalidou Koulibaly",
            "lineup_number": "26",
            "lineup_position": "4"
          },
          {
            "lineup_player": "Raul Albiol",
            "lineup_number": "33",
            "lineup_position": "3"
          },
          {
            "lineup_player": "Elseid Hysaj",
            "lineup_number": "23",
            "lineup_position": "2"
          },
          {
            "lineup_player": "Pepe Reina",
            "lineup_number": "25",
            "lineup_position": "1"
          }
        ],
        "substitutes": [
          {
            "lineup_player": "Rafael",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Christian Maggio",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Hrvoje Milic",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Piotr Zielinski",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Vlad Chiriches",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Luigi Sepe",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Zinedine Machach",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Marko Rog",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Adam Ounas",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Amadou Diawara",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Lorenzo Tonelli",
            "lineup_number": "",
            "lineup_position": ""
          },
          {
            "lineup_player": "Arkadiusz Milik",
            "lineup_number": "",
            "lineup_position": ""
          }
        ],
        "coach": [
          {
            "lineup_player": "Maurizio Sarri",
            "lineup_number": "",
            "lineup_position": ""
          }
        ],
        "substitutions": [
          {
            "lineup_player": "Dries Mertens | Arkadiusz Milik",
            "lineup_number": "",
            "lineup_position": "",
            "lineup_time": "61'"
          },
          {
            "lineup_player": "Marek Hamsik | Piotr Zielinski",
            "lineup_number": "",
            "lineup_position": "",
            "lineup_time": "66'"
          },
          {
            "lineup_player": "Allan | Marko Rog",
            "lineup_number": "",
            "lineup_position": "",
            "lineup_time": "80'"
          }
        ]
      }
    },
    "statistics": [
      {
        "type": "shots on target",
        "home": "1",
        "away": "5"
      },
      {
        "type": "shots off target",
        "home": "2",
        "away": "8"
      },
      {
        "type": "possession (%)",
        "home": "44",
        "away": "56"
      },
      {
        "type": "corners",
        "home": "3",
        "away": "3"
      },
      {
        "type": "offsides",
        "home": "2",
        "away": "4"
      },
      {
        "type": "fouls",
        "home": "10",
        "away": "17"
      },
      {
        "type": "yellow cards",
        "home": "3",
        "away": "1"
      },
      {
        "type": "goal kicks",
        "home": "9",
        "away": "6"
      },
      {
        "type": "treatments",
        "home": "3",
        "away": "0"
      }
    ]
  }
]
            

PHP call example


$APIkey='xxxxxxxxxxxxxx';
$from = '2016-10-30';
$to = '2016-11-01';
$league_id = 62;

$curl_options = array(
  CURLOPT_URL => "https://apifootball.com/api/?action=get_events&from=$from&to=$to&league_id=$league_id&APIkey=$APIkey",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );

$result = (array) json_decode($result);

var_dump($result);
?>

            

Odds


Method

GET apifootball.com/api/?action=get_odds

Returns odds (1x2, BTS, O/U, AH) for events included in your current subscription plan


Parameters

Parameter Description
action API method name
APIkey Authorization code generated from your apifootball account
from Start date (yyyy-mm-dd)
to Stop date (yyyy-mm-dd)
match_id Match ID - if set only odds from specific event will be returned (Optional)

Request URL


JSON Response

[
    {
        "match_id":"148356"
        ,"odd_bookmakers":"10Bet"
        ,"odd_date":"2017-02-07 07:41:36"
        ,"odd_1":"1.77"
        ,"odd_x":"3.74"
        ,"odd_2":"5.30"
        ,"ah-2.5_1":"6.25"
        ,"ah-2.5_2":"1.12"
        ,"ah-2_1":"5.50"
        ,"ah-2_2":"1.15"
        ,"ah-1.5_1":"3.00"
        ,"ah-1.5_2":"1.38"
        ,"ah-1_1":"2.44"
        ,"ah-1_2":"1.65"
        ,"ah0_1":"1.28"
        ,"ah0_2":"3.54"
        ,"o+0.5":"1.07"
        ,"u+0.5":"9.00"
        ,"o+1.5":"1.35"
        ,"u+1.5":"3.10"
        ,"o+2":"1.58"
        ,"u+2":"2.35"
        ,"o+2.5":"2.10"
        ,"u+2.5":"1.84"
        ,"o+3":"3.10"
        ,"u+3":"1.35"
        ,"o+3.5":"3.80"
        ,"u+3.5":"1.25"
        ,"o+4.5":"8.00"
        ,"u+4.5":"1.08"
        ,"o+5.5":"19.00"
        ,"u+5.5":"1.02"
        ,"bts_yes":"2.00"
        ,"bts_no":"1.80"
    }
]
            

PHP call example


$APIkey='xxxxxxxxxxxxxx';
$from = '2017-02-13';
$to = '2017-02-13';

$curl_options = array(
  CURLOPT_URL => "https://apifootball.com/api/?action=get_odds&from=$from&to=$to&APIkey=$APIkey",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );

$result = (array) json_decode($result);

var_dump($result);
?>

            

H2H


Method

GET apifootball.com/api/?action=get_H2H

Returns the last games between submiteted teams and the last games of each team


Parameters

Parameter Description
action API method name
APIkey Authorization code generated from your apifootball account
firstTeam First team name
secondTeam Second team name

Request URL


JSON Response

[
	{
	"firstTeam_VS_secondTeam": [{
		"match_id": "248036",
		"country_id": "169",
		"country_name": "England",
		"league_id": "70",
		"league_name": "Capital One Cup",
		"match_date": "2018-01-24",
		"match_status": "FT",
		"match_time": "21:00",
		"match_hometeam_name": "Arsenal",
		"match_hometeam_score": "2",
		"match_awayteam_name": "Chelsea",
		"match_awayteam_score": "1",
		"match_hometeam_halftime_score": "1",
		"match_awayteam_halftime_score": "1",
		"match_live": "1"
	},
	.....
	],"firstTeam_lastResults": [{
		"match_id": "248036",
		"country_id": "169",
		"country_name": "England",
		"league_id": "70",
		"league_name": "Capital One Cup",
		"match_date": "2018-01-24",
		"match_status": "FT",
		"match_time": "21:00",
		"match_hometeam_name": "Arsenal",
		"match_hometeam_score": "2",
		"match_awayteam_name": "Chelsea",
		"match_awayteam_score": "1",
		"match_hometeam_halftime_score": "1",
		"match_awayteam_halftime_score": "1",
		"match_live": "1"
	},
	.....
	],	"secondTeam_lastResults": [{
		"match_id": "248036",
		"country_id": "169",
		"country_name": "England",
		"league_id": "70",
		"league_name": "Capital One Cup",
		"match_date": "2018-01-24",
		"match_status": "FT",
		"match_time": "21:00",
		"match_hometeam_name": "Arsenal",
		"match_hometeam_score": "2",
		"match_awayteam_name": "Chelsea",
		"match_awayteam_score": "1",
		"match_hometeam_halftime_score": "1",
		"match_awayteam_halftime_score": "1",
		"match_live": "1"
	},
	.....
]
            

PHP call example


$APIkey='xxxxxxxxxxxxxx';
$from = '2017-02-13';
$to = '2017-02-13';

$curl_options = array(
  CURLOPT_URL => "https://apifootball.com/api/?action=get_H2H&firstTeam=$firstTeam&secondTeam=$secondTeam&APIkey=$APIkey",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );

$result = (array) json_decode($result);

var_dump($result);
?>

            

Predictions


Method

GET apifootball.com/api/?action=get_predictions

Returns mathematical calculated predictions for the events included in your current subscription plan


Parameters

Parameter Description
action API method name
APIkey Authorization code generated from your apifootball account
from Start date (yyyy-mm-dd)
to Stop date (yyyy-mm-dd)
country_id Country ID - if set only leagues from specific country will be returned (Optional)
league_id League ID - if set events from specific league will be returned (Optional)
match_id Match ID - if set only details from specific match will be returned (Optional)

Request URL


JSON Response

[
  {
    "match_id": "369090",
    "country_id": "253",
    "country_name": "Australia",
    "league_id": "684",
    "league_name": "A-League",
    "match_date": "2019-01-08",
    "match_status": "FT",
    "match_time": "08:50",
    "match_hometeam_name": "Western Sydney Wanderers FC",
    "match_hometeam_score": "2",
    "match_awayteam_name": "Wellington Phoenix FC",
    "match_awayteam_score": "3",
    "match_hometeam_halftime_score": "1",
    "match_awayteam_halftime_score": "1",
    "match_hometeam_extra_score": "",
    "match_awayteam_extra_score": "",
    "match_hometeam_penalty_score": "",
    "match_awayteam_penalty_score": "",
    "match_hometeam_system": "4-3-3",
    "match_awayteam_system": "3-4-3",
    "match_live": "0",
    "prob_HW": "20.00",
    "prob_D": "25.00",
    "prob_AW": "55.00",
    "prob_HW_D": "45.00",
    "prob_AW_D": "80.00",
    "prob_HW_AW": "75.00",
    "prob_O": "43.00",
    "prob_U": "57.00",
    "prob_O_1": "69.00",
    "prob_U_1": "31.00",
    "prob_O_3": "22.00",
    "prob_U_3": "78.00",
    "prob_bts": "44.00",
    "prob_ots": "56.00",
    "prob_ah_h_45": "99.00",
    "prob_ah_a_45": "1.00",
    "prob_ah_h_35": "96.00",
    "prob_ah_a_35": "4.00",
    "prob_ah_h_25": "88.00",
    "prob_ah_a_25": "12.00",
    "prob_ah_h_15": "71.00",
    "prob_ah_a_15": "29.00",
    "prob_ah_h_05": "45.00",
    "prob_ah_a_05": "55.00",
    "prob_ah_h_-05": "20.00",
    "prob_ah_a_-05": "80.00",
    "prob_ah_h_-15": "6.00",
    "prob_ah_a_-15": "94.00",
    "prob_ah_h_-25": "1.00",
    "prob_ah_a_-25": "99.00",
    "prob_ah_h_-35": "0.00",
    "prob_ah_a_-35": "100.00",
    "prob_ah_h_-45": "0.00",
    "prob_ah_a_-45": "100.00"
  }
  ........
 ]
            

PHP call example


$APIkey='xxxxxxxxxxxxxx';
$from = '2019-01-08';
$to = '2019-01-08';

$curl_options = array(
  CURLOPT_URL => "https://apifootball.com/api/?action=get_predictions&from=$from&to=$to&APIkey=$APIkey",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HEADER => false,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_CONNECTTIMEOUT => 5
);

$curl = curl_init();
curl_setopt_array( $curl, $curl_options );
$result = curl_exec( $curl );

$result = (array) json_decode($result);

var_dump($result);
?>

            

Livescore