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

Search US federal contract opportunities on SAM.gov by keyword, NAICS, PSC, set-aside, agency, state and dates. Each notice comes with the full description, contacts, deadlines, award details and attachment download links. No API key needed.

- **URL**: https://apify.com/scrapeworks/sam-gov-opportunities.md
- **Developed by:** [Nicolas van Arkens](https://apify.com/scrapeworks) (community)
- **Categories:** Lead generation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 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 Contract Opportunities Scraper

Pull US federal contract opportunities from SAM.gov into a spreadsheet or your own system. Search by keyword, or leave the keywords empty and filter by notice type, NAICS code, product and service code (PSC), set-aside, department, place of performance and dates. Every notice comes back with its full description, contacts, deadlines, set-aside, codes, award details and download links for the attached files.

It reads the same public data the sam.gov website shows, so you don't need a SAM.gov account or an API key.

### What you get for each notice

- Title, notice type, solicitation number and a link to the notice on SAM.gov
- Posted date, last update, response deadline (in UTC and in the agency's own time zone) and archive date
- Department, agency, office and the office's mailing address
- NAICS codes, PSC code and set-aside
- Place of performance
- Contacts with name, email and phone
- Full description as plain text (and the original HTML when there is formatting)
- Attachments: file names, sizes and direct download links, plus any external links
- For award notices: award date, contract number, amount, and the awardee's name, UEI, CAGE code and location

### Examples

**Open small business solicitations for IT services**

```json
{
    "noticeTypes": ["o", "k"],
    "pscCodes": ["D"],
    "setAsides": ["SBA"],
    "responseFrom": "2026-11-20",
    "maxItems": 500
}
```

**Everything posted in the last day for your NAICS codes (run it on a daily schedule)**

```json
{
    "naicsCodes": ["541511", "541512", "541519"],
    "postedWithinDays": 1,
    "maxItems": 1000
}
```

**Awards in Texas and Virginia this month, to see who wins what**

```json
{
    "noticeTypes": ["a"],
    "placeOfPerformanceStates": ["TX", "VA"],
    "postedFrom": "2026-11-01"
}
```

**Keyword search across all active notices**

```json
{
    "searchTerms": ["cybersecurity", "janitorial services"],
    "maxItems": 200
}
```

### Monitoring new opportunities

Save your filters as a task, set "Posted in the last N days" to 1 and schedule it daily. Each run returns only what was posted since yesterday, and you can send the results to Google Sheets, Slack or email with an Apify integration.

### Big searches

SAM.gov only pages through the first 10,000 results of a search. When you ask for more than that, the actor splits the search by notice type and then by date and runs each part, so you still get everything. Notices that appear in more than one part are returned and charged once.

### Pricing

**$0.80 per 1,000 notices,** full details and attachment links included. You pay only for notices returned. Set "Maximum notices" or a maximum charge per run and the actor stops there. If a notice's details can't be loaded, it is still returned with the basic fields and you are not charged for it.

### Good to know

- Only active notices are returned by default, the same as the sam.gov search page. Turn on "Include inactive and archived notices" to search the archive too.
- Keyword search uses SAM.gov's own search, which also matches words in the description, so a broad word can bring in notices you don't expect. Add a NAICS, PSC or notice type filter to tighten it.
- Contact details are what the contracting office entered, so the format varies from office to office.
- Attachment links go through SAM.gov's own download address and work without logging in. Controlled (CUI) files that need a SAM.gov login are left out.
- Turn off "Get full details" for a faster list with title, agency, dates and the start of the description.

### Output example

```json
{
    "noticeId": "bb6665852cce4b6d9dac1a2f15ebe06c",
    "url": "https://sam.gov/opp/bb6665852cce4b6d9dac1a2f15ebe06c/view",
    "title": "V--USWFS Exclusive Use Smokejumper Aircraft Dash 8",
    "solicitationNumber": "140D0427R0118",
    "noticeType": "Combined Synopsis/Solicitation",
    "postedDate": "2026-11-20T21:41:50+00:00",
    "responseDeadline": "2026-12-02T20:00:00+00:00",
    "responseTimeZone": "America/Chicago",
    "department": "INTERIOR, DEPARTMENT OF THE",
    "subTier": "DEPARTMENTAL OFFICES",
    "office": "IBC ACQ SVCS DIRECTORATE (00004)",
    "naicsCode": "481211",
    "pscCode": "V221",
    "setAsideCode": "SBA",
    "setAside": "Total Small Business Set-Aside (FAR 19.5)",
    "primaryContactName": "Herrman, Lynn",
    "primaryContactEmail": "lynn_herrman@ibc.doi.gov",
    "attachmentCount": 6,
    "attachments": [
        {
            "name": "Sol_140D0427R0118_Amd_0002.pdf",
            "type": "file",
            "url": "https://sam.gov/api/prod/opps/v3/opportunities/resources/files/d8f0132904174579a929a5029f75d220/download",
            "sizeBytes": 212832
        }
    ]
}
```

Rows have more fields than shown here. Download the results as JSON, CSV or Excel, or pull them over the Apify API.

### Questions or problems

Open an issue on the Issues tab and I'll take a look.

# Actor input Schema

## `searchTerms` (type: `array`):

Words to look for in the title, description and solicitation number, for example 'cybersecurity' or 'janitorial services'. Each entry is its own search. Leave empty to list every notice that matches the filters below.

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

The run stops after this many notices in total, across all keywords. You pay per notice returned.

## `matchAllWords` (type: `boolean`):

On: a notice must contain every word of a keyword entry. Off: any of the words is enough.

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

Leave empty for all types.

## `postedWithinDays` (type: `integer`):

Only notices posted in the last N days. Handy for a daily or weekly schedule. Overrides 'Posted from'.

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

Only notices posted on or after this date.

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

Only notices posted on or before this date.

## `responseFrom` (type: `string`):

Only notices whose response deadline is on or after this date. Use today's date to skip notices that already closed.

## `responseTo` (type: `string`):

Only notices whose response deadline is on or before this date.

## `modifiedFrom` (type: `string`):

Only notices posted or changed on or after this date.

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

Six-digit NAICS codes, for example 541511 (custom programming) or 561720 (janitorial services).

## `pscCodes` (type: `array`):

Full codes such as 7A21 or R425, or a leading letter such as D for all IT services.

## `setAsides` (type: `array`):

Only notices reserved for these business types.

## `departments` (type: `array`):

Only notices from these departments or independent agencies.

## `agencyIds` (type: `array`):

SAM.gov organization IDs for a narrower agency or office, for example 300000201 for the Department of the Army. You find the ID in each row's organizationIds field.

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

Two-letter state codes, for example VA, TX, DC.

## `includeInactive` (type: `boolean`):

Off: only active notices, the way sam.gov shows them by default. On: also notices that closed or were archived, back to the start of the archive.

## `fetchDetails` (type: `boolean`):

Full description, contacts, NAICS, PSC, set-aside, place of performance and award details for each notice. Turn off for a faster list with title, agency, dates and a short description.

## `fetchAttachments` (type: `boolean`):

Names and download links of the files and links attached to each notice. Needs 'Get full details'.

## `proxyConfiguration` (type: `object`):

Not needed for most runs. Turn on a proxy only if your runs get blocked.

## Actor input object example

```json
{
  "searchTerms": [
    "cybersecurity",
    "janitorial services"
  ],
  "maxItems": 100,
  "matchAllWords": true,
  "naicsCodes": [
    "541511",
    "541512"
  ],
  "pscCodes": [
    "D",
    "R425"
  ],
  "agencyIds": [
    "300000201"
  ],
  "placeOfPerformanceStates": [
    "VA",
    "MD",
    "DC"
  ],
  "includeInactive": false,
  "fetchDetails": true,
  "fetchAttachments": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

One row per SAM.gov contract opportunity, with description, contacts, deadlines, award details and attachment links.

# 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 = {
    "searchTerms": [
        "software"
    ],
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeworks/sam-gov-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 = {
    "searchTerms": ["software"],
    "maxItems": 100,
}

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

```

## MCP server setup

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