AIGoalie API Documentation

This API provides football match predictions from ai-goalie.com. See https://rapidapi.com/aigoaliemail/api/aigoalie for subscription details.

Base URL

https://api.ai-goalie.com

Authentication

All API requests require an API key. The key must be included in the X-API-KEY header of each request.

Request Headers and CORS

Our API accepts the following headers:


Endpoint: GET /api/predictions

Retrieve predictions for football matches. You can: - Fetch all predictions. - Filter predictions by a specific match. - Filter predictions by date. - Filter predictions by league. - Filter predictions by country.

Query Parameters

Parameter Type Required Description
match String No Match identifier in the format {home_team}_{away_team}_{YYYY-MM-DD}.
date String No Date for predictions in the format DD-MM-YYYY.
league String No League for predictions.
country String No Country for predictions.
page Integer No Page number for pagination (default: 1).

Fields in Response

Field Type Description
home String The home team's name.
away String The away team's name.
date String The date of the match in the format DD-MM-YYYY.
league String The league or competition for the match.
country String The country for the match.
predicted_winner String Predicted winner of the match (home or away).
time String Match start time (GMT).
home_id String API ID for the home team. Returns N/A if the ID is not bridged.
away_id String API ID for the away team. Returns N/A if the ID is not bridged.
win_confidence String The confidence level for the predicted winner (e.g., "65%" for 65% confidence).
goals_prediction String Predicted number of goals for the match (e.g., "2.5").
odd String Betting odds for the match. Returns N/A if odds are unavailable.
win_outcome String Actual match outcome (W for Win, D for Draw, L for Loss, TBD for undecided).
score String Final match score (e.g., "2:1"), or TBD if the match has not yet occurred.

Responses

200 OK

Returns a dictionary of predictions. The keys are match identifiers, and the values contain details about the predictions.

Example Response:

{
  "page": 1,
  "limit": 10,
  "total_pages": 4,
  "total_items": 40,
  "response": {
    "TeamA_TeamB_2024-11-20": {
      "home": "TeamA",
      "away": "TeamB",
      "date": "20-11-2024",
      "league": "Premier League",
      "country": "England",
      "time": "15:00",
      "predicted_winner": "home",
      "win_confidence": "65%",
      "goals_prediction": "2.5",
      "odd": "1.75",
      "score": "2:1"
    },
    "TeamC_TeamD_2024-11-21": {
      "home": "TeamC",
      "away": "TeamD",
      "date": "21-11-2024",
      "league": "La Liga",
      "country": "Spain",
      "time": "15:00",
      "predicted_winner": "away",
      "win_confidence": "70%",
      "goals_prediction": "1.8",
      "odd": "2.1",
      "score": "TBD"
    }
  }
}

Python Examples

1. Fetch All Predictions to Date

import requests

url = "https://api.ai-goalie.com/api/predictions?page=1"
headers = {"X-API-KEY": "your_api_key_here"}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    predictions = response.json()
    print(predictions)
else:
    print(f"Error: {response.status_code}, {response.json()}")

2. Fetch Predictions for a Specific Match

import requests

url = "https://api.ai-goalie.com/api/predictions"
params = {"match": "TeamA_TeamB_2024-15-11"}
headers = {"X-API-KEY": "your_api_key_here"}

response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
    match_predictions = response.json()
    print(match_predictions)
else:
    print(f"Error: {response.status_code}, {response.json()}")

3. Fetch Predictions for a Specific Date

import requests

url = "https://api.ai-goalie.com/api/predictions?page=1"
params = {"date": "15-11-2024"}
headers = {"X-API-KEY": "your_api_key_here"}

response = requests.get(url, headers=headers, params=params)

if response.status_code == 200:
    date_predictions = response.json()
    print(date_predictions)
else:
    print(f"Error: {response.status_code}, {response.json()}")

Examples

1. Fetch All Predictions to Date

  bash curl -H "X-API-KEY: your_api_key_here" https://api.ai-goalie.com/api/predictions

2. Fetch Predictions for a Specific Match

  bash curl -H "X-API-KEY: your_api_key_here" "https://api.ai-goalie.com/api/predictions?match=TeamA_TeamB_2024-15-11"

3. Fetch Predictions for a Specific Date

  bash curl -H "X-API-KEY: your_api_key_here" "https://api.ai-goalie.com/api/predictions?date=15-11-2024"

Error Handling

Status Code Meaning Description
200 OK Successful retrieval of predictions.
400 Bad Request Invalid query parameter (e.g., invalid date).
401 Unauthorized Missing or invalid API key.
404 Not Found No data found for the query parameters.
429 Too Many Requests Rate limit exceeded.
500 Internal Server Error Data unavailable or an unexpected error.