# SAM.gov & Grants.gov Scraper: Federal Contracts & Grants (`govdata-tools-us/federal-opportunities-grants-monitor`) Actor

Scrape and monitor new SAM.gov contract opportunities (RFPs, RFQs, sources sought) and Grants.gov federal grants by keyword, title terms, NAICS, CFDA, agency and date. Official APIs, only-new alerts. First 25 results per run free.

- **URL**: https://apify.com/govdata-tools-us/federal-opportunities-grants-monitor.md
- **Developed by:** [GovData Tools](https://apify.com/govdata-tools-us) (community)
- **Categories:** Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.50 / 1,000 opportunity records

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 & Grants.gov Scraper: Federal Contracts & Grants Monitor

> **First 25 results of every run are free.** You pay only for opportunities beyond the first 25 in a run.

Find and **monitor new US federal funding** in one feed, a SAM.gov contract opportunities scraper and Grants.gov federal grants scraper in one Actor: **grants** from Grants.gov and **contract opportunities** (RFPs, RFQs, sources sought) from SAM.gov — filtered by keyword, NAICS, assistance listing (CFDA), agency and posting date, normalized into one clean schema.

Turn on **Only new** and schedule it daily: each run returns only opportunities you haven't seen yet — a ready-made alert feed for Slack, email, Google Sheets, Zapier or Make.

### Why use this SAM.gov and Grants.gov scraper

- **Two sources, one schema** — grants and contracts side by side (source, id, title, agency, NAICS / CFDA, posted, deadline, award ceiling/floor, set-aside, link, contact, description).
- **Official APIs only** — Grants.gov public API (no key) and the SAM.gov Opportunities API v2 (your free key). No scraping, no login, no proxies.
- **Monitor mode** — de-duplicates across runs in a named key-value store.
- **Rich grant details** — award ceiling/floor, estimated funding, agency contact and a cleaned description snippet.
- **Predictable cost** — pay only per opportunity delivered; respects your max-charge limit.

### Input

| Field | Notes |
|---|---|
| `keywords` | List of search terms (each searched separately, merged and de-duplicated). |
| `titleMustContain` | Optional. Keep only records whose title contains at least one of these terms (case-insensitive), for both sources. Cuts loose keyword matches. |
| `sources` | `grants` (default), `sam`. |
| `naicsCodes` | SAM.gov only, e.g. `541512`. |
| `cfdaNumbers` | Grants.gov only, e.g. `47.076`. |
| `agency` | Grants.gov agency code (e.g. `NSF`, `HHS-NIH11`) / SAM.gov organization name. |
| `postedSince` | `YYYY-MM-DD` or `7 days`, `2 weeks`. Default 7 days. SAM.gov max range is 1 year. |
| `samApiKey` | Your SAM.gov public API key (secret). Without it SAM.gov is skipped with a clear message. |
| `onlyNew` | Monitor mode. |
| `maxItems` | Cap on output (and charges). |

#### Getting a SAM.gov key (free)

Sign in at sam.gov → Profile → **Account Details** → Public API Key. Note SAM.gov limits personal keys for non-federal users **without a SAM.gov role to 10 requests/day** (1,000/day with a role). One request returns up to 1,000 notices, so a daily monitor with a few keywords fits easily.

### Output example

```json
{
  "source": "grants.gov",
  "id": "grants:361238",
  "number": "26-503",
  "title": "Artificial Intelligence and Cybersecurity Education Innovation and Scholarship for Service (CyberAI SFS)",
  "agency": "U.S. National Science Foundation",
  "cfda": ["47.076"],
  "postedDate": "2026-02-04",
  "deadline": "2027-04-05",
  "awardCeiling": 2500000, "awardFloor": 300000,
  "url": "https://www.grants.gov/search-results-detail/361238",
  "contactOffice": "U.S. National Science Foundation, grantsgovsupport@nsf.gov, 703-292-4203",
  "description": "Government and the nation face a talent shortfall in artificial intelligence …"
}
```

A run summary (counts, skipped, errors) is stored as `OUTPUT` in the default key-value store.

### Use cases

Grant writers and nonprofits, university research offices, GovCon BD teams, small businesses tracking set-asides, consultants building client alert feeds.

### Pricing

Pay per event: **$2.50 per 1,000 opportunities** delivered ($0.0025 each). No charge for skipped (already-seen) items. **The first 25 results of every run are free** (no charge events for them).

### Limitations

- Grants.gov: forecasted + posted opportunities. Grants.gov has no NAICS; SAM.gov has no CFDA.
- SAM.gov full description text is behind a link that costs an extra API call; we return the notice link instead to save your quota.
- Data is as published by the agencies; this Actor is not affiliated with GSA, SAM.gov or Grants.gov.

# Actor input Schema

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

Search terms. Each keyword is searched separately; results are merged and de-duplicated.

## `titleMustContain` (type: `array`):

Keep only opportunities whose title contains at least one of these terms (case-insensitive). Applied to both Grants.gov and SAM.gov results. Leave empty to keep everything.

## `sources` (type: `array`):

Which sources to query.

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

e.g. 541512. Applied to SAM.gov only (Grants.gov has no NAICS).

## `cfdaNumbers` (type: `array`):

e.g. 47.076

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

Grants.gov agency code (e.g. NSF, HHS-NIH11) and/or SAM.gov organization name (e.g. 'DEPT OF DEFENSE').

## `postedSince` (type: `string`):

YYYY-MM-DD or relative like '7 days'. Default: 7 days. SAM.gov allows max 1 year range.

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

Your personal public API key from sam.gov → Account Details. Without it SAM.gov is skipped.

## `includeDetails` (type: `boolean`):

Fetch award ceiling/floor, description and contact for each grant (1 extra request each).

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

Skip opportunities already returned in previous runs (remembered in a named key-value store).

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

Named key-value store used for onlyNew. Use different names for different monitors.

## `maxItems` (type: `integer`):

Maximum opportunities to output (and charge for).

## Actor input object example

```json
{
  "keywords": [
    "cybersecurity"
  ],
  "sources": [
    "grants"
  ],
  "includeDetails": true,
  "onlyNew": false,
  "stateStoreName": "gov-opps-seen",
  "maxItems": 100
}
```

# Actor output Schema

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

All matched opportunities/grants from the default dataset.

# 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 = {
    "keywords": [
        "cybersecurity"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("govdata-tools-us/federal-opportunities-grants-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 = { "keywords": ["cybersecurity"] }

# Run the Actor and wait for it to finish
run = client.actor("govdata-tools-us/federal-opportunities-grants-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 '{
  "keywords": [
    "cybersecurity"
  ]
}' |
apify call govdata-tools-us/federal-opportunities-grants-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,govdata-tools-us/federal-opportunities-grants-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/A6hegc0yv9SWNE2fX/builds/pc9MxCrqvgse95ytx/openapi.json
