# USAspending.gov Awards, Recipients & Agency Scraper (`vexaloom-labs/usaspending-gov-awards-recipients-and-agency`) Actor

Query USAspending.gov's public federal spending data: search contracts, grants and loans by keyword, agency or date, rank top award recipients, or list agencies by budgetary resources.

- **URL**: https://apify.com/vexaloom-labs/usaspending-gov-awards-recipients-and-agency.md
- **Developed by:** [vexaloom-labs](https://apify.com/vexaloom-labs) (community)
- **Categories:** Automation, Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/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.gov Awards, Recipients & Agency Scraper

[USAspending.gov](https://www.usaspending.gov/) publishes the U.S. federal government's award and spending data. This actor reads its public API directly and turns it into clean JSON records: individual awards, sub-awards, recipient profiles, agency totals and grouped spending statistics.

No API key, account, cookie or proxy is needed.

### Modes

| Mode | What it returns |
|---|---|
| `searchAwards` | Prime awards or sub-awards matching keyword, agency, recipient, date, amount, industry, competition and location filters |
| `awardDetails` | Full record for one or more award IDs or usaspending.gov award URLs |
| `topRecipients` | Recipients ranked by total award amount for the chosen filters |
| `spendingByCategory` | Totals grouped by awarding/funding agency or sub-agency, recipient, NAICS, PSC, CFDA, state, county, district, country, federal account or disaster code |
| `spendingByGeography` | State, county, congressional-district or country totals for place of performance or recipient location |
| `spendingOverTime` | Fiscal-year, quarter, month or calendar-year obligation/outlay totals |
| `agencySpending` | Federal agencies ranked by budgetary resources, with optional mission/website enrichment |
| `recipientSearch` | Recipient profiles by name or UEI, including parent companies, business categories and lifetime transaction totals |

### Input

| Field | Applies to | Default | Notes |
|---|---|---|---|
| `mode` | all | `searchAwards` | One of the eight modes above |
| `searchQuery` | search, aggregates, recipient search | `construction` | Award keywords (3+ characters) or a recipient name/UEI |
| `awardTypeFamilies` | search, aggregates | `["contracts"]` | `contracts`, `grants`, `loans`, `idvs`, `direct_payments`, `other_financial_assistance`, or `all` |
| `awardTypes` | legacy tasks | – | Hidden legacy string; mapped to `awardTypeFamilies` |
| `awardIds` | `awardDetails` | – | Generated award IDs, numeric IDs, plain contract/assistance numbers, or award URLs |
| `agency` / `fundingAgency` | search, aggregates | – | Top-tier agency names |
| `recipient` | search, aggregates | – | Recipient name or UEI |
| `startDate`, `endDate` | search, aggregates | `2025-10-01`, `2026-09-30` | Date range; the API can search back to 2007-10-01 |
| `dateType` | search, aggregates | `action_date` | `action_date`, `date_signed` or `last_modified_date` |
| `awardAmountMin`, `awardAmountMax` | search, aggregates | – | Dollar range |
| `naicsCodes`, `pscCodes` | search, aggregates | – | Comma-separated classification codes |
| `setAsideTypes` | search, aggregates | – | Set-aside codes |
| `extentCompeted` | search, aggregates | – | Competition extent codes |
| `pricingTypes` | search, aggregates | – | Contract pricing codes |
| `recipientTypes` | search, aggregates | – | Recipient business-type keys |
| `placeOfPerformanceState`, `placeOfPerformanceCountry` | search, aggregates | – | Where the work is performed |
| `recipientState`, `recipientCountry` | search, aggregates | – | Where the recipient is located |
| `spendingLevel` | `searchAwards` | `awards` | `awards` or `subawards` |
| `category` | `spendingByCategory` | `recipient` | 14 grouping categories |
| `geoScope`, `geoLayer` | `spendingByGeography` | `placeOfPerformance`, `state` | 2 scopes × 4 layers |
| `timeGroup` | `spendingOverTime` | `fiscalYear` | Fiscal year, quarter, month or calendar year |
| `includeAwardDetails` | `searchAwards` | `false` | Enrich every hit with its full award record |
| `includeAgencyDetails` | `agencySpending` | `false` | Add mission, website and sub-agency count |
| `sortBy`, `sortOrder` | `searchAwards` | `awardAmount`, `desc` | Award amount, start/end date, award ID or recipient name |
| `maxItems` | all | `50` | 1–100,000 records; cursor pagination for deep result sets |
| `recipientIds` | `recipientSearch` | – | Direct recipient profile IDs (UUID hashes) |

#### Examples

```json
{
  "mode": "searchAwards",
  "searchQuery": "construction",
  "awardTypeFamilies": ["contracts"],
  "startDate": "2025-10-01",
  "endDate": "2026-09-30",
  "placeOfPerformanceState": "VA",
  "maxItems": 100
}
```

```json
{
  "mode": "awardDetails",
  "awardIds": ["https://www.usaspending.gov/award/CONT_AWD_NNM07AB03C_8000_-NONE-_-NONE-/"]
}
```

```json
{
  "mode": "spendingByCategory",
  "category": "naics",
  "awardTypeFamilies": ["contracts"],
  "startDate": "2025-10-01",
  "endDate": "2026-09-30",
  "maxItems": 25
}
```

```json
{
  "mode": "recipientSearch",
  "searchQuery": "Boeing",
  "maxItems": 10
}
```

### Output

Every record is flat camelCase JSON with empty values omitted. Common fields include `recordType`, `scrapedAt`, `awardId`, `awardCategory`, `recipientName`, `awardAmount` and `usaspendingUrl`.

**Award search records** add recipient UEI/DUNS, total outlays, description, start/end dates, awarding and funding agency names/codes/offices, NAICS and PSC with descriptions, CFDA number, set-aside and competition fields, and place-of-performance location fields.

**Award detail records** add the full award record: PIID/FAIN/URI, date signed, total obligation, account obligations/outlays, base and all options, loan/subsidy values, subaward count and amount, recipient business categories and parent recipient, full location objects, contract pricing and IDV details, and assistance listings.

**Subaward records** identify the prime award and prime recipient, and include the sub-awardee, amount, date, description, NAICS/PSC, sub-award type and location when the source publishes it.

**Recipient records** include recipient ID/UEI/DUNS, alternate names, business categories, parent recipient chain, location, lifetime transaction amounts/counts and loan totals.

**Aggregate records** (`topRecipients`, `spendingByCategory`, `spendingByGeography`, `spendingOverTime`, `agencySpending`) carry the grouping label and the amount/outlays or obligations, plus the relevant agency, recipient, geography or time-period fields.

### Data source and freshness

The actor calls the official public USAspending.gov API (`api.usaspending.gov/api/v2`). Federal award data is updated as agencies report it, usually within a few weeks of a transaction. The API can search award data from 2007-10-01 onward.

### Limits and notes

- A search result page is capped at 100 records; the actor uses cursor pagination, so large exports are not limited by the 50,000-row page window.
- Loan awards do not expose amount or start-date sorting in the search API; those runs fall back to Award ID sorting and say so in the run status.
- Sub-awards do not support some prime-award sort fields; the actor substitutes the closest sub-award field.
- A field the source genuinely lacks for an award is omitted rather than sent as `null`, `""` or a placeholder.
- `includeAwardDetails` adds one API request per award, so large enriched runs take longer.
- Contract and assistance numbers (`awardIds`) are resolved by exact Award ID lookup; generated award IDs and URLs are the most direct input.

### FAQ

**Do I need an API key?**
No. USAspending.gov's public data API is open.

**Is this an official government product?**
No. It is an independent tool that reads USAspending.gov's published data.

**Why do some awards lack a NAICS or PSC code?**
Those classifications apply to contracts and IDVs. Grants and other assistance awards normally publish a CFDA/assistance-listing number instead.

**Why is the award amount missing on some loan results?**
The search index does not always carry an amount for loan awards. The loan's total value and subsidy cost are available through `awardDetails`.

**Can I export more than 10,000 rows?**
Yes. Set `maxItems` up to 100,000; the actor follows the API's cursor instead of deep page numbers.

**Can I combine award types?**
Yes. Multi-family searches are fetched separately and merged into one sorted stream. Codes from different families are never sent in the same API request because the API rejects that.

# Actor input Schema

## `mode` (type: `string`):

What to collect. Each mode uses a different USAspending.gov endpoint and returns its own record type.

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

Words from the award description (minimum 3 characters). Used by searchAwards, topRecipients, spendingByCategory, spendingByGeography and spendingOverTime; recipientSearch uses it as the recipient name/UEI query.

## `awardTypeFamilies` (type: `array`):

One or more award type families. Empty or omitted keeps the original contracts default. Multi-family searches are merged into one sorted result stream.

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

Legacy alias kept for saved tasks; map to awardTypeFamilies. Hidden in the input form.

## `awardIds` (type: `array`):

Award IDs (for example `CONT_AWD_...`), numeric award IDs, or `https://www.usaspending.gov/award/...` URLs. Plain contract/assistance numbers are resolved by exact match.

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

Top-tier awarding agency name, for example `Department of Defense` or `Department of Education`.

## `fundingAgency` (type: `string`):

Top-tier funding agency name. Use alongside or instead of the awarding agency.

## `recipient` (type: `string`):

Filter awards to a recipient by name or Unique Entity Identifier (UEI).

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

Earliest award date, `YYYY-MM-DD`. The API can search back to 2007-10-01. Used with dateType.

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

Latest award date, `YYYY-MM-DD`. Used with dateType.

## `dateType` (type: `string`):

Which date the range applies to: action date (default), date signed, or last modified date.

## `awardAmountMin` (type: `number`):

Only awards at or above this dollar amount.

## `awardAmountMax` (type: `number`):

Only awards at or below this dollar amount.

## `naicsCodes` (type: `string`):

Comma-separated NAICS industry codes, for example `541330, 541512`.

## `pscCodes` (type: `string`):

Comma-separated Product Service Codes, for example `R425, D399`.

## `setAsideTypes` (type: `array`):

Contract set-aside types. Empty = any set-aside status.

## `extentCompeted` (type: `array`):

Contract competition extent. Empty = any competition status.

## `pricingTypes` (type: `array`):

Contract pricing arrangement. Empty = any pricing type.

## `recipientTypes` (type: `array`):

Recipient business categories such as small business, nonprofit, government or higher education.

## `placeOfPerformanceState` (type: `string`):

Two-letter state or territory code where the work is performed. Leave blank for all states.

## `placeOfPerformanceCountry` (type: `string`):

Three-letter country code, for example `USA`. Defaults to USA when a state is selected.

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

Two-letter state or territory code of the recipient's location.

## `recipientCountry` (type: `string`):

Three-letter country code of the recipient's location, for example `USA`.

## `spendingLevel` (type: `string`):

Prime awards or sub-awards.

## `category` (type: `string`):

How to group spending totals.

## `geoScope` (type: `string`):

Use the place of performance or the recipient's location.

## `geoLayer` (type: `string`):

Geographic grouping for the totals.

## `timeGroup` (type: `string`):

Time bucket for the spending totals.

## `includeAwardDetails` (type: `boolean`):

Fetch the full award record for every search result. Adds one request per award and fills recipient business types, parent recipient, subaward counts and contract competition fields.

## `includeAgencyDetails` (type: `boolean`):

Fetch each agency's mission, website and sub-agency count. Adds one request per agency.

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

Sort order for award search results. Loans fall back to Award ID when sorting by amount or date.

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

Ascending or descending.

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

Maximum records to return (1-100,000). Larger runs use the API's cursor pagination.

## `recipientIds` (type: `array`):

Optional recipient profile IDs (UUID hashes). When set, profiles are fetched directly and searchQuery is ignored.

## Actor input object example

```json
{
  "mode": "searchAwards",
  "searchQuery": "construction",
  "awardTypeFamilies": [
    "contracts"
  ],
  "awardIds": [],
  "startDate": "2025-10-01",
  "endDate": "2026-09-30",
  "dateType": "action_date",
  "spendingLevel": "awards",
  "category": "recipient",
  "geoScope": "placeOfPerformance",
  "geoLayer": "state",
  "timeGroup": "fiscalYear",
  "includeAwardDetails": false,
  "includeAgencyDetails": false,
  "sortBy": "awardAmount",
  "sortOrder": "desc",
  "maxItems": 3,
  "recipientIds": []
}
```

# Actor output Schema

## `spendingData` (type: `string`):

Dataset containing all scraped USAspending.gov 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 = {
    "mode": "searchAwards",
    "searchQuery": "construction",
    "awardTypeFamilies": [
        "contracts"
    ],
    "awardIds": [],
    "startDate": "2025-10-01",
    "endDate": "2026-09-30",
    "dateType": "action_date",
    "spendingLevel": "awards",
    "category": "recipient",
    "geoScope": "placeOfPerformance",
    "geoLayer": "state",
    "timeGroup": "fiscalYear",
    "includeAwardDetails": false,
    "includeAgencyDetails": false,
    "sortBy": "awardAmount",
    "sortOrder": "desc",
    "maxItems": 3,
    "recipientIds": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("vexaloom-labs/usaspending-gov-awards-recipients-and-agency").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 = {
    "mode": "searchAwards",
    "searchQuery": "construction",
    "awardTypeFamilies": ["contracts"],
    "awardIds": [],
    "startDate": "2025-10-01",
    "endDate": "2026-09-30",
    "dateType": "action_date",
    "spendingLevel": "awards",
    "category": "recipient",
    "geoScope": "placeOfPerformance",
    "geoLayer": "state",
    "timeGroup": "fiscalYear",
    "includeAwardDetails": False,
    "includeAgencyDetails": False,
    "sortBy": "awardAmount",
    "sortOrder": "desc",
    "maxItems": 3,
    "recipientIds": [],
}

# Run the Actor and wait for it to finish
run = client.actor("vexaloom-labs/usaspending-gov-awards-recipients-and-agency").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 '{
  "mode": "searchAwards",
  "searchQuery": "construction",
  "awardTypeFamilies": [
    "contracts"
  ],
  "awardIds": [],
  "startDate": "2025-10-01",
  "endDate": "2026-09-30",
  "dateType": "action_date",
  "spendingLevel": "awards",
  "category": "recipient",
  "geoScope": "placeOfPerformance",
  "geoLayer": "state",
  "timeGroup": "fiscalYear",
  "includeAwardDetails": false,
  "includeAgencyDetails": false,
  "sortBy": "awardAmount",
  "sortOrder": "desc",
  "maxItems": 3,
  "recipientIds": []
}' |
apify call vexaloom-labs/usaspending-gov-awards-recipients-and-agency --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vexaloom-labs/usaspending-gov-awards-recipients-and-agency"
        }
    }
}
```

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/sQfV2vfvBSQBjfBBi/builds/YIhRQRy6tDI3IxOQy/openapi.json
