SAM.gov Contract Opportunities API: export new federal bids to CSV, with or without an API key
By neushua. Tested on 1 December 2026.
SAM.gov is where US federal agencies post contract opportunities: solicitations, sources-sought notices, presolicitations and award notices. If you want them in a spreadsheet, a database or a daily alert, there are two official routes and one shortcut:
- The Get Opportunities API. It needs a SAM.gov account and an API key, and it has a daily request quota.
- The public daily extract. This is one CSV file of every active notice. It needs no key and no login.
- A ready-made scheduled job that reads route 2 for you. We built one; it's covered at the end, with its price.
Routes 1 and 2 are free. Everything below was checked against the live sources on 1 December 2026.
Route 1: the Get Opportunities API (needs a key)
Endpoint: GET https://api.sam.gov/opportunities/v2/search (GSA documentation).
To use it:
- Create a SAM.gov account, sign in, and open Account Details. Request a Public API Key there. You have to re-enter your password to see it.
- Send
api_key,postedFromandpostedTo. The two dates are mandatory, use the formatMM/dd/yyyy, and can be at most one year apart. - Set
limit=1000. The default is 1, so a request withoutlimitreturns a single notice.
curl "https://api.sam.gov/opportunities/v2/search?api_key=$SAM_API_KEY&postedFrom=11/24/2026&postedTo=11/30/2026&ncode=541512&limit=1000&offset=0"
What trips people up:
- The daily quota is small for a personal key. The Opportunities page only says requests are "limited based on the federal or non-federal or general roles". GSA's Entity Management API page publishes the actual tiers: 10 requests a day for a non-federal user with no role in SAM.gov, 1,000 a day with a role or a system account, and 10,000 for a federal system account. Most people who sign up just to try the API are in the first tier.
- The description is a link, not text. The
descriptionfield is a URL that needs your key again, so reading the full text costs one more request per notice. - Only the latest version of each notice. GSA says the API "only provides the latest active version of the opportunity". For amendment history, it points to Data Services.
- Deep paging can come back empty. In August 2026, developers on r/govcon reported that pages past roughly offset 1,000 return HTTP 200 with no rows and no error. The workaround they describe is to split the date range into narrow windows, so that each window has fewer than 1,000 results. We have not reproduced this with our own key, so treat it as a user report.
The API is the right choice when you need a notice minutes after it is posted, or when you need archived notices.
Route 2: the public daily extract (no key)
SAM.gov's Data Services publishes the whole list of active contract opportunities as one public CSV, also listed on data.gov:
https://sam.gov/api/prod/fileextractservices/v1/api/download/Contract%20Opportunities/datagov/ContractOpportunitiesFullCSV.csv?privacy=Public
What we saw on 1 December 2026:
- The URL redirects (HTTP 303) to SAM.gov's download bucket. The file was 226,697,812 bytes, last modified 1 Dec 2026, 04:30 UTC. It is rebuilt once a day, so today's postings usually appear tomorrow morning (UTC).
- Rows are sorted by
PostedDate, newest day first. In the first 9,000 rows the dates never went back up. That means you can stream the file and stop as soon as you pass your date window. A 3-day window needs only the first few MB. - Volume: 1,177 notices were posted on Monday 30 November, 198 on Sunday 29 November and 2 on Saturday 28 November. On Friday 27 November, the day after Thanksgiving, there were 188.
- The file is mostly Windows-1252 with some UTF-8 rows. Decode each line separately, or names like "Señor" break your parser.
- Every row has contact columns (
PrimaryContactFullname,PrimaryContactEmail,PrimaryContactPhoneand the same for a secondary contact). These are contracting officers' personal work details. If you only need the opportunity, drop them. The script below does. - Award notices carry
AwardNumber,AwardDate,Award$andAwardee. Most other columns are what the agency typed, and the place of performance is often empty. - The extract holds active notices only. Archived and cancelled notices drop out, so it is not a historical archive.
Python: the last N days of notices for your NAICS code, as CSV
"""Stream SAM.gov's public Contract Opportunities extract and keep recent notices.
No API key. The file is sorted newest PostedDate first, so we stop early.
Only organisation-level columns are written (no contact names, emails or phones)."""
import csv, datetime as dt, sys
import requests
URL = ("https://sam.gov/api/prod/fileextractservices/v1/api/download/"
"Contract%20Opportunities/datagov/ContractOpportunitiesFullCSV.csv?privacy=Public")
DAYS = int(sys.argv[1]) if len(sys.argv) > 1 else 3
NAICS_PREFIX = sys.argv[2] if len(sys.argv) > 2 else "" # e.g. 5415
KEEP = ["NoticeId", "Title", "Sol#", "Department/Ind.Agency", "Sub-Tier", "Office",
"PostedDate", "Type", "SetASideCode", "ResponseDeadLine", "NaicsCode",
"ClassificationCode", "PopState", "Link"]
def lines(resp):
for raw in resp.iter_lines(): # mixed UTF-8 / Windows-1252: decode per line
try:
yield raw.decode("utf-8")
except UnicodeDecodeError:
yield raw.decode("cp1252", errors="replace")
cutoff = (dt.datetime.now(dt.timezone.utc).date() - dt.timedelta(days=DAYS)).isoformat()
with requests.get(URL, stream=True, timeout=120,
headers={"User-Agent": "sam-extract-example/1.0"}) as resp:
resp.raise_for_status()
reader = csv.DictReader(lines(resp))
out = csv.DictWriter(sys.stdout, fieldnames=KEEP, extrasaction="ignore")
out.writeheader()
for row in reader:
posted = (row.get("PostedDate") or "")[:10]
if posted and posted < cutoff:
break # older than the window: stop downloading
if NAICS_PREFIX and not (row.get("NaicsCode") or "").startswith(NAICS_PREFIX):
continue
out.writerow(row)
Run it with python3 sam_extract_latest.py 3 5415 > it-notices.csv. On 1 December 2026 it returned 19 notices in NAICS 5415 (computer systems design) posted on 29 and 30 November, 11 of them sources-sought notices. It finished in under a second.
To turn this into a daily alert, you still have to do three things yourself: run it on a schedule after about 05:00 UTC, remember which NoticeIds you have already seen, and send the new ones somewhere (email, Slack or a sheet).
Route 3: the same extract as a scheduled Apify Actor (paid, by us)
Disclosure: we (neushua) built and maintain this one. It does route 2 for you: it streams the extract, applies your filters, remembers what it already sent you, and leaves out the contact columns and the free-text description, which often repeats contact details. It runs on Apify, so schedules, webhooks and the Google Sheets, Slack, Zapier, Make and n8n integrations come with it.
SAM.gov Federal Contract Opportunities Monitor on Apify
Example input (open IT-services bids set aside for small businesses, posted in the last 7 days, and only new ones on later runs):
{
"daysBack": 7,
"noticeTypes": ["Solicitation", "Combined Synopsis/Solicitation"],
"naicsCodes": ["5415"],
"setAsideCodes": ["SBA"],
"openOnly": true,
"onlyNew": true,
"maxItems": 50
}
A real output row from a run on 29 November 2026 (shortened):
{
"noticeId": "322338355ae84c6ebabbea545495ac0d",
"title": "S--Landscaping services for Eureka CA WFO",
"solicitationNumber": "1305M327Q0051",
"noticeType": "Solicitation",
"department": "COMMERCE, DEPARTMENT OF",
"subTier": "NATIONAL OCEANIC AND ATMOSPHERIC ADMINISTRATION",
"postedDate": "2026-11-27",
"responseDeadline": "2026-11-30T13:00:00-08:00",
"setAsideCode": "SBA",
"naicsCode": "561730",
"pscCode": "S208",
"placeOfPerformanceState": "CA",
"samUrl": "https://sam.gov/workspace/contract/opp/322338355ae84c6ebabbea545495ac0d/view"
}
In our tests on 29 November 2026, a 7-day unfiltered run returned 4,331 notices in about 7 seconds, because it read only 14 MB of the file. A run filtered to NAICS 5415 and 5416, open bids only, returned 59 notices. The next "only new" run returned 0.
Price: $0.005 per run plus $0.002 per notice returned ($2 per 1,000), and no monthly fee. A daily watch that returns 20 new notices costs $0.045 that day. A day with nothing new costs $0.005. Apify's free plan includes $5 of usage a month.
Honest limits: it is up to a day behind, because SAM.gov rebuilds the extract once a day. It covers active notices only, with no attachments and no description text. Everything in it is free on sam.gov. What you pay for is the filtering, the scheduling and the "only new" memory. If you need minute-level alerts, use SAM.gov's own saved searches or route 1.
Which route should you use?
| You need | Use |
|---|---|
| A one-off export of what is open now | Route 2 (the extract), free |
| Notices minutes after posting, or archived notices | Route 1 (the API), with a key |
| A daily "new bids for my NAICS codes" list without running a server | Route 2 on your own cron, or route 3 |
FAQ
Is there a SAM.gov API without a key? Not for the Get Opportunities API. The public extract above needs no key and has no quota.
How often is SAM.gov data updated? Active notices refresh daily, and archived notices weekly, according to GSA. The public extract was rebuilt at about 04:30 UTC every day we checked.
Why does the same solicitation number appear twice? Amendments and follow-on notices get a new notice ID under the same Sol#. Group by solicitation number if you want one row per opportunity.
Independent guide. Not affiliated with GSA or SAM.gov. Figures are from SAM.gov's public files on the dates shown.