# SAM.gov Contract Opportunities (Public Extract) (`akolere/sam-gov-contract-opportunities`) Actor

Search U.S. federal contract opportunities from SAM.gov using the official public daily Contract Opportunities extract (no API key) or the Get Opportunities public API (SAM_API_KEY). Strips point-of-contact and entity/D\&B fields. No HTML scraping.

- **URL**: https://apify.com/akolere/sam-gov-contract-opportunities.md
- **Developed by:** [Isaiah Williams](https://apify.com/akolere) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.50 / 1,000 results

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 (Public Extract)

Find active U.S. federal **contract opportunities** (solicitations, presolicitations, sources sought and more) from [SAM.gov](https://sam.gov). By default the Actor uses the **official public daily Contract Opportunities extract** from SAM.gov Data Services, which needs no API key. An optional mode uses the [Get Opportunities public API](https://open.gsa.gov/api/get-opportunities-public-api/) with your own `SAM_API_KEY`.

**This Actor never scrapes sam.gov web pages.** It only reads the public Data Services extract and the public API.

### What it does

You set a posted-date window and filters (keywords, NAICS, set-aside, notice type, state). The Actor streams the daily extract, keeps the matching opportunities, pushes them to your dataset as it goes, and stops at `maxItems`. It does not download the whole ~200 MB file on every run.

Typical uses: watching new bids in your NAICS codes, tracking set-aside opportunities (8(a), SDVOSB, WOSB, HUBZone), and feeding opportunity alerts or dashboards.

### Output

Each item is one opportunity: notice id, title, solicitation number, department / sub-tier / office, posted date, notice type, set-aside, response deadline, NAICS, classification code, office and place-of-performance location (city/state/zip/country, no street), description, and the official SAM.gov link.

#### Left out on purpose

- **No point-of-contact fields** (names, emails, phones, faxes)
- **No awardee, entity or D\&B fields**
- **No street addresses**
- **No HTML scraping**

### Data source

SAM.gov Data Services: Contract Opportunities (Public), https://sam.gov/data-services. U.S. government data on SAM.gov is generally public domain; citing it is appreciated. Dun & Bradstreet entity data has separate restrictions, so the Actor drops those fields entirely.

### Input

| Field | Description |
|---|---|
| `source` | `extract` (default, no key) or `api` (needs `SAM_API_KEY`) |
| `postedFrom` / `postedTo` | `YYYY-MM-DD` posted-date window (from is required) |
| `keywords` | Matches any keyword in the title or description |
| `naics` | NAICS codes or prefixes (`5415` matches `541511`) |
| `setAside` | Codes such as `SBA`, `8A`, `SDVOSBC`, `WOSB`, `HZC` |
| `noticeType` | For example `Solicitation`, `Sources Sought` |
| `state` | Two-letter state |
| `activeOnly` / `excludeAwards` | Both default to `true` |
| `maxItems` | Default 100, minimum 1, maximum 10,000 |

### Pricing

Pay per event:

- **$3.50 per 1,000 results** ($0.0035 per dataset item)
- **$0.005 per Actor start**

A default run (100 results) costs about $0.355.

### Changelog

- **0.1 (2026-11-09):** First Store release. Streamed public extract, early exit, contact and entity fields stripped, `maxItems` capped at 1–10,000.

# Actor input Schema

## `source` (type: `string`):

extract = public daily CSV (no key, preferred). api = Get Opportunities public API (needs SAM_API_KEY env var).

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

Case-insensitive title/description keywords. A row matches if ANY keyword appears.

## `naics` (type: `array`):

Exact codes or prefixes (e.g. 5415 matches 541511). Empty = any.

## `setAside` (type: `array`):

SetASideCode values (SBA, 8A, SDVOSBC, WOSB, HZC, …). Empty = any.

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

Inclusive lower bound on PostedDate. Required for early-exit streaming on the extract.

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

Inclusive upper bound on PostedDate. Empty = today (ET).

## `noticeType` (type: `array`):

CSV Type values, e.g. Solicitation, Combined Synopsis/Solicitation, Sources Sought, Presolicitation, Special Notice. Empty = any except Award Notice when excludeAwards is true.

## `state` (type: `string`):

Two-letter state code (e.g. VA). Matches PopState or office State.

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

Keep only Active=Yes rows.

## `excludeAwards` (type: `boolean`):

Drop Type=Award Notice (recommended for bid search).

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

Stop after this many matching rows (early exit). Default 100, minimum 1, maximum 10,000.

## `useCache` (type: `boolean`):

Reuse today's cached CSV when Last-Modified matches. Cuts repeat downloads of the ~216 MB file.

## Actor input object example

```json
{
  "source": "extract",
  "keywords": [],
  "naics": [],
  "setAside": [],
  "postedFrom": "2026-11-07",
  "noticeType": [],
  "activeOnly": true,
  "excludeAwards": true,
  "maxItems": 100,
  "useCache": true
}
```

# 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 = {
    "postedFrom": "2026-11-07"
};

// Run the Actor and wait for it to finish
const run = await client.actor("akolere/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 = { "postedFrom": "2026-11-07" }

# Run the Actor and wait for it to finish
run = client.actor("akolere/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 '{
  "postedFrom": "2026-11-07"
}' |
apify call akolere/sam-gov-contract-opportunities --silent --output-dataset

```

## MCP server setup

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