# Federal Contracts Search: SAM.gov Opportunities & Award History (`private_image_hg9/federal-contracts-search`) Actor

Search U.S. federal contract awards from USAspending.gov (no key needed) and open SAM.gov contract opportunities (with your free SAM.gov key) by keyword, NAICS, agency, set-aside, state and date. Clean JSON with amounts, winners, deadlines and links.

- **URL**: https://apify.com/private_image_hg9/federal-contracts-search.md
- **Developed by:** [Michael Shanker](https://apify.com/private_image_hg9) (community)
- **Categories:** Lead generation, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 opportunity saveds

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

## Federal Contracts Search: SAM.gov Opportunities & Award History

Find U.S. federal contracting work in one place: **who won past contracts** (from USAspending.gov) and **what's open to bid now** (from SAM.gov). Filter by keywords, NAICS codes, agency, small-business set-aside, state and date, and get clean JSON rows with amounts, winners, deadlines and direct links.

Award history works right away with **no account and no API key**. Open opportunities use your own free SAM.gov API key, because SAM.gov offers no keyless API for them.

**$2.00 per 1,000 results.** You pay only for rows saved to your dataset. Searches with no matches cost nothing, and there's no start fee.

### What you can use it for

- **Small businesses and GovCon teams:** see what's open in your NAICS codes and set-aside category, plus who won similar work before and for how much.
- **Capture and BD:** list the largest awards by agency, NAICS and state to size a market and spot incumbents and recompetes.
- **Sales teams selling to contractors:** find companies that just won federal contracts. A new award is a strong buying signal.
- **Analysts and journalists:** track federal spending in an industry or a state over time.
- **Monitoring:** schedule it daily with **Last N days = 1** to get the newest awards and notices every morning.

### Input

| Field | What it does |
|---|---|
| **What to get** | Awards + opportunities (default), awards only, or opportunities only. |
| **Keywords** | Words or phrases. Awards match any keyword. Opportunities match the notice title, one SAM.gov search per keyword. |
| **NAICS codes** | Industry codes, e.g. `541512`. For awards, shorter prefixes also work (`5415`, `54`). |
| **Agency** | Name or abbreviation, e.g. `Department of Defense`, `DOD`, `Department of the Army`. |
| **Set-aside type** | Total small business, 8(a), HUBZone, SDVOSB, WOSB, EDWOSB and the other SAM.gov set-aside codes. |
| **Place of performance state** | Two-letter code, e.g. `VA`. |
| **Opportunity notice types** | Solicitation, combined synopsis/solicitation, presolicitation, sources sought, award notice and more. |
| **From date / To date / Last N days** | Opportunities posted, or awards signed, in this range. Default: the last 30 days. |
| **Max results (per source)** | Cap for opportunities and, separately, for awards. |
| **Sort awards by** | Largest amount (default) or newest start date. |
| **SAM.gov API key** | Your own free key, only needed for opportunities. |

Example input:

```json
{
  "keywords": ["cybersecurity"],
  "naicsCodes": ["541512", "541519"],
  "agency": "Department of Defense",
  "setAside": "SBA",
  "lastDays": 90,
  "maxResults": 500
}
```

### Output

Each row has a `recordType` of `award` or `opportunity`. The dataset has a **Contract awards** view and a **SAM.gov opportunities** view. Examples (values illustrative):

```json
{
  "recordType": "award",
  "awardId": "EXAMPLE0001C26",
  "title": "CYBERSECURITY OPERATIONS AND INCIDENT RESPONSE SUPPORT",
  "recipientName": "Example Cyber Defense LLC",
  "recipientUei": "EXMPL0000001",
  "awardAmount": 48250000.0,
  "totalOutlays": 19300000.0,
  "awardType": "DEFINITIVE CONTRACT",
  "awardDate": "2026-10-14",
  "startDate": "2026-10-15",
  "endDate": "2031-10-14",
  "agency": "Department of Defense",
  "subAgency": "Department of the Army",
  "naicsCode": "541512",
  "naicsDescription": "COMPUTER SYSTEMS DESIGN SERVICES",
  "pscCode": "DJ01",
  "placeOfPerformanceState": "VA",
  "url": "https://www.usaspending.gov/award/CONT_AWD_EXAMPLE0001C26_9700_-NONE-_-NONE-",
  "source": "usaspending.gov"
}
```

```json
{
  "recordType": "opportunity",
  "noticeId": "01ab01cd01ef4a1b9c0d01e2f3a4b5c6",
  "title": "Cybersecurity Operations Support Services",
  "solicitationNumber": "EX-SOL-26-0001",
  "noticeType": "Solicitation",
  "postedDate": "2026-10-30",
  "responseDeadline": "2026-12-01T17:00:00-05:00",
  "active": true,
  "agency": "DEPT OF DEFENSE",
  "subAgency": "DEPT OF THE ARMY",
  "office": "W6QK ACC-APG",
  "naicsCode": "541512",
  "pscCode": "DJ01",
  "setAsideCode": "SBA",
  "setAside": "Total Small Business Set-Aside (FAR 19.5)",
  "placeOfPerformanceState": "VA",
  "awardeeName": null,
  "attachmentLinks": ["https://sam.gov/api/prod/opps/v3/opportunities/resources/files/.../download"],
  "url": "https://sam.gov/opp/01ab01cd01ef4a1b9c0d01e2f3a4b5c6/view",
  "source": "sam.gov"
}
```

Award notices from SAM.gov also fill `awardNumber`, `awardDate`, `awardAmount`, `awardeeName` and `awardeeUei`. Contact names, emails and phone numbers of contracting staff are deliberately left out. Open the SAM.gov link to see who to contact.

Download results as JSON, CSV or Excel, or send them to Google Sheets, Zapier, Make or n8n. The run also saves a `SUMMARY` record with how many rows each source returned, the agency your input matched, and any note (for example a missing or rejected key).

### Pricing

Pay per event: **$0.002 per award or opportunity saved ($2.00 per 1,000)**. No start fee. Set a maximum charge per run in the run options and the Actor stops cleanly when it's reached.

### Getting a free SAM.gov API key (opportunities only)

1. Sign in or register at sam.gov (free).
2. Open your profile, then **Account Details**, and request a **Public API Key**.
3. Paste it into **SAM.gov API key**. Apify stores it encrypted, and it's never written to your results.

A basic personal key allows **10 SAM.gov requests a day**. Each request returns up to 1,000 opportunities, so that's plenty for daily monitoring. The Actor makes one request per keyword (or per NAICS code when you give no keywords) and per year of dates, uses at most 10 per run, and tells you if your input needs more. If the daily limit is reached, the run keeps everything already saved.

### Tips

- Leave **Keywords** empty and use NAICS codes for the broadest industry view.
- Award data starts at 2007-10-01 (fiscal year 2008).
- Award history covers definitive contracts, purchase orders, delivery orders and BPA calls. It doesn't include grants or IDV vehicles themselves.
- Agency names on SAM.gov are written like `DEPT OF DEFENSE`. Both full names and abbreviations generally work for the agency filter.

### Data source and terms

Award data comes from the official [USAspending.gov API](https://api.usaspending.gov), run by the U.S. Department of the Treasury. Opportunity data comes from the official SAM.gov Get Opportunities Public API run by the U.S. General Services Administration, using your own key. Both are public U.S. government data. The Actor uses only these documented APIs, spaces out its requests, doesn't log in anywhere and doesn't scrape websites. This Actor isn't affiliated with or endorsed by GSA, SAM.gov, the Treasury or USAspending.gov.

# Actor input Schema

## `dataType` (type: `string`):

Award history comes from USAspending.gov and needs no key. Open opportunities come from SAM.gov and need your own free SAM.gov API key (below).

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

Words or phrases, e.g. "cybersecurity", "janitorial". Awards match any keyword in the award description and other text. Opportunities match the notice title, one SAM.gov search per keyword.

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

Industry codes, e.g. 541512 (Computer Systems Design). For awards, 2 to 5 digit prefixes also work (54 = all professional services).

## `agency` (type: `string`):

Department or agency name or abbreviation, e.g. "Department of Defense", "DOD", "Department of the Army". Leave empty for all agencies.

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

Small-business program the contract is reserved for. SAM.gov accepts one at a time.

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

Two-letter state code, e.g. VA, TX, CA.

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

SAM.gov only. Leave empty for all types.

## `dateFrom` (type: `string`):

Opportunities posted, or awards signed, on or after this date (YYYY-MM-DD). Leave empty to use "Last N days". Award data starts at 2007-10-01.

## `dateTo` (type: `string`):

On or before this date (YYYY-MM-DD). Leave empty for today.

## `lastDays` (type: `integer`):

Used when From date is empty.

## `maxResults` (type: `integer`):

Stop after this many opportunities, and separately this many awards.

## `awardSort` (type: `string`):

Which awards come first when there are more than Max results.

## `samApiKey` (type: `string`):

Your own free public API key from SAM.gov (sign in at sam.gov, then Account Details > Public API Key). Basic keys allow 10 SAM.gov requests a day, and each request returns up to 1,000 opportunities. Stored encrypted and never written to the output. Not needed for award history.

## Actor input object example

```json
{
  "dataType": "both",
  "keywords": [
    "cybersecurity"
  ],
  "setAside": "any",
  "lastDays": 30,
  "maxResults": 100,
  "awardSort": "amount"
}
```

# Actor output Schema

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

Every row the run saved, in the default dataset.

## `summary` (type: `string`):

Counts and notes for the run, including anything skipped and why.

# 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 = {
    "keywords": [
        "cybersecurity"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("private_image_hg9/federal-contracts-search").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 = { "keywords": ["cybersecurity"] }

# Run the Actor and wait for it to finish
run = client.actor("private_image_hg9/federal-contracts-search").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 '{
  "keywords": [
    "cybersecurity"
  ]
}' |
apify call private_image_hg9/federal-contracts-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,private_image_hg9/federal-contracts-search"
        }
    }
}
```

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/cy6fmGPUXqy9hPyhr/builds/cNI4hPdra0tgmi3jg/openapi.json
