# SAM.gov Federal Contract Opportunities Scraper (`themineworks/sam-gov-contracts`) Actor

Scrape US federal contract opportunities from SAM.gov as clean JSON. Filter by keyword, NAICS, notice type, agency, set-aside type and posted-date window. No login, no browser — pure HTTP against the official Get Opportunities API v2. Works in Claude, ChatGPT & any MCP agent.

- **URL**: https://apify.com/themineworks/sam-gov-contracts.md
- **Developed by:** [The Mine Works](https://apify.com/themineworks) (community)
- **Categories:** Business, News, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.60 / 1,000 opportunity scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 — Solicitations, Awards & Set-Asides

Pull **US federal contract opportunities** from [SAM.gov](https://sam.gov) as clean, structured JSON — solicitations, presolicitations, sources-sought, award notices and more. Runs on the official **SAM.gov Get Opportunities API v2** over plain HTTP. No browser, no proxy, no login.

✅ Official SAM.gov API | ✅ No proxy needed | ✅ Filter by NAICS, set-aside & agency | ✅ MCP-ready for AI agents

Great for **GovCon capture teams, bid/proposal shops, market intelligence, and RAG/agent pipelines** that need a fresh, filterable feed of federal opportunities.

Reliability posture: empty runs, failed fetches and auth errors are **never charged**. You only pay for an opportunity actually delivered.

### Bring your own free API key

SAM.gov requires a personal API key (free). This actor takes it as the **`apiKey`** input — we never hardcode or store one.

1. Sign in at [sam.gov](https://sam.gov) and open **Account Details → API Key** (or sign up at [api.data.gov/signup](https://api.data.gov/signup/)).
2. Copy the key and paste it into the `apiKey` field.

A free key allows **1,000 requests/hour** — far more than a typical run needs (each request returns up to 1,000 opportunities).

### Input

| Field | Type | Description |
|---|---|---|
| `apiKey` **(required)** | string | Your free SAM.gov / api.data.gov key. |
| `keyword` | string | Full-text search on the opportunity title (e.g. `software`). |
| `naicsCode` | string | NAICS industry code, up to 6 digits (e.g. `541511`). |
| `noticeType` | string | Procurement type code: `o` Solicitation, `p` Presolicitation, `r` Sources Sought, `a` Award Notice, `k` Combined Synopsis, `s` Special Notice, `g` Sale of Surplus, `u` Justification, `i` Intent to Bundle. |
| `organizationName` | string | Department / sub-tier name (e.g. `DEPARTMENT OF DEFENSE`). |
| `setAsideType` | string | Set-aside code (e.g. `SBA`, `8A`, `WOSB`, `HZC`, `SDVOSBC`). |
| `postedFrom` | string | Earliest posted date, `MM/DD/YYYY` or `YYYY-MM-DD`. Defaults to 30 days ago. |
| `postedTo` | string | Latest posted date. Defaults to today. |
| `maxResults` | integer | Max opportunities to return (default 100). |

> **Date range:** SAM.gov requires a posted-date window and caps it at ~1 year. If you leave the dates empty the actor uses the **last 30 days**; a window wider than a year is automatically clamped.

#### Example input

```json
{
  "apiKey": "YOUR_SAM_GOV_KEY",
  "keyword": "software",
  "naicsCode": "541511",
  "setAsideType": "SBA",
  "postedFrom": "07/01/2026",
  "postedTo": "07/31/2026",
  "maxResults": 100
}
```

### Output

One row per opportunity. Nulls are stripped, so absent fields are simply omitted.

```json
{
  "notice_id": "a1b2c3d4e5f6...",
  "title": "Enterprise Software Licensing and Support",
  "solicitation_number": "W1234-26-R-0001",
  "full_parent_path_name": "DEPT OF DEFENSE.DEPT OF THE ARMY.ARMY CONTRACTING COMMAND",
  "notice_type": "Solicitation",
  "naics_code": "541511",
  "set_aside": "SBA",
  "set_aside_description": "Total Small Business Set-Aside (FAR 19.5)",
  "posted_date": "2026-07-15 10:04:00-04:00",
  "response_deadline": "2026-08-14T17:00:00-04:00",
  "office_state": "VA",
  "pop_state": "VA",
  "ui_link": "https://sam.gov/opp/a1b2c3d4e5f6/view",
  "scraped_at": "2026-07-31T12:00:00.000Z"
}
```

### 💼 Common use cases

**GovCon capture and business development** — build a daily feed of new solicitations in your NAICS codes and set-aside categories instead of manually searching SAM.gov.

**Bid/proposal shop pipeline** — filter by agency, notice type and response deadline to build a qualified opportunity pipeline your capture team can triage.

**Small business set-aside monitoring** — track SBA, 8(a), WOSB, HUBZone and SDVOSB set-aside opportunities as they post.

**Market intelligence** — analyze which agencies and NAICS codes are posting the most opportunities, and at what pace, over time.

**AI research agents** — give a GovCon copilot live SAM.gov data via MCP so it can answer "what new solicitations match our NAICS codes this week?"

### 🚀 Getting started

1. Paste your free `apiKey`.
2. Set `keyword`, `naicsCode`, `noticeType`, `organizationName` and/or `setAsideType` to narrow the feed — or leave them blank for everything in the date window.
3. Set `postedFrom`/`postedTo` (defaults to the last 30 days) and `maxResults`, then click **Start**.
4. Download the dataset as JSON, CSV, or Excel, or pull it via API or MCP.

### Pricing

**Pay-per-result.** You are charged once per opportunity actually delivered to the dataset. Empty runs, failed fetches and the non-billable summary row are never charged. Tiered by Apify plan (higher plans pay less per result).

### Run on a schedule

Want a fresh pull every morning? In the Apify Console open this Actor → **Schedules** → **Add schedule** → pick a cadence (e.g. daily) → **Save**. It reruns with the same input automatically — a standing federal-opportunity feed with no code.

### FAQ

**Do I need an API key?** Yes — a free one from SAM.gov or api.data.gov. See the key section above. The key stays yours.

**How much does it cost?** You pay per opportunity delivered (tiered — cheaper the more you run). Empty, failed and unauthorised runs cost nothing.

**Is this official data?** Yes — served straight from the official SAM.gov Get Opportunities API v2, the same source GSA's own portal uses.

**Why do I need to set a date range?** SAM.gov requires a posted-date window and caps it at ~1 year; the actor defaults to the last 30 days and auto-clamps anything wider.

**Can I filter by small business set-aside type?** Yes — use `setAsideType` (e.g. `SBA`, `8A`, `WOSB`, `HZC`, `SDVOSBC`).

### Use in Claude, ChatGPT & any MCP agent

```
https://mcp.apify.com/?tools=themineworks/sam-gov-contracts
```

Or call it programmatically:

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });

const run = await client.actor('themineworks/sam-gov-contracts').call({
  apiKey: 'YOUR_SAM_GOV_KEY',
  keyword: 'software',
  naicsCode: '541511',
  maxResults: 100,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Notes

- Data source: official `https://api.sam.gov/opportunities/v2/search`. Field names in the output mirror SAM.gov's own (`noticeId`, `solicitationNumber`, `fullParentPathName`, `naicsCode`, `typeOfSetAside`, `uiLink`, …), snake-cased.
- This is an independent tool and is not affiliated with or endorsed by SAM.gov, GSA, or the US Government.

# Actor input Schema

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

Your own FREE api.data.gov / SAM.gov public API key. Get one in ~2 minutes at https://sam.gov/content/api-keys (or https://api.data.gov/signup/). It is passed to SAM.gov as api\_key. We never store or hardcode a key.

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

Full-text search against the opportunity title (e.g. software, cybersecurity, janitorial). Leave empty to match all opportunities in your other filters.

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

Filter by NAICS industry code, up to 6 digits (e.g. 541511 for custom computer programming). Leave empty for all industries.

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

SAM.gov procurement type code. Leave empty for all. u=Justification, p=Presolicitation, a=Award Notice, r=Sources Sought, s=Special Notice, o=Solicitation, g=Sale of Surplus, k=Combined Synopsis/Solicitation, i=Intent to Bundle.

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

Filter by awarding department or sub-tier name (e.g. DEPARTMENT OF DEFENSE, GENERAL SERVICES ADMINISTRATION). Leave empty for all agencies.

## `setAsideType` (type: `string`):

Filter by set-aside code (e.g. SBA for Total Small Business, 8A for 8(a), WOSB for Women-Owned, HZC for HUBZone, SDVOSBC for Service-Disabled Veteran-Owned). Leave empty for all.

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

Earliest posted date. Accepts MM/DD/YYYY or YYYY-MM-DD. Defaults to 30 days ago. The window from -> to may not exceed ~1 year (it is clamped if it does).

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

Latest posted date. Accepts MM/DD/YYYY or YYYY-MM-DD. Defaults to today.

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

Maximum number of opportunities to return, newest first.

## Actor input object example

```json
{
  "keyword": "software",
  "maxResults": 25
}
```

# 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 = {
    "keyword": "software",
    "maxResults": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("themineworks/sam-gov-contracts").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 = {
    "keyword": "software",
    "maxResults": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("themineworks/sam-gov-contracts").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 '{
  "keyword": "software",
  "maxResults": 25
}' |
apify call themineworks/sam-gov-contracts --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/Kurde3KijlKTtNo1C/builds/T7w524CumSgBnfak3/openapi.json
