# 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
- **Features:** Limited permissions
- **Stats:** 4 total users, 0 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/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 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.

### Related Actors

- [Grants Gov Opportunities](https://apify.com/smorgi_apps/grants-gov-opportunities-scraper)
- [Usaspending Awards](https://apify.com/smorgi_apps/usaspending-awards-scraper)
- [Federal Register](https://apify.com/smorgi_apps/federal-register-scraper)
- [Osha Inspections](https://apify.com/smorgi_apps/osha-inspections-scraper)

# 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(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 '{
  "query": "software",
  "noticeTypes": [
    "o",
    "k"
  ],
  "maxItems": 50
}' |
apify call smorgi_apps/sam-gov-opportunities-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,smorgi_apps/sam-gov-opportunities-scraper"
        }
    }
}
```

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/Sl9YutFWSEnek2kWk/builds/vgELDCurc7h8rIKR5/openapi.json
