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
Published federal court opinions from GPO GovInfo for building bounded case lookup and docket-research tools.
From source to product signal
GovInfo's USCOURTS collection hosts published federal opinions. Start with one court package id through the API. Coverage is not every federal case, unpublished opinions are often missing, and the collection is not a citator.
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.govinfo.gov/search",
params={
"api_key": os.environ["DATA_GOV_API_KEY"],
"query": "collection:USCOURTS courtCode:ca9",
"pageSize": 20,
"offsetMark": "*",
},
timeout=30,
)
response.raise_for_status()
opinions = pd.json_normalize(response.json()["results"])
opinions["retrieved_at_utc"] = pd.Timestamp.now(tz="UTC")
print(opinions.head())Test a useful signal
Test whether GovInfo search can power a bounded federal-opinion inbox.
U.S. Government Publishing Office is a government source. Last verified 2026-08-18. Temporal coverage: participating federal courts with collection-specific start dates.