# SAM.gov Federal Contract Opportunities Scraper (`spry_frame/sam-gov-scraper`) Actor

Scrapes federal contract opportunities from SAM.gov — solicitation number, agency, NAICS code, award amount, set-aside type, point of contact, and more. Requires a free SAM.gov public API key.

- **URL**: https://apify.com/spry\_frame/sam-gov-scraper.md
- **Developed by:** [COSENT GROUP](https://apify.com/spry_frame) (community)
- **Categories:** Lead generation, Other
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## SAM.gov Federal Contract Opportunities Scraper

Scrape federal contract opportunities from [SAM.gov](https://sam.gov) — the official US government source for contract solicitations, awards, and procurement notices. Filter by keyword, agency, NAICS code, state, set-aside type, and more.

Requires a **free public API key** from your SAM.gov account (no government email needed — anyone can register).

### What it scrapes

Each opportunity returns:

| Field | Description |
|-------|-------------|
| `noticeId` | SAM.gov unique notice identifier |
| `solicitationNumber` | Official solicitation or contract number |
| `title` | Opportunity title |
| `noticeType` | Solicitation, Award Notice, Presolicitation, Sources Sought, etc. |
| `postedDate` | Date the opportunity was posted |
| `responseDeadline` | Proposal or response deadline |
| `naicsCode` | NAICS industry classification code |
| `setAside` | Small business set-aside type (if applicable) |
| `agency` | Federal agency posting the opportunity |
| `office` | Contracting office within the agency |
| `placeOfPerformance` | City and state where work will be performed |
| `awardAmount` | Contract award value in USD (award notices only) |
| `awardee` | Company awarded the contract (award notices only) |
| `contactName` | Contracting officer or point of contact name |
| `contactEmail` | Point of contact email address |
| `url` | Direct link to the opportunity on SAM.gov |
| `scrapedAt` | ISO timestamp when this record was collected |

### Getting your API key

1. Register or log in at [sam.gov](https://sam.gov)
2. Go to **Account Details** (top-right menu)
3. Under **Public API Key**, click **Generate Key** and copy it
4. Paste it into the `SAM.gov API Key` input field

### Input

```json
{
  "apiKey": "YOUR_SAM_GOV_API_KEY",
  "postedFrom": "07/01/2026",
  "postedTo": "08/02/2026",
  "keywords": "cybersecurity",
  "noticeType": "o",
  "naicsCode": "541512",
  "state": "TX",
  "organizationName": "Department of Defense",
  "setAside": "SBA",
  "maxResults": 200
}
```

#### Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `apiKey` | string | Yes | Your SAM.gov public API key |
| `postedFrom` | string | Yes | Start date in MM/dd/yyyy format |
| `postedTo` | string | Yes | End date in MM/dd/yyyy format (max 1-year range) |
| `keywords` | string | No | Search term for title/description (e.g. `IT services`, `construction`) |
| `noticeType` | string | No | Notice type code — see table below |
| `naicsCode` | string | No | NAICS code (e.g. `541512` for Computer Systems Design) |
| `state` | string | No | Two-letter state code for place of performance (e.g. `TX`, `CA`) |
| `organizationName` | string | No | Federal agency name (e.g. `Department of Defense`, `NASA`) |
| `setAside` | string | No | Set-aside type code — see table below |
| `maxResults` | integer | No | Max opportunities to return (default: 100, 0 = no limit) |

#### Notice type codes

| Code | Notice Type |
|------|-------------|
| `o` | Solicitation |
| `p` | Presolicitation |
| `k` | Combined Synopsis/Solicitation |
| `r` | Sources Sought |
| `s` | Special Notice |
| `a` | Award Notice |
| `i` | Intent to Bundle Requirements |
| `u` | Justification |
| `g` | Sale of Surplus Property |

#### Set-aside type codes

| Code | Set-Aside Type |
|------|----------------|
| `SBA` | Total Small Business |
| `8A` | 8(a) Program |
| `HZC` | HUBZone |
| `SDVOSBC` | Service-Disabled Veteran-Owned Small Business |
| `WOSB` | Women-Owned Small Business |
| `EDWOSB` | Economically Disadvantaged Women-Owned Small Business |

### Example output

```json
{
  "noticeId": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
  "solicitationNumber": "W912BU26Q0045",
  "title": "Cybersecurity Assessment and Penetration Testing Services",
  "noticeType": "Solicitation",
  "postedDate": "2026-07-15",
  "responseDeadline": "2026-08-15T17:00:00-04:00",
  "naicsCode": "541519",
  "setAside": "Total Small Business",
  "agency": "DEPT OF DEFENSE",
  "office": "US ARMY CORPS OF ENGINEERS",
  "placeOfPerformance": "Fort Worth, TX",
  "awardAmount": null,
  "awardee": null,
  "contactName": "Jane Smith",
  "contactEmail": "jane.smith@army.mil",
  "url": "https://sam.gov/opp/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4/view",
  "scrapedAt": "2026-08-02T20:14:00.309Z"
}
```

### Use cases

- **Business development** — monitor new solicitations in your industry before competitors
- **Market research** — analyze federal spending by agency, NAICS code, or geography
- **Set-aside tracking** — find small business, veteran-owned, or HUBZone opportunities
- **Award intelligence** — track which companies are winning contracts in your space
- **Lead generation** — build prospect lists from contracting officer contact details

### Notes

- Date range between `postedFrom` and `postedTo` cannot exceed 1 year
- Over 23,000 new opportunities are posted monthly across all agencies
- Award notices include the awardee name and contract value
- API rate limits are set by SAM.gov based on account type; the scraper adds a 300ms delay between pages to stay within limits

# Actor input Schema

## `apiKey` (type: `string`):

Your SAM.gov public API key. Get it from sam.gov → Account Details → Public API Key.

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

Start of the date range for posted opportunities. Required. Example: 01/01/2025

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

End of the date range for posted opportunities. Required. Max range is 1 year. Example: 12/31/2025

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

Search term to filter opportunities by title or description (e.g. 'cybersecurity', 'construction', 'IT services').

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

Filter by notice type. Options: o (Solicitation), p (Presolicitation), k (Combined Synopsis/Solicitation), r (Sources Sought), g (Sale of Surplus Property), s (Special Notice), i (Intent to Bundle), a (Award Notice), u (Justification). Leave empty for all.

## `naicsCode` (type: `string`):

Filter by NAICS industry code (e.g. '541512' for Computer Systems Design). Leave empty for all.

## `state` (type: `string`):

Two-letter state code for place of performance (e.g. TX, CA, NY). Leave empty for all.

## `organizationName` (type: `string`):

Filter by federal agency or organization name (e.g. 'Department of Defense', 'NASA'). Leave empty for all.

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

Filter by set-aside type. Common values: SBA (Small Business), 8A (8(a) Program), HZC (HUBZone), SDVOSBC (Service-Disabled Veteran-Owned), WOSB (Women-Owned Small Business). Leave empty for all.

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

Maximum number of opportunities to return. 0 = no limit.

## Actor input object example

```json
{
  "keywords": "",
  "noticeType": "",
  "naicsCode": "",
  "state": "",
  "organizationName": "",
  "setAside": "",
  "maxResults": 100
}
```

# Actor output Schema

## `noticeId` (type: `string`):

SAM.gov unique notice identifier.

## `solicitationNumber` (type: `string`):

Official solicitation or contract number.

## `title` (type: `string`):

Opportunity title/description.

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

Type of notice (Solicitation, Award, Presolicitation, etc.).

## `postedDate` (type: `string`):

Date the opportunity was posted.

## `responseDeadline` (type: `string`):

Deadline for responses/proposals.

## `naicsCode` (type: `string`):

North American Industry Classification System code.

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

Small business set-aside classification.

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

Federal agency posting the opportunity.

## `office` (type: `string`):

Contracting office within the agency.

## `placeOfPerformance` (type: `string`):

City and state where work will be performed.

## `awardAmount` (type: `string`):

Contract award amount in USD (award notices only).

## `awardee` (type: `string`):

Company awarded the contract (award notices only).

## `contactName` (type: `string`):

Point of contact name.

## `contactEmail` (type: `string`):

Point of contact email address.

## `url` (type: `string`):

Direct link to the opportunity on SAM.gov.

## `scrapedAt` (type: `string`):

ISO timestamp when this record was collected.

# 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 = {
    "postedFrom": "",
    "postedTo": ""
};

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

# Run the Actor and wait for it to finish
run = client.actor("spry_frame/sam-gov-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "postedFrom": "",
  "postedTo": ""
}' |
apify call spry_frame/sam-gov-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=spry_frame/sam-gov-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/GG7qdVpA0dZnnbW8t/builds/GZCZe2JgA3Trx0QOa/openapi.json
