# SAM.gov Contract Opportunities Scraper: Federal Bids & Awards (`mossfetch/sam-gov-opportunities`) Actor

SAM.gov contract opportunities scraper via the official API: federal RFPs, solicitations and awards. Filter by keyword, NAICS, set-aside, state and notice type. Bring your own free SAM.gov key. $3 per 1,000.

- **URL**: https://apify.com/mossfetch/sam-gov-opportunities.md
- **Developed by:** [Mossfetch](https://apify.com/mossfetch) (community)
- **Categories:** Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.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 Contract Opportunities Scraper and API: US federal bids, solicitations & awards

Get **US federal contract opportunities** from **SAM.gov** as clean JSON, CSV or Excel. The actor calls the **official SAM.gov Get Opportunities public API**. It does not scrape the website, so it is stable and stays within SAM.gov's terms.

Use it to find **federal solicitations and RFPs**, spot **sources-sought and presolicitation notices** early, filter by **NAICS code** and **small-business set-aside** (8(a), HUBZone, SDVOSB, WOSB and more), and track **contract awards** and winners.

### Try it in 2 minutes

1. Get your free SAM.gov API key (steps below).
2. Open the actor, paste the key, and press **Start**. The prefilled input stops after 3 opportunities, so the test run uses one SAM.gov request and costs under $0.01.
3. Raise **Max results** for a full export.

The actor needs your key to fetch data. SAM.gov does not allow keys to be shared, so this is a limit of the source, not of the actor. A run without a key ends immediately with instructions and is not charged.

### Who it's for

Small businesses and contractors hunting federal work, capture and proposal teams, government-contracting consultants, and sales teams selling to federal agencies.

### Use cases

1. **Daily bid alerts** for your NAICS codes and set-asides (8(a), HUBZone, SDVOSB, WOSB).
2. **Early pipeline.** Spot sources-sought and presolicitation notices before the RFP lands.
3. **Award research.** See who won what, for how much, and when, to plan recompetes and teaming.

### You need your own free API key

SAM.gov requires every user to use their own key, and asks that you never share it.

1. Sign in (or register for free) at [SAM.gov](https://sam.gov).
2. Open **Account Details** and request a **Public API Key** (you re-enter your password to view it).
3. Paste it into the **SAM.gov API key** field. It is stored as a secret input and never written to the dataset or the log.

### Daily request quota (important)

SAM.gov limits requests per day by account role. A personal account **without a role gets about 10 requests per day**; accounts with a federal role get far more. One request returns up to 1,000 notices, so 10 requests is plenty for most searches. It is **not** plenty if you:

- select many **notice types** or **NAICS codes** (each combination is one query, one or more requests each), or
- turn on **Fetch full descriptions** (one extra request per notice).

When the quota runs out, the actor stops cleanly, keeps every row already saved, and says so in the run status. Run it again after the quota resets, or narrow the filters.

### What you can do

- Search by **title keyword**, **notice type** (solicitation, presolicitation, combined synopsis/solicitation, sources sought, special notice, award, justification, surplus sale), **NAICS**, **set-aside**, **place-of-performance state** and **agency**.
- Pick any **posted-date window up to one year** (default: last 7 days).
- Get **active notices only** by default.
- Optionally add the **full description text**.
- Schedule it daily for a fresh list of new opportunities.

### Example input

```json
{
  "apiKey": "YOUR-SAM-GOV-API-KEY",
  "postedFrom": "2026-11-12",
  "postedTo": "2026-11-19",
  "keywords": "cloud",
  "noticeTypes": ["o", "k"],
  "naicsCodes": ["541512"],
  "setAside": "SBA",
  "state": "VA",
  "maxItems": 500
}
```

### Output

One row per notice, deduplicated by `noticeId`, with dates in ISO 8601.

| Field | Description |
|---|---|
| `noticeId`, `solicitationNumber`, `uiLink` | Identifiers and the SAM.gov page |
| `title`, `type`, `baseType` | Notice title and type |
| `postedDate`, `responseDeadline`, `archiveDate` | Dates (ISO 8601) |
| `department`, `subTier`, `office`, `fullParentPathName` | Contracting organization |
| `naicsCode`, `classificationCode` | Industry and product/service codes |
| `typeOfSetAside`, `typeOfSetAsideDescription` | Set-aside |
| `placeOfPerformance` | `{ city, state, zip, country }` |
| `active` | true / false |
| `award` | `{ date, number, amount, awardeeName, awardeeUei }` for award notices |
| `pointOfContact` | Government contacts exactly as SAM.gov publishes them |
| `descriptionText` | Plain-text description (only with **Fetch full descriptions**) |
| `resourceLinks` | Attachment links published with the notice |
| `source` | `SAM.gov public API` |

### Sample output

| Title | Type | Agency | NAICS | Set-aside | Response deadline |
|---|---|---|---|---|---|
| Cloud Hosting Services | Combined Synopsis/Solicitation | GSA / FAS IT | 541512 | SBA | 2026-12-10 |
| Historic Office Renovation | Award Notice | (agency) | 236220 | none | n/a |

These two rows are **illustrative**: they come from test fixtures modelled on the official API documentation, not from a live run, because every run needs the user's own key.

### Pricing

Pay per result: **$3 per 1,000 opportunities** ($0.003 each, event `Opportunity`). Filtered-out and duplicate notices are free. A run that fails because the key is rejected saves nothing and is not charged. The prefilled test run costs under $0.01.

### Notes

- Data is public federal procurement information published by SAM.gov. Contact details are the official government business contacts SAM.gov publishes with each notice; use them in line with applicable law.
- `keywords` is matched against the notice **title** by SAM.gov.
- This is an independent tool, not affiliated with or endorsed by the U.S. General Services Administration.

### FAQ

**Do I have to use my own API key?** Yes. SAM.gov issues keys per user and prohibits sharing them. Your key is a secret input and is never logged or saved to the dataset.

**Why did my run stop early?** Most likely the SAM.gov daily request quota ran out (about 10 per day for accounts without a role). Rows already saved are kept. Narrow the filters or retry after the reset.

**Is this the official API?** Yes, the SAM.gov Get Opportunities public API. No scraping.

**Does it include UK or EU tenders?** Not here. See [UK Government Tenders](https://apify.com/mossfetch/uk-public-tenders) and [EU Tenders API (TED)](https://apify.com/mossfetch/eu-ted-tenders).

### Use it from code (API)

Run it from your own code with the Apify API clients. The input is the same JSON as in the form above.

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("mossfetch/sam-gov-opportunities").call(run_input={
  "apiKey": "YOUR-SAM-GOV-API-KEY",
  "keywords": "cloud",
  "naicsCodes": [
    "541512"
  ],
  "maxItems": 100
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**JavaScript**

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('mossfetch/sam-gov-opportunities').call({
  "apiKey": "YOUR-SAM-GOV-API-KEY",
  "keywords": "cloud",
  "naicsCodes": [
    "541512"
  ],
  "maxItems": 100
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**curl**

```bash
curl -X POST "https://api.apify.com/v2/acts/mossfetch~sam-gov-opportunities/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"apiKey": "YOUR-SAM-GOV-API-KEY", "keywords": "cloud", "naicsCodes": ["541512"], "maxItems": 100}'
```

### Integrations and export

Results land in an Apify dataset. Download them as JSON, CSV, Excel, XML or HTML from the dataset tab or the API. You can schedule runs, trigger a webhook when a run finishes, and connect the actor to Make, Zapier, n8n or Google Sheets with Apify's standard integrations. These are generic Apify platform features, not extra features of this actor.

### More public-sector and funding data from mossfetch

- [UK Government Tenders (Contracts Finder + Find a Tender)](https://apify.com/mossfetch/uk-public-tenders)
- [EU Tenders API (TED)](https://apify.com/mossfetch/eu-ted-tenders)
- [SEC Form D Funding Leads](https://apify.com/mossfetch/sec-form-d-funding-leads)

# Actor input Schema

## `apiKey` (type: `string`):

Required to fetch data. Your own free Public API Key: SAM.gov > Account Details > Public API Key. Never shared or stored by the actor. Without it, the run ends immediately with instructions and charges nothing.

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

First posted date (inclusive). Default: 7 days before 'Posted to'.

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

Last posted date (inclusive). Default: today. SAM.gov allows at most 1 year between the two dates.

## `keywords` (type: `string`):

Matched against the notice title by SAM.gov.

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

Empty = all types. Each selected type uses its own API request.

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

Up to 6 digits, e.g. 541512. Each code uses its own API request.

## `setAside` (type: `string`):

Restrict to one set-aside type.

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

2-letter state code, e.g. VA.

## `organizationName` (type: `string`):

Department or sub-tier name, e.g. 'DEPT OF DEFENSE'.

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

Drop notices SAM.gov marks as inactive.

## `fetchDescriptions` (type: `boolean`):

Adds the notice text. Costs one extra SAM.gov API request per notice, which burns a daily quota quickly. Best with a federal-role key.

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

Stop after this many opportunities. 0 = no limit. Each costs $0.003, so the prefilled 3 is a test run under $0.01. Raise it for a full export.

## Actor input object example

```json
{
  "activeOnly": true,
  "fetchDescriptions": false,
  "maxItems": 3
}
```

# Actor output Schema

## `opportunities` (type: `string`):

Deduplicated SAM.gov contract opportunities and award notices.

## `runSummary` (type: `string`):

Requests used, rows saved, and why the run stopped (for example, the daily SAM.gov quota).

# 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 = {
    "maxItems": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("mossfetch/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 = { "maxItems": 3 }

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

```

## MCP server setup

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