Check the setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- A free api.data.gov key saved in the DATA_GOV_API_KEY environment variable
Federal candidate and committee receipts, disbursements, and filings for building campaign-finance monitors that stay inside FEC use limits.
From source to product signal
The OpenFEC API exposes candidate and committee financial totals from FEC reports. Start with active House candidate totals for one cycle, sorted by receipts. Do not build products from individual contributor lists; FEC law prohibits selling or using that information to solicit donations or for commercial purposes.
Install the packages, then run the notebook cell.
python -m pip install pandas requests
import os
import pandas as pd
import requests
response = requests.get(
"https://api.open.fec.gov/v1/candidates/totals/",
params={
"api_key": os.environ["DATA_GOV_API_KEY"],
"cycle": 2024,
"office": "H",
"is_active_candidate": "true",
"sort": "-receipts",
"per_page": 20,
},
timeout=30,
)
response.raise_for_status()
totals = pd.DataFrame(response.json()["results"])
totals["retrieved_at_utc"] = pd.Timestamp.now(tz="UTC")
print(totals[["name", "party_full", "state", "receipts", "disbursements"]].head(20))Test a useful signal
Identify which active House candidates reported the largest receipts in one election cycle.
Federal Election Commission is a government source. Last verified 2026-08-14. Temporal coverage: federal election cycles with nightly processed updates.