# SAM.gov Federal Contract Opportunities Scraper (`acute_view/sam-gov-opportunities`) Actor

Search SAM.gov federal opportunities without an API key. Filter by keyword, NAICS, agency, set-aside and notice type. Export privacy-safe flat records or monitor only new notices across scheduled runs.

- **URL**: https://apify.com/acute_view/sam-gov-opportunities.md
- **Developed by:** [abhinav subedi](https://apify.com/acute_view) (community)
- **Categories:** Lead generation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 opportunity saveds

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 Contract Opportunities Scraper

Find federal contracting opportunities without a SAM.gov API key. Export flat, source-linked records for bid pipelines, market research, small-business opportunity discovery and award tracking. Schedule monitor runs to deliver only previously unseen notice IDs.

### Quick start

Run with defaults for the latest 100 active notices, or use:

```json
{
  "keywords": "cybersecurity",
  "naics": "541512",
  "activeOnly": true,
  "maxResults": 50,
  "maxScanResults": 1000,
  "monitorMode": false
}
```

Download the dataset as JSON, CSV, Excel or feed it into your CRM via the Apify API. No SAM.gov credentials, paid API subscription, or proxy configuration required.

### Inputs

| Input | Default | Purpose |
|---|---|---|
| `keywords` | all | SAM.gov full-text search phrase |
| `naics` | all | One exact NAICS code, e.g. `541512` |
| `setAside` | all | One code: e.g. `SBA` (total small business), `8A`, `HZC`, `SDVOSBC`, `WOSB` |
| `noticeType` | all | `p` presolicitation, `o` solicitation, `k` combined synopsis, `r` sources sought, `s` special notice, `a` award, `u` justification, `i` intent to bundle |
| `agencyId` | all | SAM.gov organization ID, e.g. `100000000` (Defense), matched at any hierarchy level |
| `activeOnly` | `true` | Exclude inactive/archived notices |
| `postedFrom`, `postedTo` | none | Inclusive UTC posting dates, `YYYY-MM-DD` |
| `maxResults` | `100` | Maximum output/chargeable results, 1–10,000 |
| `maxScanResults` | `1000` | Maximum source records examined, 1–10,000 |
| `monitorMode` | `false` | Emit only notices not already delivered |
| `seenStoreName` | `sam-gov-opportunities-seen` | Named persistent key-value store for monitor history |

Filters combine with AND. Keyword search uses SAM.gov's search semantics. Searches are sorted by most recently modified date. Posted-date filtering happens locally, so older date ranges may require a narrower keyword/agency/NAICS query or a larger scan limit. SAM.gov caps each query at 10,000 records; this is not a complete historical database export. `SUMMARY` in the run key-value store reports scanned/saved counts and limit flags. A scan-limit warning means more matches may exist.

### Output example

```json
{
  "noticeId": "example-notice-id",
  "solicitationNumber": "EXAMPLE-2026-001",
  "title": "Software support services",
  "type": "Solicitation",
  "typeCode": "o",
  "agency": "DEPT OF DEFENSE",
  "subAgency": "DEFENSE LOGISTICS AGENCY",
  "office": "CONTRACTING OFFICE",
  "agencyHierarchy": "DEPT OF DEFENSE > DEFENSE LOGISTICS AGENCY > CONTRACTING OFFICE",
  "postedDate": "2026-11-01T12:00:00+00:00",
  "modifiedDate": "2026-11-01T12:00:00+00:00",
  "responseDeadline": "2026-12-01T17:00:00+00:00",
  "naics": "541512",
  "psc": "D302",
  "setAside": "Total Small Business Set-Aside (FAR 19.5)",
  "setAsideCode": "SBA",
  "placeOfPerformance": "Washington, DC, USA",
  "awardNumber": null,
  "awardDate": null,
  "awardAmount": null,
  "awardeeUei": null,
  "descriptionSnippet": "Software support services for agency operations.",
  "url": "https://sam.gov/opp/example-notice-id/view",
  "active": true
}
```

Missing source fields are null. Multiple codes or locations are separated by `|`. Award fields are populated only when available in search results. Descriptions are plain-text snippets up to 1,000 characters, not full solicitation documents. This Actor does not download attachments or fetch additional detail endpoints.

#### Privacy

Point-of-contact objects, names, email addresses, phone numbers and fax numbers are not exported. Known contact names are scrubbed from text, email/phone patterns are redacted, and labelled contact sections are omitted. Awardee names are intentionally not exported (an awardee can be an individual); organizational UEI is provided instead. This is opportunity intelligence, not a personal-contact lead list.

### Monitor mode

Enable `monitorMode` and choose a unique `seenStoreName` for each search. The first run outputs matching current notices; later runs skip IDs already output successfully, including amendments to the same ID. Only emitted notices enter history, so skipped or charge-limited notices remain eligible. History is a named key-value store and survives run storage cleanup. Change the store name or delete that store to start fresh. Do not run concurrent executions against the same history store: check-and-write is not atomic. A crash after dataset write but before history write can replay the last item; deduplicate downstream by `noticeId` for exactly-once workflows.

Use Apify schedules for daily or hourly searches. Keep filters stable per store. Monitoring scans the newest modified notices up to `maxScanResults`; increase the limit or run more frequently to avoid missing busy intervals. This is new-ID monitoring, not amendment tracking or a guarantee of exhaustive coverage.

### Pricing

**$2.00 per 1,000 results ($0.002 per opportunity)**, no startup event or extra detail fees. Only delivered dataset items incur the `result` event. Monitor duplicates and nonmatching notices are not charged. Set a maximum total charge in Apify run settings; the SDK stops output at that cap. Platform usage terms and your Apify plan still apply; the live Store pricing panel is authoritative.

### Reliability and limitations

Transient source errors are retried three times with timeouts. A persistent HTTP or schema error fails the run instead of presenting a successful empty search. Previously saved output remains available. SAM.gov may change its public search API or restrict availability; no completeness, deadline, or award accuracy guarantee is made. Always verify notices, amendments and submission instructions on the linked SAM.gov page before bidding. Not affiliated with or endorsed by SAM.gov or the U.S. government.

### Local development

```sh
npm ci
npm test
## Save input to storage/key_value_stores/default/INPUT.json
apify run --purge
apify push
```

`publish.mjs` configures only this Actor's pay-per-event pricing and Store metadata after deployment. It requires `APIFY_TOKEN` and never changes other Actors.

# Actor input Schema

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

SAM.gov full-text search phrase, e.g. cybersecurity.

## `naics` (type: `string`):

One exact NAICS code, e.g. 541512.

## `setAside` (type: `string`):

One SAM.gov code, e.g. SBA, 8A, HZC, SDVOSBC or WOSB.

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

Leave empty for all types.

## `agencyId` (type: `string`):

SAM.gov organization ID at any hierarchy level, e.g. 100000000 for Department of Defense.

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

Exclude archived or inactive notices.

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

Inclusive UTC date YYYY-MM-DD. Applied to returned notices locally within the scan limit.

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

Inclusive UTC date YYYY-MM-DD. Applied locally within the scan limit.

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

Maximum new records to save and charge for.

## `maxScanResults` (type: `integer`):

Bounds search work when monitoring or filtering dates. SAM.gov exposes at most 10,000 records per query. Narrow the search if this is reached.

## `monitorMode` (type: `boolean`):

Persist successfully output IDs and skip them on later runs. First run emits current matching notices.

## `seenStoreName` (type: `string`):

Use a unique name per search; do not run concurrent monitors sharing a store. Change name to reset history.

## Actor input object example

```json
{
  "activeOnly": true,
  "maxResults": 100,
  "maxScanResults": 1000,
  "monitorMode": false,
  "seenStoreName": "sam-gov-opportunities-seen"
}
```

# Actor output Schema

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

No description

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("acute_view/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 = {}

# Run the Actor and wait for it to finish
run = client.actor("acute_view/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 '{}' |
apify call acute_view/sam-gov-opportunities --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,acute_view/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/rNJPjbQZQJNvPWrHd/builds/8zIhem8ZTMR94jNCM/openapi.json
