So You Got the Starter Pack. Now What?
Just downloaded the CFBD Starter Pack? Here's how to go beyond the CSVs using the official Python client to pull live and recent data from the CollegeFootballData API.
First off, thanks for picking up the CFBD Starter Pack! It gives you cleaned, historical data across several seasons and is perfect for building models, dashboards, and analytics workflows.
👉 Don’t have the Starter Pack yet? Grab it now and follow along.
But what if you want to pull in more recent or live data? That’s where the CollegeFootballData API and official Python client come in.
Let’s walk through how to set it up and fetch new data.
🔧 Step 1: Install the Python Client
Install the package:
pip install cfbd
🔐 Step 2: Set Your API Key
You’ll need an API key (free or Patreon tier) from the CFBD website. Once you have it, set it as an environment variable:
export BEARER_TOKEN="your_api_key_here"
Then set up the configuration in your Python code:
import cfbd
import os
configuration = cfbd.Configuration(
access_token=os.environ["BEARER_TOKEN"]
)
🚀 Step 3: Fetch Data Using an API Client
The Python client uses context managers to handle the API session. Here's how to fetch adjusted player passing stats:
with cfbd.ApiClient(configuration) as api_client:
api_instance = cfbd.StatsApi(api_client)
# Example: get advanced game stats for Michigan in 2023
response = api_instance.get_advanced_game_stats(
year=2023,
team="Michigan"
)
print(response)
This same pattern works for all endpoints.
📘 Examples You Can Try
Here are a few practical snippets to get started:
Recent Games
with cfbd.ApiClient(configuration) as api_client:
games_api = cfbd.GamesApi(api_client)
games = games_api.get_games(year=2024, week=13)
for g in games:
print(f"{g.away_team} at {g.home_team}: {g.away_points}-{g.home_points}")
Team Box Scores
with cfbd.ApiClient(configuration) as api_client:
stats_api = cfbd.GamesApi(api_client)
box = stats_api.get_game_team_stats(year=2024, week=13)
for game in box:
print(game)
Historical Betting Lines
with cfbd.ApiClient(configuration) as api_client:
betting_api = cfbd.BettingApi(api_client)
games = betting_api.get_lines(year=2024, week=13)
for game in games:
for line in game.lines:
print(f"{game.away_team} @ {game.home_team}: {line.formatted_spread} ({line.provider})")
🧠 Combine with the Starter Pack
The Starter Pack has historical EPA, recruiting, and drive/play-level data. You can extend it by:
- Merging recent API data with your historical CSVs
- Running your models on up-to-date weekly metrics
- Building dashboards multiple types of data
🛑 Watch Your Limits
If you’re using the Free Tier, you’ll be capped at 1,000 calls/month. Consider bumping to a Patreon plan for more access (and goodies like weather, advanced metrics, and the GraphQL API).
You can check your remaining calls at any time either via the X-CallLimit-Remaining
HTTP header returned with all responses or via the info
endpoint (does not count against limits):
with cfbd.ApiClient(configuration) as api_client:
api_instance = cfbd.InfoApi(api_client)
api_response = api_instance.get_user_info()
print(api_response)
💬 Questions or Feedback?
Join the community on Discord or check out the interactive API docs to explore every endpoint.