# USAspending Scraper - Federal Contracts & Awards (`evpp/usaspending`) Actor

Scrape and export USAspending federal awards as a clean JSON API: recipients, agencies, amounts, contract types, NAICS, CFDA, dates, and locations.

- **URL**: https://apify.com/evpp/usaspending.md
- **Developed by:** [Evp Labs](https://apify.com/evpp) (community)
- **Categories:** Lead generation, Business, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 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.

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

## USAspending Scraper - Federal Contracts & Awards

Pull **US federal contract, grant, loan and assistance awards** from the official **USAspending.gov** public API into clean flat JSON. Filter by recipient name, awarding agency, minimum amount and date window; every award is enriched with **NAICS / CFDA codes**, recipient UEI, recipient city/state/country and a link to its USAspending profile. No headless browser, no CAPTCHAs, no API key.

### Why use it

- **GovCon business development teams**: track competitors' contract wins, monitor an agency's largest obligations, and build account lists from real award data.
- **Federal contractors & consultants**: watch a rival's portfolio (`recipientSearch: "LOCKHEED"`) or find who holds the biggest awards in your NAICS market.
- **Journalists & watchdogs**: get structured, citable records of where federal money goes, straight from the Treasury's official source.
- **Investors & analysts**: monitor government-exposed companies and agencies without paying for a GovCon data subscription.

### What it scrapes

| Step | Trigger | Source |
|------|---------|--------|
| Award search | every run | `POST api.usaspending.gov/api/v2/search/spending_by_award/` |
| Detail enrichment | `includeDetails: true` (default) | `GET api.usaspending.gov/api/v2/awards/{id}/` |

All endpoints are the same public JSON API that powers usaspending.gov. No auth required.

### Quick start input

Target source: `usaspending.gov`. Paste this JSON into the Actor input tab for a fast first run, or use it as the body of the Apify API run call:

```json
{
    "awardTypes": "contracts",
    "agency": "Department of Defense",
    "minAmount": 1000000,
    "sortBy": "amount",
    "includeDetails": true,
    "maxItems": 10
}
```

The default input is intentionally small. Raise `maxItems` only after validating the first federal award records.

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `recipientSearch` | string | `""` | Recipient (contractor/grantee) name filter, e.g. `"LOCKHEED"`, `"BOOZ ALLEN"`. Empty = all recipients. |
| `awardTypes` | enum | `"contracts"` | `contracts` (type codes A-D), `grants` (grants & cooperative agreements 02-05), or `all` (adds direct payments 06-08 and loans 09-11). |
| `agency` | string | `""` | Top-tier awarding agency name as on USAspending, e.g. `"Department of Defense"`. Empty = all agencies. |
| `startDate` | string | 90 days ago | Start of activity window `YYYY-MM-DD`. USAspending returns awards whose period of performance overlaps the window. |
| `endDate` | string | today | End of activity window `YYYY-MM-DD`. |
| `minAmount` | integer | none | Only awards with total obligation at or above this USD value. |
| `sortBy` | enum | `"amount"` | `amount` = largest obligations first, `date` = newest start dates first. |
| `includeDetails` | boolean | `true` | Enrich each award via its detail endpoint (adds NAICS/CFDA, UEI, recipient location). |
| `maxItems` | integer | `10` | Maximum awards to output (1-500), strictly enforced. |
| `proxyConfiguration` | object | `{ "useApifyProxy": false }` | Optional. The USAspending API is public and needs no proxy. |

### Output

One flat JSON item is produced per federal award. Download the dataset as JSON, CSV, Excel, or HTML, or consume it through the Apify API.

#### Field reference

| Field | Type | Description |
|-------|------|-------------|
| `awardId` | string | Public award identifier (PIID for contracts, FAIN/URI for assistance) |
| `generatedId` | string | USAspending generated unique award ID |
| `recipientName` | string | Legal name of the award recipient (contractor / grantee) |
| `recipientUei` | string | Unique Entity Identifier (UEI) of the recipient |
| `awardAmount` | number | Total obligated amount in USD |
| `awardType` | string | Award type description (e.g. DEFINITIVE CONTRACT, COOPERATIVE AGREEMENT) |
| `awardCategory` | string | USAspending award category (contract, grant, direct payment, loan, idv) |
| `startDate` | string | Period of performance start date |
| `endDate` | string | Period of performance current end date |
| `awardingAgency` | string | Top-tier awarding agency |
| `awardingSubAgency` | string | Sub-tier awarding agency / office |
| `fundingAgency` | string | Top-tier funding agency |
| `fundingSubAgency` | string | Sub-tier funding agency / office |
| `description` | string | Award description / purpose text |
| `naicsCode` | string | NAICS industry code (contracts only) |
| `naicsDescription` | string | NAICS industry description (contracts only) |
| `pscCode` | string | Product or Service Code (contracts only) |
| `cfdaNumber` | string | Assistance Listing (CFDA) number (grants and assistance only) |
| `cfdaTitle` | string | Assistance Listing (CFDA) program title (grants and assistance only) |
| `recipientCity` | string | Recipient city |
| `recipientState` | string | Recipient state name |
| `recipientCountry` | string | Recipient country |
| `url` | string | Award profile page on usaspending.gov |

#### Real sample output (latest live dataset)

```json
{
    "awardId": "DENA0003525",
    "generatedId": "CONT_AWD_DENA0003525_8900_-NONE-_-NONE-",
    "recipientName": "NATIONAL TECHNOLOGY & ENGINEERING SOLUTIONS OF SANDIA, LLC",
    "recipientUei": "LUJEPCRRT377",
    "awardAmount": 44093914875.26,
    "awardType": "DEFINITIVE CONTRACT",
    "awardCategory": "contract",
    "startDate": "2017-01-18",
    "endDate": "2027-04-30",
    "awardingAgency": "Department of Energy",
    "awardingSubAgency": "Department of Energy",
    "fundingAgency": "Department of Energy",
    "fundingSubAgency": "Department of Energy",
    "description": "IGF::CL,CT::IGF CONTRACT AWARD DE-NA0003525 TO THE NATIONAL TECHNOLOGY&ENGINEERING SOLUTIONS OF SANDIA, LLC (NTESS) FOR THE MANAGEMENT AND OPERATION OF THE DEPARTMENT OF ENERGY, NATIONAL NUCLEAR SECURITY ADMINISTRATION'S SANDIA NATIONAL LABORATORIES (SNL)",
    "naicsCode": "561210",
    "naicsDescription": "FACILITIES SUPPORT SERVICES",
    "pscCode": "M1JZ",
    "recipientCity": "ALBUQUERQUE",
    "recipientState": "NEW MEXICO",
    "recipientCountry": "UNITED STATES",
    "url": "https://www.usaspending.gov/award/CONT_AWD_DENA0003525_8900_-NONE-_-NONE-"
}
```

### Use with AI agents (MCP), n8n, Make, and Python

- **AI agents / MCP:** add `https://mcp.apify.com/?tools=evpp/usaspending` to your MCP client, then ask the agent to scrape USAspending data or export the latest dataset.
- **n8n / Make / Zapier:** run Actor `evpp/usaspending` with the quick-start input, then map dataset items into Google Sheets, a CRM, a webhook, or a monitoring workflow.
- **Python:** install the client with `pip install apify-client` and run:

```python
import json
from apify_client import ApifyClient

client = ApifyClient()
run_input = json.loads('''{"awardTypes":"contracts","agency":"Department of Defense","minAmount":1000000,"sortBy":"amount","includeDetails":true,"maxItems":10}''')
run = client.actor("evpp/usaspending").call(run_input=run_input)
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(items[0])
```

The same dataset is available as JSON, CSV, Excel, XML, RSS, and HTML through the Apify API.

### Cost

The Actor makes lightweight JSON calls only: about 1 search call plus 1 detail call per award. A 10-item run finishes in seconds on minimal memory (256 MB). At the pay-per-event price of **$3 per 1,000 results**, monitoring the top-100 awards of a competitor or agency every day costs cents per month.

### FAQ

**Is this official data?**
Yes. It calls the same public API (`api.usaspending.gov`) that powers usaspending.gov, the Treasury Department's official open-data source mandated by the DATA Act. No key, no login.

**Why did a contract signed in 2016 show up in my 2025 date window?**
The `time_period` filter matches awards whose period of performance overlaps the window, so large multi-year contracts that are still active (and still being funded) correctly appear.

**How do I track one contractor?**
Set `recipientSearch` to a distinctive part of the recipient's official name, e.g. `"LOCKHEED"` or `"LEIDOS"`, and optionally narrow with `agency` and `minAmount`.

**How do I get only big new contracts?**
Combine `awardTypes: "contracts"`, `minAmount: 10000000`, `sortBy: "date"` and a short `startDate`/`endDate` window.

**Why are `naicsCode` or `cfdaNumber` missing on some items?**
NAICS/PSC only exist on procurement contracts; CFDA only on assistance awards. Awards without a detail record keep their search fields. Empty fields are omitted from output.

**Does it need proxies?**
No. Defaults run direct against the public API. `proxyConfiguration` exists for users who want their own pool.

# Actor input Schema

## `recipientSearch` (type: `string`):

Filter awards by recipient (contractor / grantee) name, e.g. "LOCKHEED", "BOOZ ALLEN", "UNIVERSITY OF CALIFORNIA". Matches the official recipient name; leave empty for all recipients.

## `awardTypes` (type: `string`):

Which federal award family to search: procurement contracts (A/B/C/D), grants and cooperative agreements (02-05), or all award types including direct payments and loans.

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

Optional top-tier awarding agency name exactly as it appears on USAspending, e.g. "Department of Defense", "Department of Health and Human Services", "National Aeronautics and Space Administration". Leave empty for all agencies.

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

Start of the activity window (YYYY-MM-DD). USAspending returns awards whose period of performance / activity overlaps this range. Defaults to 90 days ago.

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

End of the activity window (YYYY-MM-DD). Defaults to today.

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

Only return awards with a total obligated amount at or above this value, e.g. 1000000 for $1M+ awards.

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

Order results by largest obligated amount or most recent start date (always descending).

## `includeDetails` (type: `boolean`):

Fetch the award detail endpoint for each result to add NAICS code/description (contracts), CFDA program (assistance), recipient UEI and recipient city/state/country. Adds ~1 request per item; recommended.

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

Maximum number of awards to output (1-500).

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

Optional proxies for outbound requests. The USAspending API is public and usually needs no proxy.

## Actor input object example

```json
{
  "recipientSearch": "",
  "awardTypes": "contracts",
  "agency": "",
  "sortBy": "amount",
  "includeDetails": true,
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all scraped federal award records

# 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 = {
    "recipientSearch": "",
    "agency": "",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("evpp/usaspending").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 = {
    "recipientSearch": "",
    "agency": "",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("evpp/usaspending").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 '{
  "recipientSearch": "",
  "agency": "",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call evpp/usaspending --silent --output-dataset

```

## MCP server setup

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

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/0j3JLx8XGbKYeMJhB/builds/bLWt9cjjtM4q0ACm3/openapi.json
