# SAM.gov Federal Opportunities Finder (Official API + Awards) (`leecrowesoftware/sam-gov-opportunities`) Actor

Search official SAM.gov contract opportunities by NAICS, PSC, set-aside, agency and dates. Export a clean dataset with public notice links, add optional USAspending award history, and schedule "what's new" monitoring. Official SAM.gov API with your own free key, no scraping.

- **URL**: https://apify.com/leecrowesoftware/sam-gov-opportunities.md
- **Developed by:** [Lee Crowe](https://apify.com/leecrowesoftware) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 opportunities

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SAM.gov Federal Opportunities Finder (Official API + Awards)

Search current **SAM.gov contract opportunities** by NAICS code, PSC code, set-aside, notice type,
agency, place of performance and dates, and export a clean, deduplicated dataset with public notice
links. Optionally add **USAspending.gov award history** to each notice, and run it on a schedule to
get only **what's new since the last run**.

It uses the **official SAM.gov Get Opportunities Public API** with **your own free API key**. It does
not scrape sam.gov, and it is not affiliated with or endorsed by GSA, SAM.gov or USAspending.gov.

### What it does, and what it doesn't

**Does:** searches the official API; maps the filters SAM.gov supports; removes duplicates; gives a
notice link that opens without a SAM.gov login; optionally adds award history; supports scheduled
"new or changed only" runs.

**Doesn't:** scrape sam.gov or any login-only portal; download attachment files (you get the links);
use a shared API key; work as a bulk download of USAspending.

### Who it's for

- Small and mid-size federal contractors and GovCon business-development teams.
- Consultants and MSPs selling into federal IT, who filter by NAICS and PSC.
- Researchers and lead-generation teams who want structured federal procurement data.

### Get your free SAM.gov API key

1. Create a free account at [SAM.gov](https://sam.gov) and sign in.
2. Open **Account Details** and request a **Public API Key**.
3. Paste the key into the **SAM.gov API key** field. It is stored as a secret input and is never
   written to logs or results.

**Daily limits matter.** SAM.gov sets how many requests a key may make per day. A non-federal key
with **no entity role is usually limited to 10 requests a day**; a key with an entity role, or a
system account, usually gets 1,000. Each request returns up to 1,000 notices, but each extra NAICS
code, PSC code, set-aside, notice type or state you pick is another request, and **"Include
description text" costs one extra request per notice**. If you hit the limit, the run keeps what it
already collected and tells you. SAM.gov terms forbid sharing a personal key, so each user needs
their own.

### Input

Every filter is optional except the API key. Dates are `YYYY-MM-DD`.

| Field | What it does | Example |
| --- | --- | --- |
| SAM.gov API key | Your own key (required). Stored as a secret. | |
| Title keywords | Words to match in the notice title. SAM.gov searches titles, not full text. | `cybersecurity` |
| NAICS codes | 2 to 6 digit industry codes. | `541511` |
| PSC codes | Product Service Codes. | `D302` |
| Set-asides | Small-business program set-asides. | `SBA`, `8A`, `SDVOSBC` |
| Notice types | Solicitation, Sources Sought, Award Notice and so on. Empty means all. | Solicitation |
| Agency or office name / code | Department, sub-tier or office. | `Department of the Navy` |
| Place of performance states / ZIP | 2-letter state codes and a 5-digit ZIP. | `VA`, `22201` |
| Solicitation number / Notice ID | Look up specific notices. | |
| Posted from / to | Posted date range. Defaults to the last 7 days. At most one year. | `2026-11-01` |
| Response deadline from / to | Response due date range. At most one year. | |
| Maximum results | Stop after this many unique notices (default 100, up to 10,000). | `500` |
| Include description text | Fetch each notice's full description. One extra request per notice. | off |
| Only new or changed notices / Monitor key | Scheduled monitoring; see below. | `it-software-daily` |
| Add USAspending award history | Past contract awards for each notice; see below. | off |
| Award history years / Awards per notice / Match awards by | Award history settings. For solicitations, match by agency and NAICS. | `3`, `10`, recipient |

**How filters turn into requests.** SAM.gov accepts one NAICS code, PSC code, set-aside, state and
notice type per search, so picking several runs one search per combination and merges the results,
removing duplicates. Two NAICS codes × two set-asides is four searches. A run may need at most 20
searches; beyond that the Actor stops before using any requests and asks you to narrow the
filters. Each search returns up to 1,000 notices per request.

### Scheduled monitoring

To get only what's new each day:

1. Set up your search as usual, and leave **Posted from** empty.
2. Turn on **Only new or changed notices** and give it a **Monitor key**, a short name for this
   search such as `it-software-daily`.
3. In Apify, add a **Schedule** for the task (for example every weekday at 7:00).

The first run outputs every matching notice from the last 7 days. After that, each run searches from
the day of the last complete run and outputs only:

- **new** notices (`isNew: true`), and
- notices that **changed** since you last got them (`isNew: false`), with `changeSummary` listing what
  changed, such as `responseDeadline, title`.

Unchanged notices are skipped and **not charged**. If a run stops early (maximum results, the daily
SAM.gov limit or your maximum cost per run), the next run searches the same days again and picks up where it left off, without
resending notices you already have. Progress is saved after each page, so a run that crashes or
times out doesn't resend them either.

Good to know:

- Each monitor key keeps its own history. Use a different key for each separate search.
- If you change a search's filters but keep the key, the next run searches the normal 7-day window
  again; notices you already got are still skipped unless they changed.
- The history is stored in a key-value store named `sam-gov-opportunities-monitors` in your Apify
  account. Delete the `monitor-<your key>` record there to start a monitor from scratch.
- Changes are spotted on notices the search returns. SAM.gov returns notices by posted date, so an
  edit that SAM.gov makes without re-posting the notice may not be picked up.

### Get new notices by email, Slack or Google Sheets

The usual setup is a daily monitor that delivers what's new to where your team already works. It
takes about ten minutes, and you only do it once.

**1. Save your search as a task.** Set up the input as in [Scheduled monitoring](#scheduled-monitoring)
(your key, your filters, **Only new or changed notices** on, and a **Monitor key**), then click
**Save as a new task** at the top right of the Actor page. The task keeps your input, so the
schedule and integrations below always run the same search.

**2. Run it every day.** Go to **Schedules** → **Create new**. Set the time with a cron expression,
for example `0 7 * * 1-5` for 7:00 every weekday. Click **Add**, choose your task, then click
**Enable**: new schedules start disabled.

**3. Send the results somewhere.** Open your task's **Integrations** tab and add one of these.

#### Email (Gmail)

Choose **Send results email via Gmail**, click **Connect with Google**, and pick the account to send
from. Write a subject and body, attach the results, then **Save** and enable it. By default an email
goes out after each successful run.

#### Slack

Choose **Slack**, click **Configure** and connect your workspace, then pick the run-succeeded event
and a channel. Paste this into **Message** to get the run's summary and a link to the results:

```handlebars
*New SAM.gov opportunities*
{{resource.statusMessage}}
<https://console.apify.com/storage/datasets/{{resource.defaultDatasetId}}|Open the results>
```

Click **Save**, then **Start** to send a test message.

#### Google Sheets (with Zapier)

Build a Zap that uses the Apify app:

1. Trigger: **Finished task run**, with your task.
2. Search: **Fetch dataset items**, using the dataset from the trigger.
3. Action: Google Sheets **Create Spreadsheet Row**, mapping the columns you want, such as `title`,
   `department`, `responseDeadline`, `setAsideDescription` and `samUrl`.

Make and n8n have Apify modules that work the same way.

**Good to know**

- A day with nothing new still finishes successfully, so email and Slack still send. The summary
  then says "No new or changed notices", and you pay only the start fee for that run.
- Use one task, with its own monitor key, for each separate search, for example one per NAICS
  family or per customer.

### USAspending award history

Turn on **Add USAspending award history** to attach past federal contract awards to each notice
saved. It uses the public USAspending.gov API, needs no key, and uses none of your SAM.gov requests.

**Match awards by** decides which awards count as related. Pick one or more; they are combined:

| Choice | Matches awards… | Good for |
| --- | --- | --- |
| Recipient | to the company named as awardee | Award notices: the winner's track record |
| Awarding agency | made by the notice's sub-agency (for example Department of the Army) | Solicitations: who this buyer pays |
| NAICS code | in the notice's NAICS code | Solicitations: who wins this kind of work |

Recipient is the default, but only award notices name an awardee. For solicitations and sources
sought notices, choose agency and NAICS together to see who has won similar work from the same buyer.

**Nothing is guessed.** A detail the notice doesn't have is left out of the match, and
`matchedOn` lists what was actually used. A notice with nothing to match on gets no award history
and isn't charged for it.

- **Agency** is matched by the official sub-agency code, not by name, so two agencies with similar
  names (both Interior and Treasury have "Departmental Offices") are never mixed up.
- **Recipient** is matched by the company's UEI. SAM.gov rarely publishes the awardee's UEI, so the
  Actor finds it on USAspending: first from the notice's own award number, then from past awards
  to a company whose name is exactly the awardee's (ignoring case and punctuation). If two
  companies share that name, there is no match. `recipientMatchedBy` says which way was used.
  USAspending receives contract data days to weeks after the award (DoD awards up to 90 days
  later), so for a brand-new award the award itself usually isn't listed yet.

Each enriched notice gets a `usaspending` object:

```json
{
  "matchedOn": ["agency", "naics"],
  "recipientMatchedBy": null,
  "recipientUei": null,
  "recipientName": null,
  "agency": "Example Sub-Agency",
  "naicsCode": "541511",
  "windowStart": "2023-11-14",
  "windowEnd": "2026-11-14",
  "awardCountInWindow": 235,
  "obligatedAmountInWindow": 54356713.02,
  "awards": [
    {
      "awardId": "CONT_AWD_EXAMPLE0001_0000_-NONE-_-NONE-",
      "piidOrFain": "EXAMPLE0001",
      "awardType": "DELIVERY ORDER",
      "recipientName": "EXAMPLE SOLUTIONS LLC",
      "recipientUei": "EXAMPLEUEI12",
      "awardingAgency": "Example Sub-Agency",
      "naicsCode": "541511",
      "obligation": 1137898.8,
      "startDate": "2026-09-29",
      "endDate": "2027-09-28",
      "usaspendingUrl": "https://www.usaspending.gov/award/CONT_AWD_EXAMPLE0001_0000_-NONE-_-NONE-"
    }
  ]
}
```

- `awardCountInWindow` counts every contract award with activity in the window, and
  `obligatedAmountInWindow` adds up the dollars obligated in it. `awards` lists only the most recent
  (by start date), up to **Awards per notice**; each `obligation` is that award's total.
- Only contracts are searched (definitive contracts, purchase orders, delivery and task orders),
  not grants or loans.
- If USAspending is unavailable, notices are still saved with `usaspending` empty, the status
  message says so, and those notices aren't charged for award history. The run itself doesn't fail.
- Notices that share a match (same agency and NAICS, say) reuse one lookup, so large runs stay quick.

### Output

One row per unique notice. Main fields:

| Field | Meaning |
| --- | --- |
| `noticeId`, `solicitationNumber`, `title` | Identifiers and title. |
| `noticeType` | Label plus code, such as `Solicitation (o)`. |
| `postedDate`, `responseDeadline`, `archiveDate` | ISO 8601 dates. |
| `naicsCode`, `pscCode` | Industry and product codes. |
| `setAsideCode`, `setAsideDescription` | Empty when the notice has no set-aside. |
| `department`, `subtier`, `office`, `organizationName` | The issuing organization. |
| `placeOfPerformance` | City, state, ZIP and country where available. |
| `pointOfContact` | Contracting contacts as published on the notice. |
| `award` | Award number, amount, date and awardee, on award notices. |
| `resourceLinks` | Attachment links. Files are not downloaded. |
| `samUrl` | Public SAM.gov page for the notice. Opens without a SAM.gov login. |
| `descriptionText` | Full description, only when "Include description text" is on. |
| `isNew`, `changeSummary` | In scheduled monitoring: whether the notice is new, and which fields changed if not. |
| `usaspending` | Award history, when turned on; see above. Not compared between scheduled runs. |

Sample record (fictional):

```json
{
  "noticeId": "0a1b2c3d4e5f60718293a4b5c6d7e8f9",
  "solicitationNumber": "EXAMPLE-26-R-0001",
  "title": "Cloud Help Desk Support Services",
  "noticeType": "Combined Synopsis/Solicitation (k)",
  "postedDate": "2026-11-10",
  "responseDeadline": "2026-12-05T19:00:00.000Z",
  "naicsCode": "541511",
  "pscCode": "DA01",
  "setAsideCode": "SBA",
  "setAsideDescription": "Total Small Business Set-Aside (FAR 19.5)",
  "department": "EXAMPLE DEPARTMENT",
  "subtier": "EXAMPLE SUB-AGENCY",
  "office": "EXAMPLE CONTRACTING OFFICE",
  "placeOfPerformance": { "city": "Richmond", "state": "VA", "zip": "23219", "country": "USA" },
  "pointOfContact": [{ "type": "primary", "title": "Contracting Officer", "fullName": "Jane Example", "email": "jane.example@example.gov", "phone": "555-0100" }],
  "award": null,
  "resourceLinks": [],
  "samUrl": "https://sam.gov/opp/0a1b2c3d4e5f60718293a4b5c6d7e8f9/view",
  "source": "sam.gov",
  "isNew": true,
  "retrievedAt": "2026-11-14T15:00:00.000Z"
}
```

At the end of each run the status message says how many notices were saved, how many SAM.gov
requests were used, how many notices got award history, and why the run stopped (end of results,
maximum reached, or daily limit).

### Pricing

| Event | Price (Bronze) |
| --- | --- |
| Run start | $0.01 |
| Each opportunity in the results | $0.003 ($3 per 1,000) |
| Each notice whose award history finds at least one award | $0.005 |

**Not charged:** duplicates, unchanged notices in scheduled runs, notices with nothing to match
awards on, award lookups that find no awards, failed award lookups, and description fetches. A run whose SAM.gov key is rejected
saves nothing and is charged only the start fee.

Example: a daily monitor that finds 20 new notices, without award history, costs about
$0.01 + 20 × $0.003 = **$0.07** a run.

**Maximum cost per run.** If you set a maximum cost per run in the run options, the Actor never
goes over it. It checks the budget before doing the work: a notice is saved only if the budget
covers it, and it stops before asking SAM.gov for a page it couldn't afford to save, so your daily
SAM.gov requests aren't wasted. Notices come first. When the budget runs short, the remaining
notices are saved without award history, and the status message says so. In scheduled monitoring,
notices left out this way are picked up by the next run.

### Legal

Data comes from the official SAM.gov and USAspending.gov public APIs, called with your own SAM.gov
key under the [SAM.gov Terms of Use](https://sam.gov/about/terms-of-use). Published by Lee Crowe
Software Solutions LLC. Not affiliated with GSA, SAM.gov or USAspending.gov.

### FAQ

**Why do I need my own SAM.gov key?** SAM.gov's terms forbid sharing a personal API key, so each
user needs their own. The key is free; see above.

**Why did my run stop early?** The status message always says why: the maximum results you set,
your key's daily SAM.gov limit (the results collected before it are kept), or your maximum cost
per run.

**Why did a notice get no award history?** It had nothing to match on: recipient matching only
works on award notices, which name an awardee. Use agency and NAICS for solicitations. Notices
without award history aren't charged for it, and neither are lookups that find no past awards.

**Are attachments downloaded?** No. `resourceLinks` lists the attachment links SAM.gov publishes.

**Is the data official?** Yes: everything comes straight from the SAM.gov and USAspending.gov
public APIs. The Actor reshapes it and adds a few labels of its own (such as `isNew` and
`matchedOn`), but doesn't change what the agency published, so a notice is only as accurate as its
SAM.gov posting.

### Changelog and issues

See the **Changelog** tab for what changed in each version. To report a problem or ask for a
feature, open an issue on the **Issues** tab of this Actor's page; include the run ID, never your
API key.

# Changelog

This Actor's version history is a separate document: https://apify.com/leecrowesoftware/sam-gov-opportunities/changelog.md

# Actor input Schema

## `samApiKey` (type: `string`):

Your own free SAM.gov public API key (SAM.gov → Account Details → Public API Key). Each user must use their own key: SAM.gov terms forbid sharing it. Keys without an entity role are usually limited to 10 requests a day.

## `keywords` (type: `string`):

Words to match in the notice title (the SAM.gov API searches titles, not full text). Example: cybersecurity

## `naicsCodes` (type: `array`):

2 to 6 digit NAICS codes. Example: 541511. Each code is one API request.

## `pscCodes` (type: `array`):

Product Service Codes (classification). Example: D302. Each code is one API request.

## `setAsides` (type: `array`):

Set-aside types. Each one selected is one API request.

## `noticeTypes` (type: `array`):

Leave empty for all types. Each one selected is one API request.

## `organizationName` (type: `string`):

Department, sub-tier or office name. Example: Department of the Navy

## `organizationCode` (type: `string`):

Organization code, if you know it.

## `placeOfPerformanceStates` (type: `array`):

2-letter state codes. Example: VA. Each state is one API request.

## `placeOfPerformanceZip` (type: `string`):

5-digit ZIP code.

## `solicitationNumber` (type: `string`):

Find notices for one solicitation number.

## `noticeId` (type: `string`):

Look up a single notice by its SAM.gov notice ID.

## `postedFrom` (type: `string`):

Earliest posted date. Defaults to 7 days before Posted to. The posted range can span at most one year.

## `postedTo` (type: `string`):

Latest posted date. Defaults to today (UTC).

## `responseFrom` (type: `string`):

Earliest response deadline. The range can span at most one year.

## `responseTo` (type: `string`):

Latest response deadline.

## `maxResults` (type: `integer`):

Stop once this many unique notices are collected. Capped at 10,000 to protect your SAM.gov quota.

## `incremental` (type: `boolean`):

For scheduled runs: output (and charge for) only notices that are new or changed since the last run with the same monitor key.

## `monitorKey` (type: `string`):

Required when 'Only new or changed notices' is on. A stable name for this search. Example: it-software-daily

## `includeDescription` (type: `boolean`):

Fetch each notice's full description. Costs one extra SAM.gov API request per notice, which quickly uses up a 10-request-a-day key.

## `enrichWithAwards` (type: `boolean`):

Look up past contract awards on USAspending.gov for each notice saved. No extra SAM.gov requests. Charged per notice that gets award history; notices with nothing to match on, or whose lookup fails, are not charged.

## `awardLookbackYears` (type: `integer`):

How many years of awards to look back, counting back from the day of the run.

## `awardMaxPerNotice` (type: `integer`):

Most recent awards (by start date) to list per notice. The total count and dollars cover every award in the window.

## `awardSearchBy` (type: `array`):

Which notice details to match award history on; several are combined. Recipient only works on award notices, which name an awardee: for solicitations, pick agency and/or NAICS to see who has won similar work. Details a notice lacks are left out, and a notice with none of them gets no award history (it is never guessed).

## Actor input object example

```json
{
  "naicsCodes": [
    "541511"
  ],
  "maxResults": 100,
  "incremental": false,
  "includeDescription": false,
  "enrichWithAwards": false,
  "awardLookbackYears": 3,
  "awardMaxPerNotice": 10,
  "awardSearchBy": [
    "recipient"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

One row per notice, with public SAM.gov links and, when turned on, USAspending award history.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "naicsCodes": [
        "541511"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leecrowesoftware/sam-gov-opportunities").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "naicsCodes": ["541511"] }

# Run the Actor and wait for it to finish
run = client.actor("leecrowesoftware/sam-gov-opportunities").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "naicsCodes": [
    "541511"
  ]
}' |
apify call leecrowesoftware/sam-gov-opportunities --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,leecrowesoftware/sam-gov-opportunities"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/ruybQb7ocJ5L0GD2p/builds/s0emb2QZoDRIg7qLc/openapi.json
