# SAM.gov & USAspending Federal Contracts & Awards Scraper (`apex-b2b-data/sam-gov-federal-contracts-opportunities`) Actor

Extract US federal contract awards, prime contractors, recipient UEI/DUNS, awarding agencies, contract amounts, and executive compensation from USAspending.gov & SAM.gov with lead scoring and zero proxy fees.

- **URL**: https://apify.com/apex-b2b-data/sam-gov-federal-contracts-opportunities.md
- **Developed by:** [George Barnes](https://apify.com/apex-b2b-data) (community)
- **Categories:** Lead generation, Business, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.05 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 & USAspending Federal Contracts & Opportunities Scraper (`$1.50 / 1K`)

**Extract verified US federal prime contract awards, government contractors, recipient Unique Entity Identifiers (UEI), DUNS numbers, awarding agencies, obligation amounts, and executive compensation—with zero residential proxy fees and zero required API keys.**

This Actor queries the official **USAspending.gov REST API v2** (`spending_by_award`) and enriches each award via the deep award detail endpoint (`/api/v2/awards/{id}/`) in parallel, unlocking complete visibility into federal procurement without hitting SAM.gov's restrictive rate limits or paying expensive data brokerage subscriptions.

***

### Why Choose This Federal Contracts Actor? (Comparison)

| Capability | This Actor | Legacy SAM.gov Scrapers | Manual USAspending CSV |
| :--- | :--- | :--- | :--- |
| **Price per 1,000 Contract Leads** | **`$1.50 / 1K` (`$0.0015` / lead)** | `$5.00 – $15.00 / 1K` + Proxies | Free (Laborious manual export) |
| **Live Unauthenticated API Access** | ✅ Yes (0 proxy costs, 0 API keys) | ❌ Needs residential proxies | N/A (Web UI only) |
| **Recipient UEI & Parent Corporate UEI** | ✅ Enriched via `/api/v2/awards/` | ⚠️ Inconsistent or missing | ⚠️ Multiple table joins required |
| **Executive Compensation & Officers** | ✅ Included (Names + $ amounts) | ❌ Not available | ❌ Hidden in separate files |
| **Contract Vehicle & Period of Performance** | ✅ Full dates & contract type | ⚠️ Often truncated | ⚠️ Raw columns uncleaned |
| **0–100 B2B Contractor Lead Score** | ✅ Automated scoring & segments | ❌ No | ❌ No |
| **Automated Segmentation Tags** | ✅ `MEGA_CONTRACTOR`, `VERIFIED_UEI`, etc. | ❌ No | ❌ No |
| **Dual Mode (Apify Cloud + CLI Fallback)** | ✅ Run on Apify or standalone CLI | ❌ Apify platform only | ❌ No automation |
| **Direct Web Permalinks** | ✅ Instant USAspending award link | ❌ No | ❌ No |

***

### Transparent Pricing (`$1.50` per 1,000 Awards)

Pay only for the federal contract records you extract (`$0.0015` per record via Apify Pay-Per-Event pricing). No monthly subscriptions or minimum spend required:

| Workflow | Records Returned | Total Cost |
| :--- | :--- | :--- |
| **Quick Test Run** (verify schema & data quality) | `20` awards | **`$0.03` (3 cents)** |
| **Daily Agency Contract Feed** (e.g. DOD, HHS, DHS) | `~200` awards / day | **`$0.30 / day` (`~$9.00 / mo`)** |
| **Targeted Industry / NAICS Pull** | `1,000` awards | **`$1.50`** |
| **Full Regional TAM Export** | `10,000` awards | **`$15.00`** |

***

### High-Intent B2B Playbooks (Copy-Paste Inputs)

#### 1. Defense & Aerospace Mega-Contractors ($10M+ Prime Awards)

Filter for multi-million and multi-billion dollar definitive contracts awarded by the Department of Defense, Army, Navy, or Air Force. Ideal for government relations, defense subcontractors, and enterprise tooling:

```json
{
  "awardingAgency": "Department of Defense",
  "awardTypeCodes": ["C", "D"],
  "minAwardAmount": 10000000,
  "sortBy": "Award Amount",
  "sortOrder": "desc",
  "enrichDetails": true,
  "maxItems": 100
}
```

#### 2. IT Modernization, Cloud & Cybersecurity Contracts

Discover prime contractors winning high-value federal IT, systems integration, and cybersecurity contract vehicles. Perfect for tech recruitment, B2B SaaS partnerships, and teaming:

```json
{
  "keywords": ["cybersecurity", "cloud", "artificial intelligence", "zero trust"],
  "awardTypeCodes": ["A", "B", "C", "D"],
  "minAwardAmount": 1000000,
  "sortBy": "Award Amount",
  "sortOrder": "desc",
  "enrichDetails": true,
  "maxItems": 50
}
```

#### 3. Capital Region Federal Contractors (VA / MD / DC Headquarters)

Prospect government contractors headquartered in the DC metro area for executive search, local B2B services, commercial real estate, and financial advisory:

```json
{
  "recipientState": "VA",
  "minAwardAmount": 250000,
  "sortBy": "Award Amount",
  "sortOrder": "desc",
  "enrichDetails": true,
  "maxItems": 100
}
```

#### 4. Healthcare & Veterans Affairs Medical Procurement

Track prime vendors winning healthcare, pharmaceuticals, medical logistics, and health IT awards across the Department of Veterans Affairs and Department of Health and Human Services:

```json
{
  "awardingAgency": "Department of Veterans Affairs",
  "awardTypeCodes": ["A", "B", "C", "D"],
  "minAwardAmount": 500000,
  "sortBy": "Award Amount",
  "sortOrder": "desc",
  "enrichDetails": true,
  "maxItems": 50
}
```

***

### Sample Output Record

```json
{
  "award_id": "HT940216C0001",
  "recipient_name": "HUMANA GOVERNMENT BUSINESS INC",
  "award_amount": 51269205263.03,
  "awarding_agency": "Department of Defense",
  "funding_agency": "Department of Defense",
  "contract_description": "IGF::OT::IGF",
  "recipient_uei": "ZE6ZM6NKSV43",
  "recipient_duns": null,
  "period_of_performance_start_date": "2016-08-01",
  "period_of_performance_current_end_date": "2025-12-31",
  "lead_score": 100,
  "lead_segment": "MEGA_CONTRACTOR",
  "extracted_at": "2026-11-04T00:22:11.983966+00:00",
  "lead_segments": [
    "MEGA_CONTRACTOR",
    "VERIFIED_UEI",
    "EXECUTIVE_OFFICERS_DISCLOSED",
    "PRIME_DEFINITIVE_CONTRACT",
    "DEFENSE_AEROSPACE"
  ],
  "contract_award_type": "DEFINITIVE CONTRACT",
  "awarding_sub_agency": "Defense Health Agency",
  "funding_sub_agency": "Defense Health Agency",
  "parent_recipient_name": "HUMANA GOVERNMENT BUSINESS INC",
  "parent_recipient_uei": "ZE6ZM6NKSV43",
  "recipient_address": "500 W MAIN STREET",
  "recipient_city": "LOUISVILLE",
  "recipient_state": "KY",
  "recipient_zip": "40202",
  "business_categories": [
    "Category Business",
    "Corporate Entity Not Tax Exempt",
    "Not Designated a Small Business",
    "Special Designations",
    "U.S.-Owned Business"
  ],
  "executive_officers": [
    {
      "name": "KAREN MORAN",
      "compensation_usd": 1409718.0
    },
    {
      "name": "KEVIN REGENHOLD",
      "compensation_usd": 607266.0
    }
  ],
  "place_of_performance": {
    "city": "LOUISVILLE",
    "state": "KY",
    "zip": "40201",
    "country": "UNITED STATES"
  },
  "internal_id": 307885715,
  "generated_internal_id": "CONT_AWD_HT940216C0001_9700_-NONE-_-NONE-",
  "usaspending_permalink": "https://www.usaspending.gov/award/CONT_AWD_HT940216C0001_9700_-NONE-_-NONE-"
}
```

***

### Integration & Automated Workflows

#### Python (Apify Client)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run_input = {
    "keywords": ["cybersecurity"],
    "minAwardAmount": 1000000,
    "maxItems": 50,
}

run = client.actor("your-username/sam-gov-federal-contracts-opportunities").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"Contract: {item['award_id']} | Recipient: {item['recipient_name']} | Amount: ${item['award_amount']:,.2f}")
```

#### Clay.com / n8n / Make (Sync HTTP Webhook)

Run the Actor synchronously and retrieve enriched JSON items in a single HTTP request:

```bash
curl -X POST "https://api.apify.com/v2/acts/your-username~sam-gov-federal-contracts-opportunities/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "recipientState": "VA",
    "minAwardAmount": 500000,
    "maxItems": 25
  }'
```

#### Standalone CLI Execution (Offline / Local Dev)

Run locally without any Apify cloud dependencies. Extracted data is saved automatically to `storage/datasets/default/results.json`:

```bash
## Clone the repository and install dependencies
git clone <repo-url>
cd sam-gov-federal-contracts-opportunities
pip install -r requirements.txt

## Run zero-config default extraction
python3 src/main.py

## Or pass custom input JSON file
ACTOR_INPUT_PATH=my_input.json python3 src/main.py
```

# Actor input Schema

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

Keywords to match against contract award title, description, or recipient name (e.g. \['cybersecurity', 'cloud', 'defense']).

## `awardTypeCodes` (type: `array`):

Federal contract vehicle types: A=BPA Call, B=Purchase Order, C=Delivery Order, D=Definitive Contract.

## `recipientState` (type: `string`):

Filter by 2-letter US State abbreviation of contractor headquarters (e.g. 'VA', 'MD', 'DC', 'TX').

## `awardingAgency` (type: `string`):

Filter by awarding federal department or agency name (e.g. 'Department of Defense', 'Department of Veterans Affairs').

## `minAwardAmount` (type: `integer`):

Filter out awards below this total obligation threshold (e.g. 100000).

## `maxAwardAmount` (type: `integer`):

Filter out awards above this total obligation threshold.

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

Filter by 6-digit NAICS industry codes (e.g. \['541512', '541330']).

## `fiscalYears` (type: `array`):

Filter by federal fiscal years (e.g. \[2024, 2025, 2026]).

## `startDate` (type: `string`):

Earliest contract action date in YYYY-MM-DD format.

## `endDate` (type: `string`):

Latest contract action date in YYYY-MM-DD format.

## `sortBy` (type: `string`):

Field to sort search results by.

## `sortOrder` (type: `string`):

Order of sorting.

## `enrichDetails` (type: `boolean`):

Fetch deep award details (UEI, parent contractor, executive compensation, place of performance) via /api/v2/awards/{id}/.

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

Maximum number of contract award records to retrieve.

## `samGovApiKey` (type: `string`):

Optional SAM.gov public API key for pre-award solicitations and contract opportunities.

## Actor input object example

```json
{
  "keywords": [],
  "awardTypeCodes": [
    "A",
    "B",
    "C",
    "D"
  ],
  "recipientState": "",
  "awardingAgency": "",
  "minAwardAmount": 0,
  "maxAwardAmount": 0,
  "naicsCodes": [],
  "fiscalYears": [],
  "startDate": "",
  "endDate": "",
  "sortBy": "Award Amount",
  "sortOrder": "desc",
  "enrichDetails": true,
  "maxItems": 10,
  "samGovApiKey": ""
}
```

# Actor output Schema

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

Structured JSON records produced by SAM.gov & USAspending Federal Contracts & Awards Scraper in the default dataset.

# 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 = {
    "awardTypeCodes": [
        "A",
        "B",
        "C",
        "D"
    ],
    "sortBy": "Award Amount",
    "sortOrder": "desc",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("apex-b2b-data/sam-gov-federal-contracts-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 = {
    "awardTypeCodes": [
        "A",
        "B",
        "C",
        "D",
    ],
    "sortBy": "Award Amount",
    "sortOrder": "desc",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("apex-b2b-data/sam-gov-federal-contracts-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 '{
  "awardTypeCodes": [
    "A",
    "B",
    "C",
    "D"
  ],
  "sortBy": "Award Amount",
  "sortOrder": "desc",
  "maxItems": 10
}' |
apify call apex-b2b-data/sam-gov-federal-contracts-opportunities --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,apex-b2b-data/sam-gov-federal-contracts-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/tsiOsKwxDv41gGahm/builds/ApcnWwbAylXWnKVMp/openapi.json
