# SAM.gov Contract Opportunities Watcher - New Federal Bids Daily (`dennydevelops/sam-gov-watcher`) Actor

Daily new federal contract opportunities from SAM.gov filtered by NAICS, state, set-aside and notice type. Returns only notices that are new since your last run. No API key needed.

- **URL**: https://apify.com/dennydevelops/sam-gov-watcher.md
- **Developed by:** [Musedenny](https://apify.com/dennydevelops) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 contract notices

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Contract Opportunities Watcher – New Federal Bids Daily

Get **new federal contract opportunities from SAM.gov every day**, filtered to what you can actually bid on: NAICS code, state, set-aside, notice type and keywords. Each notice is returned **once**: schedule it daily and you only ever see what's new since the last run.

- **No API key needed.** Uses SAM.gov's free official daily *Contract Opportunities* bulk extract, so you are not limited by the public API's ~10 requests/day. (You can switch to the API with your own key if you prefer.)
- **Reliable by design**: one official file per day, retries with backoff, a clear error message if SAM.gov is down, and no scraping of the SAM.gov website.
- **Clean, consistent output**: agency, office, NAICS, PSC, set-aside, response deadline, place of performance, award details and a direct SAM.gov link.
- No personal data: point-of-contact names, emails and phone numbers are left out.

### Input

```json
{
  "naicsCodes": ["5415", "541611"],
  "states": ["CO", "UT"],
  "setAsideCodes": ["SBA", "SDVOSBC"],
  "noticeTypes": ["Solicitation", "Combined Synopsis/Solicitation", "Presolicitation", "Sources Sought"],
  "keywords": ["cloud", "software"],
  "postedWithinDays": 3,
  "onlyNew": true
}
```

| Field | Default | Description |
|---|---|---|
| `naicsCodes` | all | 2–6 digit codes or prefixes (`5415` matches 541511, 541512, …). |
| `states` | all | Two-letter codes, matched on place of performance (office state if missing). `stateField` switches to office or either. |
| `setAsideCodes` | all | SAM.gov codes, e.g. `SBA`, `SBP`, `8A`, `8AN`, `HZC`, `SDVOSBC`, `WOSB`, `EDWOSB`, `VSA`, `ISBEE`. `NONE` = no set-aside. |
| `noticeTypes` | Solicitation, Combined Synopsis/Solicitation, Presolicitation, Sources Sought | Also: Special Notice, Award Notice, Justification, Intent to Bundle Requirements (DoD-Funded), Sale of Surplus Property. |
| `keywords` / `excludeKeywords` | – | Matched in title and description (any word; case-insensitive). |
| `postedWithinDays` | 3 | Window of posting dates to consider. |
| `onlyNew` | false | **Turn on for daily schedules:** return each notice only once per filter set (state kept in a named key-value store). |
| `activeOnly` | true | Skip archived/inactive notices. |
| `excludeExpired` | true | Skip notices whose response deadline has passed. |
| `includeDescription` | true | Include the description text (first 2,000 chars). |
| `maxResults` | 5000 | Cap per run. |
| `source` | bulk | `api` uses the SAM.gov public API with `samApiKey`. |

### Output

```json
{
  "noticeId": "c9d8c27ff1b24620b4918251397f0c57",
  "title": "CTX ARMORED CAR SERVICES",
  "solicitationNumber": "36C257-27-AP-0929",
  "agency": "VETERANS AFFAIRS, DEPARTMENT OF",
  "subTier": "VETERANS AFFAIRS, DEPARTMENT OF",
  "office": "257-NETWORK CONTRACT OFFICE 17 (36C257)",
  "postedDate": "2026-10-31 17:58:22",
  "noticeType": "Sources Sought",
  "baseType": "Sources Sought",
  "setAsideCode": null,
  "setAside": null,
  "responseDeadline": "2026-11-10T10:00:00-06:00",
  "naicsCode": "561613",
  "pscCode": "V127",
  "placeOfPerformance": {"city": "Temple", "state": "TX", "zip": "76504", "country": "USA"},
  "officeLocation": {"city": "San Antonio", "state": "TX", "zip": "78240"},
  "active": true,
  "archiveDate": "2026-11-25",
  "award": null,
  "description": "Armored Car Services **SEE Attachment for DETAILS**",
  "additionalInfoLink": null,
  "link": "https://sam.gov/workspace/contract/opp/c9d8c27ff1b24620b4918251397f0c57/view",
  "source": "bulk-extract",
  "firstSeenAt": "2026-11-01T09:00:00Z"
}
```

### Scheduling

Create a daily schedule (e.g. 07:00 Eastern; SAM.gov refreshes the extract early each morning). If the extract hasn't changed since the last run, the run ends in seconds without downloading it again.

### Pricing (pay per event + usage)

| Event | Price | When |
|---|---|---|
| `apify-actor-start` | $0.003 | Apify built-in event, charged once per run (per GB of memory above 1 GB). Covers start-up cost and deters empty runs. |
| `notice` | $0.002 | One new contract opportunity matching your filters. |

Example: a daily watch returning 20 new notices costs $0.003 + 20 × $0.002 = $0.043 per day.

Plus Apify platform usage for the run itself (server time), typically **$0.0002–0.0005 per run** because the Actor is lightweight and capped at 512 MB. The run stops cleanly when your maximum cost per run is reached.

### Notes

- The extract is ~200 MB; a full run takes about a minute and needs 1 GB memory.
- The API source can't combine several NAICS codes/states in one request, so it fetches broader results and filters locally; with no registered entity, SAM.gov allows only ~10 API requests per day.

### Local development

```bash
pip install -r requirements.txt pytest pytest-asyncio respx
pytest          # HTTP mocked, uses a recorded sample of the real extract (contacts removed)
python -m src   # reads storage/key_value_stores/default/INPUT.json
```

# Actor input Schema

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

2-6 digit NAICS codes or prefixes. 5415 matches all of 541511, 541512, ... Empty = all.

## `states` (type: `array`):

Two-letter codes (place of performance by default). Empty = all.

## `setAsideCodes` (type: `array`):

e.g. SBA (total small business), SBP (partial), 8A, 8AN, HZC, SDVOSBC, WOSB, EDWOSB, VSA, ISBEE. Use NONE for notices without a set-aside. Empty = all.

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

Empty = all types.

## `keywords` (type: `array`):

Keep notices whose title or description contains any of these (case-insensitive).

## `excludeKeywords` (type: `array`):

Skip notices whose title or description contains any of these words.

## `postedWithinDays` (type: `integer`):

Look at notices posted in the last N days. With 'Only new' on, each notice is returned once, so a daily schedule with 3 days safely covers late postings.

## `onlyNew` (type: `boolean`):

Turn ON for scheduled (daily) runs: each item is then returned only once per filter set (state in the named store below). Off = return everything in the time window.

## `activeOnly` (type: `boolean`):

Skip archived or inactive notices.

## `excludeExpired` (type: `boolean`):

Skip notices whose response deadline has already passed.

## `stateField` (type: `string`):

Which address the state filter checks.

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

Include the notice description text (first 2,000 characters).

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

Maximum number of notices returned per run.

## `source` (type: `string`):

Where the data comes from. The bulk extract needs no key.

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

Only for source 'api'.

## `stateStoreName` (type: `string`):

State store name.

## Actor input object example

```json
{
  "naicsCodes": [
    "5415"
  ],
  "noticeTypes": [
    "Solicitation",
    "Combined Synopsis/Solicitation",
    "Presolicitation",
    "Sources Sought"
  ],
  "postedWithinDays": 3,
  "onlyNew": false,
  "activeOnly": true,
  "excludeExpired": true,
  "stateField": "placeOfPerformance",
  "includeDescription": true,
  "maxResults": 5000,
  "source": "bulk",
  "stateStoreName": "sam-gov-watcher-state"
}
```

# Actor output Schema

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

New SAM.gov notices matching the filters.

## `summary` (type: `string`):

Totals for this run (JSON).

# 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": [
        "5415"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dennydevelops/sam-gov-watcher").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": ["5415"] }

# Run the Actor and wait for it to finish
run = client.actor("dennydevelops/sam-gov-watcher").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": [
    "5415"
  ]
}' |
apify call dennydevelops/sam-gov-watcher --silent --output-dataset

```

## MCP server setup

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

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/GavrbvCYzwkBSF7JR/builds/NkhtBsMN5BRrTmpGC/openapi.json
