# USAspending Scraper · Federal Contracts, Grants & Recipients (`reapx/usaspending-scraper`) Actor

Scrape US federal contracts, grants, and direct payments from USAspending.gov by agency, NAICS code, PSC code, award type, state, fiscal year, and dollar amount.

- **URL**: https://apify.com/reapx/usaspending-scraper.md
- **Developed by:** [Tarek Etman](https://apify.com/reapx) (community)
- **Categories:** Business, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.30 / 1,000 award returneds

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/platform/actors/running/actors-in-store#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

![reapX — public sources in, addressable records out](https://reapx.dev/reapx.gif)

## USAspending Scraper · Federal Contracts, Grants & Recipients

**USAspending Scraper** extracts US federal contracts, grants, sub-awards, and direct payments directly from the official public [USAspending.gov API](https://api.usaspending.gov). Search billions of dollars in federal procurement spending across executive agencies, NAICS industry codes, Product Service Codes (PSC), US states, fiscal year date windows, and dollar amount thresholds with zero API key required.

> Maintained by **reapX**. Every row cites the Apify run that produced it — nothing is
> inferred, modelled or filled in, and a field absent from the source is absent from the row.
> The extracted archive for this source is browsable at
> [reapx.dev/data/usaspending-scraper/](https://reapx.dev/data/usaspending-scraper/) and mirrored as an open dataset on
> [Hugging Face](https://huggingface.co/datasets/reapxdev/usaspending-scraper) and
> [Kaggle](https://www.kaggle.com/datasets/reapxdev/usaspending-scraper). Questions: reapxdev@proton.me

Maintained by reapX. Public data extracted directly from USAspending.gov APIs. Data guarantee: every record includes stable addressable entity keys.

### How it works

USAspending Scraper queries the USAspending.gov `spending_by_award` endpoint using structured REST payloads. It parses and normalizes federal procurement records into clean tabular datasets.

1. **Specify Filter Parameters**: Choose target award types (prime contracts, grants, direct payments), executive agency names, NAICS industry codes, PSC codes, US state postal abbreviations, or dollar amount ranges.
2. **Execute the Scraper**: The actor streams paginated award records from USAspending.gov APIs with automatic backoff retry logic on rate limits.
3. **Export Addressable Entity Records**: Every returned row contains `companyName` (the recipient organization name) as its primary addressable entity identifier along with `awardId` and financial/contractual details.

### ⬇️ Input

The scraper accepts the following input parameters:

| Parameter | Type | Default | Description |
|---|---|---|---|
| `awardTypeCodes` | array | `["A", "B", "C", "D"]` | Federal award types (`A`, `B`, `C`, `D` for prime contracts; `02`, `03`, `04`, `05` for grants; `06`, `10` for direct payments). |
| `startDate` | string | `"2023-10-01"` | Start date for fiscal period (YYYY-MM-DD). |
| `endDate` | string | `"2024-09-30"` | End date for fiscal period (YYYY-MM-DD). |
| `agencyName` | string | `""` | Top-tier federal awarding agency name (e.g. `Department of Defense`, `Department of Veterans Affairs`). |
| `naicsCodes` | array | `[]` | List of 6-digit NAICS industry codes (e.g. `["541512"]` for Computer Systems Design Services). |
| `pscCodes` | array | `[]` | List of Product and Service Codes (e.g. `["R425"]` for Engineering Support Services). |
| `state` | string | `""` | Two-letter US state postal code abbreviation (e.g. `VA`, `CA`, `TX`). |
| `minAmount` | integer | `null` | Minimum total award dollar value threshold in USD. |
| `maxAmount` | integer | `null` | Maximum total award dollar value threshold in USD. |
| `maxItems` | integer | `100` | Maximum number of federal award items to collect per run (1-10000). |

#### Input Example 1: Department of Defense IT Contracts in Virginia ($1M+)

```json
{
  "awardTypeCodes": ["A", "B", "C", "D"],
  "agencyName": "Department of Defense",
  "naicsCodes": ["541512"],
  "state": "VA",
  "minAmount": 1000000,
  "startDate": "2023-10-01",
  "endDate": "2024-09-30",
  "maxItems": 100
}
```

#### Input Example 2: HHS Health & Biomedical Research Grants

```json
{
  "awardTypeCodes": ["02", "03", "04", "05"],
  "agencyName": "Department of Health and Human Services",
  "startDate": "2023-10-01",
  "endDate": "2024-09-30",
  "maxItems": 50
}
```

### ⬆️ Output

Results are stored in the run's default dataset. Each row represents one federal contract or grant award:

| Field Name | Type | Description | Example |
|---|---|---|---|
| `companyName` | string | Recipient organization name receiving the federal award. Primary entity identifier. | `"HUMANA GOVERNMENT BUSINESS INC"` |
| `awardId` | string | Unique federal contract or grant award identifier. | `"HT940216C0001"` |
| `awardAmount` | number | Total dollar value of the federal award in USD. | `51269205263.03` |
| `startDate` | string | Performance start date of the award (YYYY-MM-DD). | `"2016-08-01"` |
| `endDate` | string | Performance end date or completion date (YYYY-MM-DD). | `"2025-12-31"` |
| `awardingAgencyName` | string | Top-tier federal awarding department. | `"Department of Defense"` |
| `awardingSubAgencyName` | string | Sub-agency or bureau issuing the award. | `"Defense Health Agency"` |
| `fundingAgencyName` | string | Top-tier federal department providing funding. | `"Department of Defense"` |
| `fundingSubAgencyName` | string | Sub-agency providing funding for the award. | `"Defense Health Agency"` |
| `contractAwardType` | string | Type of award contract (e.g. DEFINITIVE CONTRACT, BPA CALL). | `"DEFINITIVE CONTRACT"` |
| `naicsCode` | string | North American Industry Classification System 6-digit code. | `"541512"` |
| `naicsDescription` | string | Description of the NAICS industry code. | `"Computer Systems Design Services"` |
| `pscCode` | string | Product and Service Code. | `"R425"` |
| `pscDescription` | string | Description of the Product and Service Code. | `"Engineering and Technical Support"` |
| `recipientStateCode` | string | Two-letter US state postal code of the recipient location. | `"VA"` |
| `generatedInternalId` | string | USAspending internal unique award identifier. | `"CONT_AWD_HT940216C0001_9700_-NONE-_-NONE-"` |
| `recipientUei` | string | Recipient Unique Entity Identifier (UEI). | `"ZE6ZM6NKSV43"` |

#### Output Example JSON

```json
{
  "companyName": "HUMANA GOVERNMENT BUSINESS INC",
  "awardId": "HT940216C0001",
  "awardAmount": 51269205263.03,
  "startDate": "2016-08-01",
  "endDate": "2025-12-31",
  "awardingAgencyName": "Department of Defense",
  "awardingSubAgencyName": "Defense Health Agency",
  "fundingAgencyName": "Department of Defense",
  "fundingSubAgencyName": "Defense Health Agency",
  "contractAwardType": "DEFINITIVE CONTRACT",
  "naicsCode": "541512",
  "naicsDescription": "Computer Systems Design Services",
  "pscCode": "R425",
  "pscDescription": "Engineering and Technical Support",
  "recipientStateCode": "KY",
  "generatedInternalId": "CONT_AWD_HT940216C0001_9700_-NONE-_-NONE-",
  "recipientUei": "ZE6ZM6NKSV43"
}
```

### ❓ FAQ

#### What award types are supported?

The scraper supports prime contracts (`A`, `B`, `C`, `D`), grants (`02`, `03`, `04`, `05`), direct payments (`06`, `10`), and loans (`07`, `08`).

#### How does entity page resolution work?

Each emitted row sets `companyName` to the Recipient Name returned by USAspending.gov. This allows entity page builders to aggregate all awards received by a specific federal contractor under one canonical company profile.

#### Are empty or blocked requests billed?

No. Pay-per-event pricing charges only for successfully retrieved and delivered award records. Blocked requests, network errors, or search queries matching zero awards cost $0.

#### Is an API key required?

No API key or authentication token is required. The scraper communicates directly with public USAspending.gov endpoints.

### 💬 Your feedback

Have questions, feature requests, or custom extraction needs? Contact the maintainer at `reapxdev@proton.me`.

***

*Unofficial - not affiliated with USAspending.gov or the US Federal Government. Collects public data only. reapx. Contact reapxdev@proton.me.*

### 🧪 Example input

A real, runnable configuration — this is an actual input this Actor has run with.

```json
{
  "awardTypeCodes": [
    "A",
    "B",
    "C",
    "D"
  ],
  "agencyName": "Department of Defense",
  "startDate": "2023-10-01",
  "endDate": "2024-09-30",
  "maxItems": 50
}
```

### 📄 Sample output

One real row from a real run of this Actor, unedited.

```json
{
  "companyName": "HUMANA GOVERNMENT BUSINESS INC",
  "awardId": "HT940216C0001",
  "awardAmount": 51269205263.03,
  "startDate": "2016-08-01",
  "endDate": "2025-12-31",
  "awardingAgencyName": null,
  "awardingSubAgencyName": null,
  "fundingAgencyName": null,
  "fundingSubAgencyName": null,
  "contractAwardType": "DEFINITIVE CONTRACT",
  "naicsCode": null,
  "naicsDescription": null,
  "pscCode": null,
  "pscDescription": null,
  "recipientStateCode": "KY",
  "generatedInternalId": "CONT_AWD_HT940216C0001_9700_-NONE-_-NONE-",
  "recipientUei": "ZE6ZM6NKSV43"
}
```

### ⚠️ Run outcomes and error handling

This Actor reports what happened in the run's **status message**, and it always keeps whatever it collected. These are the outcomes you can get and what each one means.

| Outcome | What it means |
|---|---|
| **Success** | Rows were returned and you were charged `award-returned` at $0.002 per row. |
| **No matches** | The source returned nothing for your filters. **Nothing is charged.** Widen the date window or drop a filter. |

#### What is guaranteed either way

- **Every row is pushed as it is built**, not buffered to the end of the run. Anything that buffers output loses everything to a timeout, a block or a migration; this does not.
- **A field absent from the source is absent from the row.** Nothing is inferred, modelled or filled in to make a row look complete.

# Actor input Schema

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

Select federal award types to include: <code>A</code>, <code>B</code>, <code>C</code>, <code>D</code> for prime contract awards; <code>02</code>, <code>03</code>, <code>04</code>, <code>05</code> for grants. <br><br><b>Consequence:</b> Selecting specific award types narrows the search; leaving empty returns prime contracts.<br><br>Leave this field empty to include every option.

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

Filter awards starting on or after this date formatted as <code>YYYY-MM-DD</code> (e.g. <code>2023-10-01</code> for FY2024 start). <br><br><b>Consequence:</b> A wider date range increases matching award volume and run duration. Leave empty to omit lower date limit.

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

Filter awards ending on or before this date formatted as <code>YYYY-MM-DD</code> (e.g. <code>2024-09-30</code> for FY2024 end). <br><br><b>Consequence:</b> Narrowing the period reduces matching award volume. Leave empty for default fiscal year end.

## `agencyName` (type: `string`):

Top-tier federal awarding department name (e.g. <code>Department of Defense</code> or <code>Department of Veterans Affairs</code>). <br><br><b>Consequence:</b> Restricts spending search to awards issued by the named department. Leave empty to search across all agencies.

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

List of 6-digit NAICS industry codes (e.g. <code>\["541512"]</code> for Computer Systems Design Services or <code>\["541715"]</code> for R\&D). <br><br><b>Consequence:</b> Filters awards to specific industrial sectors. Leave empty to search across all industries.

## `pscCodes` (type: `array`):

List of Product and Service Codes (e.g. <code>\["R425"]</code> for Engineering Support Services or <code>\["D302"]</code> for IT Systems Development). <br><br><b>Consequence:</b> Narrows search to specific procurement categories. Leave empty to search across all PSC codes.

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

Two-letter US state postal code abbreviation (e.g. <code>VA</code>, <code>CA</code>, <code>TX</code>). <br><br><b>Consequence:</b> Narrows search to award recipient locations in that state. Leave empty to search contractors nationwide.

## `minAmount` (type: `integer`):

Minimum total award value threshold in USD (e.g. <code>1000000</code> for $1M+ contracts). <br><br><b>Consequence:</b> Excludes smaller awards, reducing total returned items and run cost. Leave empty for no minimum threshold.

## `maxAmount` (type: `integer`):

Maximum total award value threshold in USD (e.g. <code>50000000</code> for $50M upper limit). <br><br><b>Consequence:</b> Excludes mega-contracts above this threshold. Leave empty for no maximum threshold.<br><br>The higher the number, the longer the run takes and the more you are charged, because you pay per row returned.

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

Maximum total number of federal award records to scrape and deliver in this run. <br><br><b>Consequence:</b> The higher the limit, the longer the run takes and the more items are billed. Defaults to 100.<br><br>The higher the number, the longer the run takes and the more you are charged, because you pay per row returned.

## Actor input object example

```json
{
  "awardTypeCodes": [
    "A",
    "B",
    "C",
    "D"
  ],
  "startDate": "2023-10-01",
  "endDate": "2024-09-30",
  "naicsCodes": [],
  "pscCodes": [],
  "maxItems": 100
}
```

# Actor output Schema

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

Every federal contract or grant award record found by this run, one row per item, 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"
    ],
    "startDate": "2023-10-01",
    "endDate": "2024-09-30",
    "agencyName": "",
    "naicsCodes": [],
    "pscCodes": [],
    "state": "",
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("reapx/usaspending-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 = {
    "awardTypeCodes": [
        "A",
        "B",
        "C",
        "D",
    ],
    "startDate": "2023-10-01",
    "endDate": "2024-09-30",
    "agencyName": "",
    "naicsCodes": [],
    "pscCodes": [],
    "state": "",
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("reapx/usaspending-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 '{
  "awardTypeCodes": [
    "A",
    "B",
    "C",
    "D"
  ],
  "startDate": "2023-10-01",
  "endDate": "2024-09-30",
  "agencyName": "",
  "naicsCodes": [],
  "pscCodes": [],
  "state": "",
  "maxItems": 100
}' |
apify call reapx/usaspending-scraper --silent --output-dataset

```

## MCP server setup

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