To fetch live match data, lineups, and fixtures for the Football Market Intelligence engine, you must configure a key for API-Football. Follow these step-by-step instructions to obtain your API key and configure it in your local environment.
Warning
By default (on the free tier), you can only fetch match data from the exact day the API call is made. To access historical match data or fetch games from previous days, you will need to opt into a premium plan.
Go to the official API-Football website: https://www.api-football.com/
Click the Sign In button, which is usually located in the top right corner of the homepage. This will redirect you to the login dashboard: https://dashboard.api-football.com/login/
Once you have successfully signed in, you will be on your main dashboard page. Look at the sidebar on the left side of your screen.
- In the sidebar, locate and click on the Accounts icon (this is usually the 4th icon from the top).
- The sidebar will expand to reveal more options.
- Click on My Access.
On the "My Access" page, look towards the top right corner. You will see your unique API Key displayed there. Copy this key to your clipboard.
Now that you have your API key, you need to add it to your backend configuration.
- Navigate to the
backenddirectory of this project. - If you haven't already, create a file named
.envby copying the.env.examplefile. - Open the
backend/.envfile in your editor. - Paste your copied key into the
API_FOOTBALL_KEYvariable so it looks like this:
API_FOOTBALL_KEY="<paste_your_copied_api_key_here>"Once this is saved, your live data ingestion scripts (like poll_api_football.py and fetch_wc_data.py) will automatically authenticate and begin polling World Cup data.