# SAM.gov Contract Opportunities Scraper (`scarlet_sheet/sam-gov-contract-opportunities`) Actor

Find U.S. federal contract opportunities (solicitations, RFPs, RFQs, sources sought, pre-solicitations, awards) on SAM.gov by keyword, NAICS, notice type and set-aside. No API key or login. Deadlines, agencies, NAICS, place of performance and direct links.

- **URL**: https://apify.com/scarlet_sheet/sam-gov-contract-opportunities.md
- **Developed by:** [Lipa Pollak](https://apify.com/scarlet_sheet) (community)
- **Categories:** Business, Lead generation
- **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

## SAM.gov Contract Opportunities Scraper

Find U.S. federal contract opportunities (solicitations, RFPs, RFQs, sources sought, pre-solicitations, awards) on SAM.gov by keyword, NAICS, notice type and set-aside. No API key or login. Deadlines, agencies, NAICS, place of performance and direct links.

### What does it do?

It searches the **public SAM.gov contract opportunities index** (the same data behind sam.gov's own search page) with no SAM.gov API key, account, or login, and returns clean, flat rows you can export to JSON, CSV or Excel, schedule daily, or push to Google Sheets, Zapier, Make, a CRM, or your own code via the Apify API. No browser, no proxies, fast and cheap.

### Use cases

- **Daily bid alerts:** schedule a run for your NAICS codes and get every new solicitation, RFQ and sources-sought notice
- **GovCon lead generation and capture planning** for small businesses, 8(a), SDVOSB, WOSB and HUBZone firms
- **Market research:** which agencies buy what, and when responses are due
- Feeding BI dashboards and AI agents with fresh federal procurement data

Pair it with our **USAspending Federal Contracts & Grants Scraper** to see who won past awards.

### Input

| Field | Type | Description |
|---|---|---|
| `keywords` | string | Search text, e.g. cybersecurity, janitorial, software. Leave empty for all. |
| `naics` | array | Optional, e.g. 541511, 541512 |
| `noticeTypes` | array | Empty = all types |
| `setAside` | string | Optional SAM.gov set-aside code, e.g. SBA (Total Small Business), 8A, SDVOSBC, WOSB, HZC |
| `activeOnly` | boolean | Exclude archived/inactive notices |
| `includeDetails` | boolean | Fetches each notice's detail record. Slightly slower. |
| `maxResults` | integer | SAM.gov search caps at 10,000 per query |

### Output

Fields: `noticeId`, `title`, `noticeType`, `solicitationNumber`, `department`, `subTier`, `office`, `postedDate`, `responseDeadline`, `naics`, `setAside`, `classificationCode`, `placeOfPerformance`, `descriptionSnippet`, `url`, plus `modifiedDate`, `isActive`, `isCanceled`, `awardeeName`. See `test/sample-output.json` for real rows. Personal contact details (points of contact) are intentionally not collected.

### Pricing (pay per event)

- **Actor start:** $0.005 per run
- **Result:** $3.00 per 1,000 opportunities

You pay only for results. Set a maximum charge per run in Apify Console to cap spend.

### FAQ

**Do I need a SAM.gov API key?** No.
**How fresh is the data?** Live: results come straight from SAM.gov at run time, newest-modified first.
**Is there a limit?** SAM.gov returns up to 10,000 notices per query; narrow by NAICS or keywords for bigger pulls.

# Actor input Schema

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

Search text, e.g. cybersecurity, janitorial, software. Leave empty for all.

## `naics` (type: `array`):

Optional, e.g. 541511, 541512

## `noticeTypes` (type: `array`):

Empty = all types

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

Optional SAM.gov set-aside code, e.g. SBA (Total Small Business), 8A, SDVOSBC, WOSB, HZC

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

Exclude archived/inactive notices

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

Fetches each notice's detail record. Slightly slower.

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

SAM.gov search caps at 10,000 per query

## Actor input object example

```json
{
  "keywords": "software",
  "naics": [
    "541511",
    "541512"
  ],
  "activeOnly": true,
  "includeDetails": true,
  "maxResults": 100
}
```

# 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 = {
    "keywords": "software",
    "naics": [
        "541511",
        "541512"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("scarlet_sheet/sam-gov-contract-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 = {
    "keywords": "software",
    "naics": [
        "541511",
        "541512",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("scarlet_sheet/sam-gov-contract-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 '{
  "keywords": "software",
  "naics": [
    "541511",
    "541512"
  ]
}' |
apify call scarlet_sheet/sam-gov-contract-opportunities --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scarlet_sheet/sam-gov-contract-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/Ch0fO2AkDxuT9kRe4/builds/0xqZJgaZG3870OZqg/openapi.json
