Documentation

  • Version: 1.0.2
  • Created: 2016-11-17
  • Latest Update: 2017-08-02

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": "195948",
    "country_id": "222",
    "country_name": "Brazil",
    "league_id": "512",
    "league_name": "Serie A",
    "match_date": "2017-08-03",
    "match_status": "FT",
    "match_time": "00:30",
    "match_hometeam_name": "Sport",
    "match_hometeam_score": "2",
    "match_awayteam_name": "Fluminense",
    "match_awayteam_score": "2",
    "match_hometeam_halftime_score": "1",
    "match_awayteam_halftime_score": "2",
    "match_live": "1",
    "goalscorer": [
      {
        "time": "9'",
        "home_scorer": "",
        "score": "0 - 1",
        "away_scorer": "G.  Gustavo Scarpa"
      },
      {
        "time": "13'",
        "home_scorer": "",
        "score": "0 - 2",
        "away_scorer": "R.  Renato  Chaves"
      },
      {
        "time": "32'",
        "home_scorer": "Andre",
        "score": "1 - 2",
        "away_scorer": ""
      },
      {
        "time": "49'",
        "home_scorer": "Patrick",
        "score": "2 - 2",
        "away_scorer": ""
      }
    ],
    "cards": [
      {
        "time": "3'",
        "home_fault": "",
        "card": "yellowcard",
        "away_fault": "R.  Renato  Chaves"
      },
      {
        "time": "20'",
        "home_fault": "E.  Eugenio Mena",
        "card": "yellowcard",
        "away_fault": ""
      },
      {
        "time": "24'",
        "home_fault": "D.  Diego  Souza",
        "card": "yellowcard",
        "away_fault": ""
      },
      {
        "time": "37'",
        "home_fault": "R.  Reinaldo Lenis",
        "card": "yellowcard",
        "away_fault": ""
      },
      {
        "time": "54'",
        "home_fault": "",
        "card": "redcard",
        "away_fault": "J.  Jefferson Orejuela"
      },
      {
        "time": "55'",
        "home_fault": "",
        "card": "yellowcard",
        "away_fault": "M.  Marlon Freitas"
      },
      {
        "time": "59'",
        "home_fault": "Rithely",
        "card": "yellowcard",
        "away_fault": ""
      },
      {
        "time": "68'",
        "home_fault": "",
        "card": "yellowcard",
        "away_fault": "Lucas"
      },
      {
        "time": "82'",
        "home_fault": "",
        "card": "yellowcard",
        "away_fault": "M.  Marquinhos  Calazans"
      },
      {
        "time": "83'",
        "home_fault": "Durval",
        "card": "yellowcard",
        "away_fault": ""
      }
    ]
  }
            

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_events&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