# SAM.gov Contract Opportunities Scraper (No API Key) (`groundplanes/sam-gov-contract-opportunities`) Actor

Scrape active federal contract opportunities (RFPs, solicitations, sources sought) from the official SAM.gov daily extract. No API key. Filter by NAICS, set-aside (SBA, SDVOSB, WOSB, 8(a), HUBZone), true place of performance state, keywords and deadline. Points of contact included.

- **URL**: https://apify.com/groundplanes/sam-gov-contract-opportunities.md
- **Developed by:** [John](https://apify.com/groundplanes) (community)
- **Categories:** Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 opportunities

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 Federal Contract Opportunities Scraper (No API Key, True Place of Performance)

Stream active US federal contract opportunities, RFPs, presolicitations, and Sources Sought notices from the official **SAM.gov public daily bulk extract** — **no SAM.gov API key or login required**.

No SAM.gov API key needed: the official API requires a key and applies daily request quotas, which can be limiting for broad monitoring. This Actor streams the official daily `ContractOpportunitiesFullCSV.csv` extract directly from SAM.gov and filters on the **true Place of Performance** (`PopState`, `PopCity`, `PopZip`) as well as NAICS prefixes, set-aside codes, response deadline urgency, and full-text keywords.

### Who it's for

- **Government contractors (GovCon) & proposal teams** monitoring daily RFPs, Combined Synopsis/Solicitations, Presolicitations, and Sources Sought notices without managing SAM.gov API keys or request quotas
- **Regional service, construction, facilities, IT & staffing contractors** filtering by true `placeOfPerformanceStates` (`PopState`) where work actually takes place rather than the contracting office's headquarters state
- **Small business set-aside bidders** targeting `SBA`, `SDVOSBC`, `WOSB`, `8A`, and `HZC` opportunities with upcoming response deadlines (`hoursUntilDeadline`)

### Input

All filters are optional and require no API key. By default, the Actor returns up to 200 active solicitations, presolicitations, and Sources Sought notices posted in the last 7 days.

```json
{
  "postedDaysBack": 7,
  "noticeTypes": [
    "Solicitation",
    "Combined Synopsis/Solicitation",
    "Presolicitation",
    "Sources Sought"
  ],
  "naicsCodes": ["5415", "541330"],
  "setAsideCodes": ["SBA", "SDVOSBC"],
  "placeOfPerformanceStates": ["VA", "MD", "DC"],
  "keywords": ["cybersecurity", "cloud"],
  "minDaysUntilDeadline": 3,
  "activeOnly": true,
  "includeDescription": true,
  "maxItems": 200
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `postedDaysBack` | integer | `7` | Include opportunities posted within this many days of today. |
| `noticeTypes` | array | `["Solicitation", "Combined Synopsis/Solicitation", "Presolicitation", "Sources Sought"]` | Opportunity notice types to include (matched against the notice's current `Type`). |
| `naicsCodes` | array of strings | `[]` (all) | NAICS codes or prefixes (e.g. `["5415"]` matches all `5415xx` IT services codes). |
| `setAsideCodes` | array of strings | `[]` (all) | Set-aside codes (e.g. `SBA`, `SDVOSBC`, `WOSB`, `8A`, `HZC`). |
| `placeOfPerformanceStates` | array of strings | `[]` (all) | 2-letter US state codes matched against `PopState` (true work location). |
| `keywords` | array of strings | `[]` (all) | Case-insensitive keyword match across `Title` and `Description`. |
| `minDaysUntilDeadline` | integer | `0` | Require `ResponseDeadLine` to be at least this many days from now. With `0`, notices whose deadline already passed are dropped (notices with no deadline are kept). |
| `activeOnly` | boolean | `true` | Keep only notices where `Active = "Yes"`. |
| `includeDescription` | boolean | `true` | Include full `description` text (truncated at 20,000 characters). |
| `maxItems` | integer | `200` | Maximum number of rows to output. |

### Output

| Field | Type | Description |
|---|---|---|
| `noticeId` | string | Unique SAM.gov Notice ID |
| `title` | string | null | Opportunity title |
| `solicitationNumber` | string | null | Solicitation number (`Sol#`) |
| `department` | string | null | Department / Independent Agency |
| `subTier` | string | null | Sub-Tier agency |
| `office` | string | null | Contracting office |
| `noticeType` | string | null | Current notice type (`Type`) |
| `baseType` | string | null | Base notice type (`BaseType`) |
| `postedDate` | string | null | Posted timestamp |
| `responseDeadline` | string | null | ISO-8601 response deadline with timezone offset |
| `hoursUntilDeadline` | number | null | Hours from UTC now until `responseDeadline` |
| `naicsCode` | string | null | 6-digit NAICS code |
| `pscCode` | string | null | Product Service Code (`ClassificationCode`) |
| `setAsideCode` | string | null | Set-aside code |
| `setAside` | string | null | Set-aside description |
| `placeOfPerformance` | object | `{ street, city, state, zip, country }` from `Pop*` columns |
| `officeLocation` | object | `{ city, state, zip }` of the contracting office |
| `primaryContact` | object | `{ title, name, email, phone }` |
| `secondaryContact` | object | `{ title, name, email, phone }` |
| `awardNumber` | string | null | Contract award number (when applicable) |
| `awardDate` | string | null | Contract award date |
| `awardAmount` | string | null | Contract award dollar amount (`Award$`) |
| `awardee` | string | null | Contract awardee |
| `additionalInfoLink` | string | null | Additional information link |
| `samUrl` | string | null | Direct SAM.gov opportunity URL (`Link`) |
| `description` | string | null | Opportunity description (up to 20,000 characters when `includeDescription` is `true`) |

#### Sample output row

```json
{
  "noticeId": "c67afe2e98034f46a68e1be3250d3689",
  "title": "Center Support Services Mental Health Consultant for Pine Ridge JC",
  "solicitationNumber": "12318727Q0003",
  "department": "AGRICULTURE, DEPARTMENT OF",
  "subTier": "FOREST SERVICE",
  "office": "USDA FOREST SERVICE",
  "noticeType": "Combined Synopsis/Solicitation",
  "baseType": "Combined Synopsis/Solicitation",
  "postedDate": "2026-10-22 13:22:38",
  "responseDeadline": "2026-10-26T13:00:00-04:00",
  "hoursUntilDeadline": 67.87,
  "naicsCode": "561320",
  "pscCode": "Q519",
  "setAsideCode": "SBA",
  "setAside": "Small Business Set Aside - Total",
  "placeOfPerformance": {
    "street": null,
    "city": "Chadron",
    "state": "NE",
    "zip": null,
    "country": "USA"
  },
  "officeLocation": {
    "city": "WASHINGTON",
    "state": "DC",
    "zip": "20250"
  },
  "primaryContact": {
    "title": null,
    "name": "Jane Example",
    "email": "jane.example@example.com",
    "phone": null
  },
  "secondaryContact": {
    "title": null,
    "name": null,
    "email": null,
    "phone": null
  },
  "awardNumber": null,
  "awardDate": null,
  "awardAmount": null,
  "awardee": null,
  "additionalInfoLink": null,
  "samUrl": "https://sam.gov/workspace/contract/opp/c67afe2e98034f46a68e1be3250d3689/view",
  "description": "10/22/2026 - Updated and attached solicitation# - 12318727Q0003 with FAR Clauses - 52.217-8 and 52.217-9..."
}
```

### How pricing works

Pay per result. You only pay for rows returned.

### Data source and terms

Data is streamed from the official U.S. General Services Administration (GSA) **SAM.gov Contract Opportunities Public Extract** (`ContractOpportunitiesFullCSV.csv`). **The extract is updated daily, so results lag SAM.gov by about one day**; for same-day notices check SAM.gov directly. Notices are published by GSA as federal government information. This Actor is not affiliated with GSA or SAM.gov.

### Limits and FAQ

- **Which notices do I get?** The Actor scans every notice posted in your `postedDaysBack` window that matches your filters, sorts them by posted date (newest first), then returns the first `maxItems`.

- **Sample contact:** the contact in the sample row above is made up. Real rows carry the contracting officer contact published on the notice; use it only for questions about that solicitation.

- **Why does `placeOfPerformance.state` differ from `officeLocation.state`?** Federal contracting offices (for example, in DC, VA, or OH) frequently procure services performed at bases or facilities in other states. Filtering by `placeOfPerformanceStates` matches `PopState` (where the work takes place).

- **How does streaming work?** The full SAM.gov CSV extract is ~215 MB and roughly ordered newest-first. This Actor streams it over HTTP in 256 KB chunks, keeps the newest `maxItems` matches in memory, and stops the download once it has read well past the `postedDaysBack` cutoff (10,000 consecutive older rows).

### Changelog

- **v0.1.2** — Scans the whole posted-date window, sorts newest first, then applies `maxItems` (previously the first matches in file order).

- **v0.1.1** — Notice-type filter now uses the current notice `Type` (Award Notices no longer slip in). Expired deadlines are dropped by default. Safer UTF-8 decoding while streaming.

- **v0.1** — Initial release with incremental HTTP CSV streaming, header verification, timezone-aware deadline calculation, and `PopState` filtering.

# Actor input Schema

## `postedDaysBack` (type: `integer`):

Include opportunities posted within this many days of today.

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

SAM.gov opportunity notice types to include (matched against Type or BaseType).

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

Optional list of NAICS codes or prefixes (e.g. \["5415", "541512", "236220"]). Leave empty for all NAICS codes.

## `setAsideCodes` (type: `array`):

Optional SAM set-aside codes (e.g. \["SBA", "SDVOSBC", "WOSB", "8A", "HZC"]). Leave empty for all.

## `placeOfPerformanceStates` (type: `array`):

Optional 2-letter US state codes for true Place of Performance (PopState — where work is performed, not the contracting office state).

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

Optional keywords to match (case-insensitive OR match across Title and Description).

## `minDaysUntilDeadline` (type: `integer`):

Only keep notices whose response deadline is at least this many days away. With 0, notices whose deadline already passed are dropped (notices without a deadline are kept).

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

Keep only notices where Active = 'Yes'.

## `includeDescription` (type: `boolean`):

Include the notice Description text (truncated at 20,000 characters).

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

Maximum number of matching contract opportunities to output.

## Actor input object example

```json
{
  "postedDaysBack": 7,
  "noticeTypes": [
    "Solicitation",
    "Combined Synopsis/Solicitation",
    "Presolicitation",
    "Sources Sought"
  ],
  "naicsCodes": [],
  "setAsideCodes": [],
  "placeOfPerformanceStates": [],
  "keywords": [],
  "minDaysUntilDeadline": 0,
  "activeOnly": true,
  "includeDescription": true,
  "maxItems": 200
}
```

# 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 = {
    "postedDaysBack": 7,
    "noticeTypes": [
        "Solicitation",
        "Combined Synopsis/Solicitation",
        "Presolicitation",
        "Sources Sought"
    ],
    "naicsCodes": [],
    "setAsideCodes": [],
    "placeOfPerformanceStates": [],
    "keywords": [],
    "minDaysUntilDeadline": 0,
    "activeOnly": true,
    "includeDescription": true,
    "maxItems": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("groundplanes/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 = {
    "postedDaysBack": 7,
    "noticeTypes": [
        "Solicitation",
        "Combined Synopsis/Solicitation",
        "Presolicitation",
        "Sources Sought",
    ],
    "naicsCodes": [],
    "setAsideCodes": [],
    "placeOfPerformanceStates": [],
    "keywords": [],
    "minDaysUntilDeadline": 0,
    "activeOnly": True,
    "includeDescription": True,
    "maxItems": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("groundplanes/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 '{
  "postedDaysBack": 7,
  "noticeTypes": [
    "Solicitation",
    "Combined Synopsis/Solicitation",
    "Presolicitation",
    "Sources Sought"
  ],
  "naicsCodes": [],
  "setAsideCodes": [],
  "placeOfPerformanceStates": [],
  "keywords": [],
  "minDaysUntilDeadline": 0,
  "activeOnly": true,
  "includeDescription": true,
  "maxItems": 200
}' |
apify call groundplanes/sam-gov-contract-opportunities --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,groundplanes/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/YWcTYtP5l3QA3860z/builds/V1bBgVYAtAXQcR0kW/openapi.json
