Football (Soccer) documentation


Football Sockets API V2

  • Home
  • Football (Soccer) documentation

The socket is in BETA

If you encounter problems, do not hesitate to write to us here

Endpoints

ALL SPORTS API - Football (Soccer) Sockets API Version 2.1

Welcome to the documentation page of AllSportsAPI.com football service. Please find bellow the full list of the methods you can relay on to get real time football data helping you build awesome applications.

LiveScore AND Live Stats


wss://wss.allsportsapi.com/live_events

After we have connected to it, it will push the client every time an event appears in the live score (score a goal, change the statistics, change the minute, etc.)


Parameters

Parameter Description
APIkey Authorization code generated from your allsportsapi account
timezone The timezone where you want to receive the data in tz format (exemple: America/New_York). Default timezone: Europe/Berlin (Optional)
countryId Country ID - if set only events from specific country will be returned (Optional)
leagueId League ID - if set events from specific league will be returned (Optional)
matchId Match ID - if set only details from specific match will be returned (Optional)

JSON Message Received

[
  {
        "event_key": "11205",
        "event_date": "2021-05-21",
        "event_time": "11:05",
        "event_home_team": "Newcastle Jets",
        "home_team_key": "1056",
        "event_away_team": "Brisbane Roar",
        "away_team_key": "399",
        "event_halftime_result": "0 - 1",
        "event_final_result": "1 - 2",
        "event_ft_result": "1 - 2",
        "event_penalty_result": "",
        "event_status": "74",
        "country_name": "Australia",
        "league_name": "A-League - Regular Season",
        "league_key": "49",
        "league_round": "22",
        "league_season": "",
        "event_live": "1",
        "event_stadium": "McDonald Jones Stadium",
        "event_referee": "",
        "event_country_key": "17",
        "league_logo": "https://apiv2.allsportsapi.com/logo/logo_leagues/49_a-league.png",
        "country_logo": "https://apiv2.allsportsapi.com/logo/logo_country/17_australia.png",
        "event_home_formation": "",
        "event_away_formation": "",
        "fk_stage_key": "528",
        "stage_name": "Regular Season",
        "goalscorers": [
            {
                "time": "34",
                "home_scorer": "",
                "score": "0 - 1",
                "away_scorer": "R. Danzaki"
            },
            {
                "time": "61",
                "home_scorer": "J. O'Shea (o.g.)",
                "score": "1 - 1",
                "away_scorer": ""
            },
            {
                "time": "73",
                "home_scorer": "",
                "score": "1 - 2",
                "away_scorer": "J. O'Shea"
            }
        ],
        "cards": [
            {
                "time": "21",
                "home_fault": "",
                "card": "yellow card",
                "away_fault": "M. Gillesphey"
            },
            {
                "time": "42",
                "home_fault": "J. Hoffman",
                "card": "yellow card",
                "away_fault": ""
            },
            ........................
        ],
        "substitutes": [
            {
                "time": "46",
                "home_scorer": {
                    "in": "C. O'Toole",
                    "out": "L. Mauragis"
                },
                "score": "substitution",
                "away_scorer": []
            },
            {
                "time": "46",
                "home_scorer": {
                    "in": "A. Abbas",
                    "out": "A. Goodwin"
                },
                "score": "substitution",
                "away_scorer": []
            },
            ..............
        ],
        "lineups": {
            "home_team": {
                "starting_lineups": [
                    {
                        "player": "Jack Duncan",
                        "player_number": "23",
                        "player_country": null
                    },
                    {
                        "player": "Johnny Koutroumbis",
                        "player_number": "2",
                        "player_country": null
                    },
                    .......................
                ],
                "substitutes": [
                    {
                        "player": "Lewis Italiano",
                        "player_number": "1",
                        "player_country": null
                    },
                    {
                        "player": "Lachlan Jackson",
                        "player_number": "22",
                        "player_country": null
                    },
                    .................
                ],
                "substitutes": [
                    {
                        "player": "Macklin Freke",
                        "player_number": "1",
                        "player_country": null
                    },
                    {
                        "player": "Antonee Burke-Gilroy",
                        "player_number": "22",
                        "player_country": null
                    },
                    ..................
                ],
                "coaches": [
                    {
                        "coache": "W. Moon",
                        "coache_country": null
                    }
                ]
            }
        },
        "statistics": [
            {
                "type": "Shots Blocked",
                "home": "1",
                "away": "6"
            },
            {
                "type": "Shots Inside Box",
                "home": "3",
                "away": "8"
            },
            {
                "type": "Shots Outside Box",
                "home": "3",
                "away": "8"
            },
            ..................
        ]
  },
  .......
]
                

Javascript call example


var APIkey='!_your_account_APIkey_!';

var socket  = new WebSocket('wss://wss.allsportsapi.com/live_events?widgetKey='+APIkey+'&timezone=+03:00');
socket.onmessage = function(e) {
  if (e.data) {
    var matchesData = JSON.parse(e.data);
    // Now variable matchesData contains all matches that received an update
    // Here can update matches in dom from variable matchesData
    console.log(matchesData);
  }
}
                


Live Odds

Coming Soon