# SAM.gov Contracts & Awards Scraper with Alerts (`niyomurinzi.elis/sam-gov-contracts-awards`) Actor

- **URL**: https://apify.com/niyomurinzi.elis/sam-gov-contracts-awards.md
- **Developed by:** [Samuel IZABAYO](https://apify.com/niyomurinzi.elis) (community)
- **Categories:** Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.50 / 1,000 results

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 Contract Opportunities & Awarded Contracts Scraper (USAspending) — with New-Only Alerts

Get **federal contract opportunities from SAM.gov** and **awarded federal contracts from USAspending.gov** in one Actor. Filter by keyword, NAICS code, set-aside (8(a), HUBZone, SDVOSB, WOSB, small business), agency, state, and date. Schedule it daily with **"Only new since last run"** to get bid alerts and competitor award alerts without duplicates.

Uses the official public government APIs: no scraping of logged-in pages, no cookies, no proxies, no broken runs when the website changes.

### Why this one

| | This Actor | Typical SAM.gov scrapers |
|---|---|---|
| Open opportunities (RFPs, RFQs, sources sought) | ✅ | ✅ |
| **Awarded contracts: who won, how much** (USAspending) | ✅ no key needed | ❌ |
| **Only-new mode for daily alerts** (dedup across runs) | ✅ | ❌ |
| Agency filter + min award amount | ✅ | partial |
| Multiple NAICS × set-aside × state in one run | ✅ | partial |
| Flat, spreadsheet-ready rows (CSV/Excel/Sheets) | ✅ | nested JSON |
| Contracting officer name/email/phone + attachment links | ✅ | some |

### Use cases

- **Bid alerts for government contractors**: daily list of new solicitations for your NAICS codes and set-asides.
- **Competitor intelligence**: see which companies win contracts in your NAICS code, at which agency, and for how much.
- **Lead generation for B2G sales**: recipients of new awards are companies with new budgets that need subcontractors, staffing, and software.
- **Market research / capture planning**: agency spending by NAICS, PSC, and state.
- **AI agents and MCP**: clean flat records for LLM pipelines.

### Modes

- `awards` (default): awarded contracts (definitive contracts, purchase orders, delivery and task orders) from USAspending.gov. **No API key.**
- `opportunities`: live SAM.gov contract opportunities. Needs a **free SAM.gov public API key** (sam.gov → sign in → Account Details → Public API Key).

### Input example

```json
{ "mode": "awards", "keywords": ["cybersecurity"], "naicsCodes": ["541512"], "states": ["VA"],
  "daysBack": 30, "minAwardAmount": 100000, "maxResults": 500, "onlyNew": true, "stateKey": "cyber-va" }
```

### Output example (awards)

```json
{ "source": "usaspending.gov", "recordType": "award", "awardId": "70B04C23F00001163",
  "title": "CYBERSECURITY SUPPORT SERVICES", "agency": "Department of Homeland Security",
  "subAgency": "U.S. Customs and Border Protection", "naics": "541512", "psc": "DJ01",
  "recipientName": "INFORMATION TECHNOLOGY COMPANY, L.L.C.", "recipientUei": "EFRANUTCRPJ6",
  "awardAmount": 4483374.94, "state": "VA", "url": "https://www.usaspending.gov/award/..." }
```

Opportunity rows add `solicitationNumber`, `noticeType`, `setAside`, `postedDate`, `responseDeadline`, `contactName`, `contactEmail`, `contactPhone`, and `attachmentUrls`.

### Daily alerts in 2 minutes

1. Set `onlyNew: true` and a unique `stateKey` per saved search.
2. Create an Apify **Schedule** (for example daily at 07:00).
3. Add an integration (email, Slack, Google Sheets, Zapier, Make, or a webhook). Each run returns only records you haven't seen before.

### Pricing

Pay per result, with no platform usage charged to you. Runs that return 0 new records cost almost nothing, so daily alerts stay cheap.

### FAQ

**Is this legal?** Yes. It uses the official public APIs from api.sam.gov and api.usaspending.gov.
**Why does awards mode show older start dates?** The date window matches contract actions (new awards and modifications) in that period, so ongoing contracts with recent modifications are included.
**SAM.gov rate limits?** Free personal keys get about 10 requests a day; a registered entity's key gets more. Each request returns up to 1,000 opportunities.

Keywords: SAM.gov scraper, SAM.gov API, federal contract opportunities, government RFP alerts, USAspending API, federal contract awards, NAICS search, 8(a) set-aside, HUBZone, SDVOSB, WOSB, government contracting leads, GovCon, B2G lead generation.

# Actor input Schema

## `mode` (type: `string`):

What to fetch.

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

Free public key from sam.gov > Account Details > Public API Key.

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

e.g. cybersecurity, cloud. Opportunities mode uses the first as a title search.

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

e.g. 541511, 541512

## `setAside` (type: `array`):

SAM: SBA, 8A, HZC, SDVOSBC, WOSB, EDWOSB. USAspending: SBA, 8A, HZC, SDVOSBC, WOSB, EDWOSB, VSA...

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

e.g. Department of Defense

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

2-letter codes, e.g. VA, TX

## `daysBack` (type: `integer`):

Look-back window.

## `minAwardAmount` (type: `integer`):

Skip smaller awards.

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

Stop after this many records.

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

Skips IDs already returned in earlier runs with the same stateKey. Schedule the Actor for daily alerts.

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

Use a different key per saved search.

## Actor input object example

```json
{
  "mode": "awards",
  "daysBack": 30,
  "maxResults": 100,
  "onlyNew": false,
  "stateKey": "default"
}
```

# Actor output Schema

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

Contracts, awards and opportunities in the overview table view.

# 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("niyomurinzi.elis/sam-gov-contracts-awards").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("niyomurinzi.elis/sam-gov-contracts-awards").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 niyomurinzi.elis/sam-gov-contracts-awards --silent --output-dataset

```

## MCP server setup

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

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/pNuGJzYZGl1eTtsA9/builds/KYXexkU3uLKJKx0yX/openapi.json
