# US Contracts Scraper (`artificially/us-contracts-scraper`) Actor

Scrape federal contract awards from USAspending.gov. Search by keyword, agency, NAICS code, and value. Get award amounts, recipients, dates, and more.

- **URL**: https://apify.com/artificially/us-contracts-scraper.md
- **Developed by:** [Artificially](https://apify.com/artificially) (community)
- **Categories:** Integrations, Real estate, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## US Government Contracts Scraper - Enhanced

Scrape federal contract awards from USAspending.gov with contractor profiles, subawards, and contract analytics. Access billions of dollars in government procurement data.

### Features

#### Core Search

- **Keyword Search**: Find contracts by description or title
- **Agency Filter**: Filter by federal agency
- **NAICS Codes**: Search by industry classification
- **Value Range**: Filter by contract amount
- **Date Range**: Specify award period

#### Set-Aside Filters (NEW)

- **Small Business**: Filter by SBA small business set-asides
- **8(a) Program**: Find 8(a) certified contractor awards
- **HUBZone**: HUBZone certified businesses
- **WOSB**: Women-Owned Small Business
- **SDVOSB**: Service-Disabled Veteran-Owned
- **SDB**: Small Disadvantaged Business

#### Contractor Enrichment (NEW)

- **Contractor Profile**: Detailed business info, CAGE code, DUNS
- **Business Types**: Small business certifications and categories
- **Location Details**: Full address with congressional district
- **Contract History**: See contractor's other federal awards

#### Contract Analytics (NEW)

- **Subawards Tracking**: View subcontractor awards under prime contracts
- **Transaction History**: All modifications and funding actions
- **Contract Health**: Duration analysis and modification tracking
- **Related Contracts**: Find other awards to same contractor

### Use Cases

- Government contracting business intelligence
- Small business set-aside opportunity tracking
- Contractor vetting and due diligence
- Subcontracting opportunity discovery
- Agency spending pattern analysis
- Build procurement databases for analysis

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `searchQuery` | string | No | - | Keyword search |
| `agency` | string | No | - | Awarding agency name |
| `naicsCodes` | array | No | - | NAICS industry codes |
| `maxContracts` | number | No | `100` | Maximum contracts |
| `minValue` | number | No | - | Minimum award amount |
| `maxValue` | number | No | - | Maximum award amount |
| `dateFrom` | string | No | `2020-01-01` | Start date |
| `dateTo` | string | No | Today | End date |
| `setAsideType` | string | No | - | Small business set-aside filter |
| `includeContractorProfile` | boolean | No | `true` | Fetch contractor details |
| `includeSubawards` | boolean | No | `false` | Fetch subcontractor awards |
| `includeTransactionHistory` | boolean | No | `false` | Fetch all modifications |
| `includeRelatedContracts` | boolean | No | `false` | Find contractor's other awards |

#### Example Input

```json
{
    "searchQuery": "cybersecurity",
    "agency": "Department of Defense",
    "setAsideType": "SBA",
    "maxContracts": 50,
    "includeContractorProfile": true,
    "includeSubawards": true,
    "dateFrom": "2023-01-01"
}
```

### Output

Each contract produces a result with:

```json
{
    "awardId": "CONT_AWD_12345",
    "title": "Cybersecurity Support Services",
    "description": "Provide cybersecurity monitoring...",
    "awardingAgency": "Department of Defense",
    "awardAmount": 2500000,
    "contractorProfile": {
        "name": "Acme Security Inc.",
        "duns": "123456789",
        "cageCode": "ABC12",
        "address": {
            "city": "Arlington",
            "state": "VA",
            "congressionalDistrict": "08"
        },
        "businessTypes": ["Small Business", "Veteran Owned"],
        "totalAwards": 45,
        "totalAwardAmount": 125000000
    },
    "subawards": [
        {
            "recipientName": "SubCo LLC",
            "amount": 150000,
            "description": "Network monitoring services"
        }
    ],
    "contractAnalytics": {
        "durationMonths": 24,
        "modificationCount": 3,
        "percentComplete": 45.2
    },
    "url": "https://www.usaspending.gov/award/CONT_AWD_12345",
    "scrapedAt": "2024-01-20T12:00:00Z"
}
```

### Cost

This actor uses **pay-per-result** pricing:

| Cost Type | Amount |
|-----------|--------|
| Start fee | $0.10 per run |
| Per contract | $0.003 |

**No API key required** - Uses USAspending.gov's public API.

#### Example Cost Calculation

- 100 contracts: $0.10 + (100 x $0.003) = $0.40
- 1,000 contracts: $0.10 + (1000 x $0.003) = $3.10

### Tips

1. **Set-aside codes**:
   - `SBA` - Small Business Set-Aside
   - `8A` - 8(a) Business Development
   - `HUB` - HUBZone
   - `WOSB` - Women-Owned Small Business
   - `SDVOSB` - Service-Disabled Veteran-Owned

2. **Contractor enrichment**: Enable `includeContractorProfile` to get business types and certifications

3. **Subcontracting**: Large prime contracts often have significant subcontracting - enable `includeSubawards` to discover these opportunities

4. **Contract tracking**: Use `includeTransactionHistory` to see all modifications and funding changes

### Data Source

Data from [USAspending.gov](https://www.usaspending.gov), the official source for federal spending data.

### Support

- **Built by**: [Artificially](https://apify.com/artificially)
- **Issues**: Report bugs or request features via Apify Console

# Actor input Schema

## `searchQuery` (type: `string`):

Keywords to search for in contract descriptions

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

Filter by awarding agency name

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

Filter by NAICS industry codes

## `maxContracts` (type: `integer`):

Maximum number of contracts to return

## `minValue` (type: `integer`):

Minimum contract value in USD

## `maxValue` (type: `integer`):

Maximum contract value in USD

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

Filter by contract start date (YYYY-MM-DD)

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

Filter by contract end date (YYYY-MM-DD)

## `setAsideType` (type: `string`):

Filter by small business set-aside programs

## `includeContractorProfile` (type: `boolean`):

Fetch detailed contractor information including business types and certifications

## `includeSubawards` (type: `boolean`):

Fetch subcontractor awards under this prime contract

## `maxSubawards` (type: `integer`):

Maximum subawards to fetch per contract

## `includeTransactionHistory` (type: `boolean`):

Fetch all modifications and transactions for each contract

## `includeRelatedContracts` (type: `boolean`):

Find other contracts awarded to the same contractor

## `maxRelatedContracts` (type: `integer`):

Maximum related contracts to fetch

## `proxyConfiguration` (type: `object`):

Select proxies to be used by your scraper

## Actor input object example

```json
{
  "searchQuery": "software development",
  "agency": "Department of Defense",
  "naicsCodes": [
    "541511",
    "541512"
  ],
  "maxContracts": 100,
  "dateFrom": "2024-01-01",
  "dateTo": "2024-12-31",
  "setAsideType": "",
  "includeContractorProfile": true,
  "includeSubawards": false,
  "maxSubawards": 10,
  "includeTransactionHistory": false,
  "includeRelatedContracts": false,
  "maxRelatedContracts": 5
}
```

# Actor output Schema

## `awardId` (type: `string`):

Unique contract award ID

## `title` (type: `string`):

Contract title

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

Federal agency awarding the contract

## `recipientName` (type: `string`):

Company/contractor that won the award

## `awardAmount` (type: `string`):

Total contract award amount in USD

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

Contract start date

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

Contract end date

## `naicsCode` (type: `string`):

NAICS industry code

## `url` (type: `string`):

URL to contract details on USAspending.gov

## `scrapedAt` (type: `string`):

ISO 8601 timestamp when scraped

# 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 = {};

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

# Run the Actor and wait for it to finish
run = client.actor("artificially/us-contracts-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 '{}' |
apify call artificially/us-contracts-scraper --silent --output-dataset

```

## MCP server setup

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