Check the setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- A SAM.gov public API key saved in the SAM_API_KEY environment variable
Current U.S. federal procurement notices for building opportunity monitors, deadline alerts, and focused market-discovery tools.
From source to product signal
The SAM.gov Opportunities API publishes federal procurement notices and their current deadlines. Start with one NAICS code and a 30-day posting window. Date windows are required, notices can be revised, deadlines can change, and the public API exposes only the latest active version rather than a complete revision history.
Install the packages, then run the notebook cell.
python -m pip install pandas requests
import os
from datetime import date, timedelta
import pandas as pd
import requests
today = date.today()
response = requests.get(
"https://api.sam.gov/opportunities/v2/search",
params={
"api_key": os.environ["SAM_API_KEY"],
"postedFrom": (today - timedelta(days=30)).strftime("%m/%d/%Y"),
"postedTo": today.strftime("%m/%d/%Y"),
"ncode": "541511",
"limit": 100,
"offset": 0,
},
timeout=30,
)
response.raise_for_status()
opportunities = pd.DataFrame(response.json()["opportunitiesData"])
opportunities["retrieved_at_utc"] = pd.Timestamp.now(tz="UTC")
columns = ["noticeId", "title", "postedDate", "responseDeadLine", "naicsCode", "active"]
print(opportunities.reindex(columns=columns).head(20))Test a useful signal
Identify currently active notices for one NAICS code that still have time before their response deadline.
U.S. General Services Administration is a government source. Last verified 2026-08-11. Temporal coverage: current active and archived notices.