# SAM.gov & Grants.gov Scraper: US Federal Opportunities (`badboxx_newlife/sam-gov-grants-gov-scraper`) Actor

- **URL**: https://apify.com/badboxx_newlife/sam-gov-grants-gov-scraper.md
- **Developed by:** [Francesco Correnti](https://apify.com/badboxx_newlife) (community)
- **Categories:** Lead generation, News
- **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.

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

Government-contractor business developers, grant writers, nonprofit consultants and lead-gen agencies use this actor to track new US federal contract and grant opportunities from SAM.gov and Grants.gov without an API key. It returns a clean list of notices with agency, type, posting date, deadline and notice URL, ready for a CRM, an alert workflow or a weekly bid pipeline. No contact data is collected.

### Sample output

| Source | Title | Type | Agency | Posted | Deadline | URL |
|---|---|---|---|---|---|---|
| sam.gov | 7A21--RFI - Lab EP Evaluator Subscriptions | Presolicitation | VETERANS AFFAIRS, DEPARTMENT OF | 2026-10-15 | 2026-10-30 | [link](https://sam.gov/opp/d40a6997bc6d4e5e8aafab97d900cdee/view) |
| sam.gov | CAMP WOOTEN/STARBUCK LEVEE REHAB | Sources Sought | DEPT OF DEFENSE | 2026-10-15 | 2026-10-30 | [link](https://sam.gov/opp/378345962f0c4bdba329f8380398d5a3/view) |
| grants.gov | Building Sustainable Software Tools for Open Science (R03 Cl | forecast | National Institutes of Health | 2026-02-05 | - | [link](https://www.grants.gov/search-results-detail/361239) |
| grants.gov | NIH Research Software Engineer (RSE) Award (R50 Clinical Tri | synopsis | National Institutes of Health | 2024-07-17 | 2026-12-04 | [link](https://www.grants.gov/search-results-detail/355439) |

Full sample: `sample_output.json` (60 items from a real cloud run).

### Input

| Field | Description | Example |
|---|---|---|
| `source` | Portal to search: `sam` (SAM.gov contract opportunities), `grants` (Grants.gov funding opportunities) or `both`. Default `both`. | `both` |
| `keyword` | Search words matched against title and description. Empty = newest opportunities. | `cybersecurity` |
| `activeOnly` | `true`: only open opportunities (SAM active, Grants.gov forecasted/posted). `false`: also closed and archived. Default `true`. | `true` |
| `maxItems` | Maximum opportunities returned in total (split evenly when `source` is `both`). Caps your cost. Default 50, max 5000. | `50` |

### Output fields

`source`, `id`, `number` (solicitation or funding number), `title`, `type` (notice type), `agency`, `office`, `city`, `state`, `country` (issuing office, SAM only), `postedDate`, `deadline` (ISO dates), `status`, `description` (SAM only, first 400 characters, emails and phone numbers redacted), `awardee` (organisation name, award notices only), `cfda` (assistance listing numbers, Grants.gov only), `url`.

### Pricing (pay per event)

- Actor start: $0.005 per run
- Result: $0.0009 per opportunity ($0.90 per 1,000)

Example: 500 opportunities = $0.005 + 500 x $0.0009 = $0.455. Set `maxItems` to cap spend.

### Notes

- Uses the public search endpoints of sam.gov and api.grants.gov. No login, cookies, captcha or proxy.
- Point-of-contact names, emails and phone numbers are never read or returned.
- Data is public US government information; check sam.gov and grants.gov for the authoritative notice before bidding.

# Actor input Schema

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

Which public portal to search: sam (SAM.gov contract opportunities), grants (Grants.gov funding opportunities) or both.

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

Search words matched against title and description. Leave empty for the newest opportunities.

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

On: only open opportunities (SAM active, Grants.gov forecasted or posted). Off: also closed and archived ones.

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

Maximum number of opportunities returned in total (split evenly when source is both). You pay per item, so this caps your cost.

## Actor input object example

```json
{
  "source": "both",
  "keyword": "software",
  "activeOnly": true,
  "maxItems": 50
}
```

# Actor output Schema

## `opportunities` (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 = {
    "source": "both",
    "keyword": "software",
    "activeOnly": true,
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("badboxx_newlife/sam-gov-grants-gov-scraper").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 = {
    "source": "both",
    "keyword": "software",
    "activeOnly": True,
    "maxItems": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("badboxx_newlife/sam-gov-grants-gov-scraper").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 '{
  "source": "both",
  "keyword": "software",
  "activeOnly": true,
  "maxItems": 50
}' |
apify call badboxx_newlife/sam-gov-grants-gov-scraper --silent --output-dataset

```

## MCP server setup

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

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/ppK38ggGKtAeNhuyO/builds/UicsdsbPYAMR0QCOs/openapi.json
