# SAM.gov Opportunities Scraper — Pay Per Result (`smorgi_apps/sam-gov-opportunities-scraper`) Actor

Scrape federal contract opportunities from SAM.gov. Keyword, NAICS, and notice-type filters with structured agency, office, and deadline fields. Empty searches free. Pay-per-event (~$1/1k). No SAM API key required.

- **URL**: https://apify.com/smorgi\_apps/sam-gov-opportunities-scraper.md
- **Developed by:** [Smorgi Apps](https://apify.com/smorgi_apps) (community)
- **Categories:** Lead generation, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 sam.gov 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/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 Opportunities Scraper — Pay Per Result

Scrape **federal contract opportunities** from [SAM.gov](https://sam.gov). Keyword search, notice-type + NAICS filters, structured agency/office/deadline fields. Built to replace flaky ★1 Store wrappers with clean PPE rows.

**Store search keywords:** SAM.gov scraper · federal contracts · government bids · GovCon leads · solicitation scraper · NAICS opportunities

***

### Why this Actor

| Pain on popular SAM scrapers | What we do |
|-----------------------------|------------|
| ★1 / unclear quality | Structured schema + honest limits |
| Opaque failures | Empty searches → **not charged** |
| Key friction | Uses SAM’s **public search API** (no SAM API key required) |
| Unclear pricing | Flat **pay-per-result** PPE |

Public opportunity listings only. No login. No proposal submission.

***

### Example input

```json
{
  "query": "cybersecurity",
  "noticeTypes": ["o", "k", "p"],
  "maxItems": 50,
  "activeOnly": true
}
```

#### Notice type codes

| Code | Meaning |
|------|---------|
| `o` | Solicitation |
| `k` | Combined Synopsis/Solicitation |
| `p` | Presolicitation |
| `r` | Sources Sought |
| `a` | Award Notice |
| `s` | Special Notice |
| `u` | Justification (J\&A) |
| `g` | Sale of Surplus Property |
| `i` | Intent to Bundle |

***

### Output fields

| Field | Description |
|-------|-------------|
| `id` | SAM notice id |
| `title` | Opportunity title |
| `solicitationNumber` | Solicitation / RFQ number |
| `noticeType` / `noticeTypeCode` | Human label + code |
| `publishedAt` / `modifiedAt` | Timestamps |
| `responseDeadline` | Response deadline when present |
| `department` / `agency` / `office` | From organization hierarchy |
| `organizationPath` | Full dept → office path |
| `description` / `descriptionHtml` | Snippet from search results |
| `url` | Public `sam.gov/opp/{id}/view` link |
| `awardeeName` / `awardeeUei` | When present (awards) |

***

### Pricing

Pay-per-event for each **delivered** opportunity.

- Empty queries / zero results → **not charged**
- Exact $/1k is on the Store pricing tab

***

### Limitations (honest)

- Uses SAM.gov’s public search endpoint (same data the website search shows)
- Search result descriptions are often **snippets**, not full attachments
- SAM caps browseable search results (~10k); narrow with `query` / NAICS / notice types
- `postedFrom` / `postedTo` are applied client-side on `publishedAt`
- Official GSA Opportunities API keys are **not** required for this Actor

***

Issues / feature requests: use the Actor **Issues** tab.

# Actor input Schema

## `query` (type: `string`):

Free-text keywords (title/description). Leave empty for broad active listings.

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

Optional SAM notice type codes. o=Solicitation, k=Combined Synopsis/Solicitation, p=Presolicitation, r=Sources Sought, a=Award Notice, s=Special Notice, u=Justification, g=Sale of Surplus, i=Intent to Bundle.

## `naics` (type: `string`):

Optional NAICS filter (up to 6 digits), e.g. 541512.

## `organizationId` (type: `string`):

Optional SAM organization hierarchy id filter.

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

If true, only return active opportunities.

## `includeCanceled` (type: `boolean`):

If false, skip canceled notices.

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

Optional publish-date lower bound (MM/dd/yyyy or YYYY-MM-DD). Filtered client-side.

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

Optional publish-date upper bound (MM/dd/yyyy or YYYY-MM-DD). Filtered client-side.

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

Maximum opportunities to deliver (SAM search caps around 10,000).

## `pageSize` (type: `integer`):

Results per SAM search page (1–100).

## `requestDelayMs` (type: `integer`):

Throttle between paginated requests.

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

Optional. SAM.gov public search usually works without proxies.

## Actor input object example

```json
{
  "query": "software",
  "noticeTypes": [
    "o",
    "k"
  ],
  "naics": "",
  "organizationId": "",
  "activeOnly": true,
  "includeCanceled": false,
  "postedFrom": "",
  "postedTo": "",
  "maxItems": 50,
  "pageSize": 50,
  "requestDelayMs": 350,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `opportunities` (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 = {
    "query": "software",
    "noticeTypes": [
        "o",
        "k"
    ],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("smorgi_apps/sam-gov-opportunities-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 = {
    "query": "software",
    "noticeTypes": [
        "o",
        "k",
    ],
    "maxItems": 50,
}

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

```

## MCP server setup

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

```

## OpenAPI specification

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