Government and public records

SAM.gov Contract Opportunities API Feed by Keyword

SAM.gov publishes federal contract opportunities (solicitations, presolicitations, sources sought and award notices) through its Get Opportunities API. With your own free SAM.gov key, this Actor searches it by keyword and filters, and flags notices that are new or changed since the last run.

Open the Actor on Apify Store

Grants.gov API & SAM.gov Scraper — Federal Grants Feed. Pay per result; see the Store page for current pricing.

The source and its limits

The SAM.gov Get Opportunities API is the official public API for federal contract notices. It requires a free personal API key, which any individual can request; no entity registration is needed:

  1. Create or sign in to an account at sam.gov.
  2. Open your profile, then Account Details.
  3. Under Public API Key, click Request, enter your password and copy the key.
  4. Pass it as samApiKey. It is stored as an encrypted secret input and never written to logs.

samFilters passes naics, setAside, state and ptype (notice type) to the API. The Actor asks for up to 1,000 notices per request, so one keyword normally costs one request.

Limits worth knowing

  • A personal, non-federal key has a small daily request allowance. Keep the keyword list short on SAM.gov schedules.
  • SAM.gov matches keywords against the notice title, and the posted-date window is at most one year.
  • Without a key the SAM.gov source is skipped with a log line; a rejected key produces a SAM_AUTH_FAILED error item.
  • Points of contact are returned exactly as the agency published them.

The same Actor also reads six state and local bid datasets from city, county and state open-data portals (Los Angeles, New York City School Construction Authority, Montgomery County, MD, Mesa, AZ, Cook County, IL and Illinois) with sources: ["sled"]. That is a small set, not a nationwide state and local feed.

Fields you get

FieldWhat it holds
noticeId, solicitationNumber, titleSAM.gov notice id, solicitation number and title
department, subTier, officeThe contracting organization; agency holds the department
type, baseType, statusNotice type (for example Combined Synopsis/Solicitation) and active or inactive
postedDate, responseDeadLine, archiveDatecloseDate repeats the response deadline
naicsCode, classificationCode, setAside, setAsideCodeClassification and set-aside
placeOfPerformanceCity, state, ZIP and country
pointOfContact[]Type, name, title, email and phone, as published
awardAward number, amount, date and awardee on award notices
url, descriptionUrl, isNew, isUpdatedNotice link, the description endpoint, and monitor-mode flags

Example output

One SAM.gov notice (shape from the Actor's normalizer; illustrative values from its test fixture):

{
  "source": "samGov",
  "recordType": "opportunity",
  "keyword": "it support",
  "opportunityId": "ab12cd34ef56ab12cd34ef56ab12cd34",
  "noticeId": "ab12cd34ef56ab12cd34ef56ab12cd34",
  "title": "Small Business IT Support Services",
  "solicitationNumber": "W912DY26R0012",
  "agency": "DEPT OF DEFENSE",
  "department": "DEPT OF DEFENSE",
  "subTier": "DEPT OF THE ARMY",
  "office": "ACC-APG",
  "status": "active",
  "type": "Combined Synopsis/Solicitation",
  "postedDate": "2026-10-12",
  "responseDeadLine": "2026-11-15T14:00:00-05:00",
  "closeDate": "2026-11-15T14:00:00-05:00",
  "naicsCode": "541512",
  "classificationCode": "D399",
  "setAside": "Total Small Business Set-Aside (FAR 19.5)",
  "setAsideCode": "SBA",
  "placeOfPerformance": {
    "city": "Aberdeen Proving Ground",
    "state": "MD",
    "zip": "21005",
    "country": "UNITED STATES"
  },
  "pointOfContact": [
    {
      "type": "primary",
      "fullName": "John Q. Public",
      "title": "Contract Specialist",
      "email": "contracting.officer@army.mil",
      "phone": "410-555-0199",
      "fax": null
    }
  ],
  "award": null,
  "url": "https://sam.gov/opp/ab12cd34ef56ab12cd34ef56ab12cd34/view",
  "descriptionUrl": "https://api.sam.gov/prod/opportunities/v1/noticedesc?noticeid=ab12cd34ef56ab12cd34ef56ab12cd34",
  "jurisdiction": "United States",
  "level": "federal"
}

Use cases

Set-aside alerts for one NAICS code

Filter samFilters by NAICS, set-aside and state, schedule daily with onlyNewSinceLastRun, and send new notices to a webhook.

Grants and contracts in one feed

Enable grantsGov and samGov together. Both share title, agency, postedDate, closeDate and url.

Bid/no-bid triage

Send the notices to the Grant Matching and RFP Bid/No-Bid Scorer to rank them against your company profile.

How to run it

You need an Apify account and its API token (Console → Settings → API & Integrations). Each run is billed per result to your account; set a maximum total charge for the run to cap spend.

With curl

The sync endpoint starts a run, waits up to 300 seconds and returns the dataset items. Small business set-aside notices for one NAICS code in Virginia, posted in the last 7 days (replace the key placeholder with your own key):

export APIFY_TOKEN=<your Apify API token>

curl -sS -X POST \
  "https://api.apify.com/v2/acts/owlabee~grants-gov-api/run-sync-get-dataset-items" \
  -H "Authorization: Bearer ${APIFY_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
  "keywords": [
    "cybersecurity"
  ],
  "sources": [
    "samGov"
  ],
  "samApiKey": "<YOUR_SAM_GOV_API_KEY>",
  "samFilters": {
    "naics": "541512",
    "setAside": "SBA",
    "state": "VA",
    "ptype": "o,k"
  },
  "postedWithinDays": 7,
  "maxResults": 100,
  "onlyNewSinceLastRun": true
}'

From an AI agent (MCP)

Apify hosts an MCP server. This config exposes only this Actor to the agent:

{
  "mcpServers": {
    "owlabee-grants-gov-api": {
      "url": "https://mcp.apify.com/?tools=owlabee/grants-gov-api",
      "headers": {
        "Authorization": "Bearer ${APIFY_TOKEN}"
      }
    }
  }
}

Then ask, for example: Find SAM.gov solicitations posted this week for NAICS 541512 that are small business set-asides in Virginia, with response deadlines and points of contact.

Python, Node.js and more examples

Runnable curl.sh, python.py, node.mjs and mcp.json files for this Actor are in examples/grants-gov-api on GitHub.

No code: Zapier, Make or n8n

Apify's official apps on these platforms can run this Actor and pass its results on. Step-by-step recipes: New Grants.gov Opportunities to Google Sheets with Zapier.

FAQ

Is a SAM.gov key really free?

Yes. Any individual with a SAM.gov account can request a personal public API key from Account Details. Federal and entity-associated accounts get larger daily allowances.

What do the ptype and setAside codes mean?

They are passed straight to SAM.gov. Notice types: o Solicitation, k Combined Synopsis/Solicitation, p Presolicitation, r Sources Sought, s Special Notice, a Award Notice (comma-separate several). Set-aside codes include SBA, 8A, HZC, SDVOSBC and WOSB; the input field lists them all.

Does it read the sam.gov website?

No. Only the official API, with your key. No HTML scraping, proxies or login.

What if my daily quota runs out?

SAM.gov answers with a rate-limit error and the Actor writes one SAM_RATE_LIMITED error item for that keyword; the other sources continue.

Can it include recent awards?

Yes. includeRecentAwards adds USAspending.gov award records for the same keywords.