# SAM.gov New-Opportunity Monitor (`delta_tools/samgov-new-opportunity-monitor`) Actor

Watch SAM.gov Contract Opportunities for new federal notices matching your keywords. Built-in cross-run dedup means scheduled re-runs push nothing and cost ~nothing when nothing changed. Pay only per new opportunity detected.

- **URL**: https://apify.com/delta_tools/samgov-new-opportunity-monitor.md
- **Developed by:** [Delta Tools](https://apify.com/delta_tools) (community)
- **Categories:** Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 New-Opportunity Monitor

Watches **SAM.gov Contract Opportunities** for genuinely **new** notices matching
your keyword searches — with built-in cross-run deduplication. Schedule it daily
(or hourly) and get alerted only when something new appears. Quiet runs push
nothing and cost ~nothing.

### Why this instead of a scraper

One-shot SAM.gov scrapers re-bill you for every notice on every scheduled run,
and leave the "what's actually new?" diffing to you. This Actor keeps a snapshot
of every notice it has already seen (per `stateKey`), so:

- **Only genuinely new notices are ever output** — repeat runs with nothing new
  return an empty dataset.
- **You pay per new opportunity, not per notice scanned.** A quiet daily run
  costs only the Actor start ($0.001).
- **No API key, no login, no proxy.** It uses SAM.gov's own unauthenticated
  frontend search API — the same one that powers sam.gov's search box.

### Inputs

| Field | Description |
|---|---|
| `searches` | One entry per keyword search (max 20). Each has `keyword` (required, full-text across titles/descriptions), `activeOnly` (default `true`), `maxResults` (10–1000, default 100), and optional `noticeTypes` (codes: `o` Solicitation, `k` Combined Synopsis/Solicitation, `p` Presolicitation, `r` Sources Sought, `s` Special Notice, `a` Award Notice). |
| `stateKey` | Namespace for the saved snapshot. Use a different key per schedule so monitors never share baselines. |
| `reportInitialAsNew` | On the very first run there is no baseline, so everything is reported as new. Turn off to silently build the baseline instead. |
| `httpTimeoutSeconds` | Per-request timeout (default 45). |

Searches run **newest-first** (SAM.gov `modifiedDate` descending) and diff by
notice ID. Amendments to notices you've already seen do **not** re-report —
only notices never seen before are output.

### Output

One dataset row per new notice: `noticeId`, `title`, `solicitationNumber`,
`noticeType` / `noticeTypeCode`, `agency`, `office`, `excerpt`, `publishDate`,
`modifiedDate`, `responseDate` (due date), `isActive`, `isCanceled`, `samUrl`
(direct link), `keyword` (which search surfaced it), `detectedAt`.

A per-search run receipt (fetched/new counts, errors) is saved in the
`samgov-monitor-state` key-value store under `<stateKey>-last-receipt`, so every
run is auditable.

### Pricing

Pay-per-event: **$0.001 per Actor start + $0.0025 per new opportunity**
(discounted tiers for higher plans). Scanned-but-old notices never bill. Typical
run costs a fraction of a cent in compute — the margin math is in your favor on
quiet runs and very much in your favor on busy ones.

### Honest limitations

- SAM.gov's search API sorts by **modified date**, not publish date: a notice
  amended today sorts as "newest" even if originally published months ago. The
  dedup is by notice ID, so you still only ever see each notice once.
- Server-side NAICS / set-aside filters on this API are unreliable (they
  silently fail open), so notice-type filtering is applied client-side after
  fetching the newest results. Keyword search itself is fully server-side.
- Attachment downloads are out of scope — `samUrl` takes you to the notice.
- This Actor only covers the **Contract Opportunities** index (`opp`), not wage
  determinations, assistance listings, or exclusions.

### Example

```json
{
  "searches": [
    {"keyword": "cybersecurity", "activeOnly": true, "maxResults": 25},
    {"keyword": "janitorial services", "activeOnly": true, "maxResults": 25,
     "noticeTypes": ["o", "k", "p", "r"]}
  ],
  "stateKey": "my-govcon-watch",
  "reportInitialAsNew": true
}
```

Built and maintained by **Delta Tools** — monitoring-grade Actors for the Apify
Store: fresh-listing alerts and opportunity monitoring,
engineered around what users actually ask for.

# Actor input Schema

## `httpTimeoutSeconds` (type: `integer`):

Per-request timeout for SAM.gov API calls.

## `reportInitialAsNew` (type: `boolean`):

On the very first run there is no baseline, so every notice is reported as new. Turn off to silently build the baseline instead.

## `searches` (type: `array`):

One entry per keyword search. Each run fetches the newest notices first and reports only ones never seen before.

## `stateKey` (type: `string`):

Namespace for the saved snapshot, so separate monitors never share baselines. Change it to start fresh.

## Actor input object example

```json
{
  "httpTimeoutSeconds": 45,
  "reportInitialAsNew": true,
  "searches": [
    {
      "activeOnly": true,
      "keyword": "cybersecurity",
      "maxResults": 25,
      "noticeTypes": []
    }
  ],
  "stateKey": "default"
}
```

# Actor output Schema

## `agency` (type: `string`):

Top-level department/agency name.

## `detectedAt` (type: `string`):

ISO timestamp when this run first saw the notice.

## `excerpt` (type: `string`):

First 280 characters of the notice description, when published.

## `isActive` (type: `string`):

Whether the notice is currently active ("true"/"false").

## `isCanceled` (type: `string`):

Whether the notice has been cancelled ("true"/"false").

## `keyword` (type: `string`):

The search keyword that surfaced this notice.

## `modifiedDate` (type: `string`):

When the notice was last modified on SAM.gov.

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

SAM.gov notice ID (dedup key).

## `noticeType` (type: `string`):

Human-readable notice type.

## `noticeTypeCode` (type: `string`):

SAM.gov notice-type code (o, k, p, r, s, a...).

## `office` (type: `string`):

Most specific contracting office name.

## `publishDate` (type: `string`):

When the notice was published on SAM.gov.

## `responseDate` (type: `string`):

Response / due date for the notice.

## `samUrl` (type: `string`):

Direct link to the notice on SAM.gov.

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

Solicitation / notice number.

## `title` (type: `string`):

Notice title.

# 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 = {
    "httpTimeoutSeconds": 45,
    "reportInitialAsNew": true,
    "searches": [
        {
            "activeOnly": true,
            "keyword": "cybersecurity",
            "maxResults": 25,
            "noticeTypes": []
        }
    ],
    "stateKey": "default"
};

// Run the Actor and wait for it to finish
const run = await client.actor("delta_tools/samgov-new-opportunity-monitor").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 = {
    "httpTimeoutSeconds": 45,
    "reportInitialAsNew": True,
    "searches": [{
            "activeOnly": True,
            "keyword": "cybersecurity",
            "maxResults": 25,
            "noticeTypes": [],
        }],
    "stateKey": "default",
}

# Run the Actor and wait for it to finish
run = client.actor("delta_tools/samgov-new-opportunity-monitor").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 '{
  "httpTimeoutSeconds": 45,
  "reportInitialAsNew": true,
  "searches": [
    {
      "activeOnly": true,
      "keyword": "cybersecurity",
      "maxResults": 25,
      "noticeTypes": []
    }
  ],
  "stateKey": "default"
}' |
apify call delta_tools/samgov-new-opportunity-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,delta_tools/samgov-new-opportunity-monitor"
        }
    }
}
```

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/RXhxbkvxBzYVUdAn1/builds/qYKjjEH1sDkteZWaz/openapi.json
