# USAspending.gov Federal Contracts Scraper (`open-data-labs/usaspending-contracts-scraper`) Actor

Extract U.S. federal contract awards, IDVs, and grants from USAspending.gov API v2 with optional vendor UEI, solicitation, and subaward enrichment.

- **URL**: https://apify.com/open-data-labs/usaspending-contracts-scraper.md
- **Developed by:** [Leonardo Silveira](https://apify.com/open-data-labs) (community)
- **Categories:** Business, Lead generation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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.gov Federal Contracts & Grants Scraper

Extract structured U.S. federal contract awards, IDVs (Indefinite Delivery Vehicles), grants, and loans directly from the official **USAspending.gov REST API v2** — with optional vendor UEI, solicitation ID, set-aside, and subaward enrichment.

- **Zero API keys or proxies required** — runs directly on official U.S. government public-domain data.
- **Fast & low-cost** — pure HTTP JSON extraction (no headless browser overhead).
- **AI / MCP & Automation ready** — clean camelCase schema ready for MCP servers, n8n, Make, Clay, and Python pipelines.

### Use Cases

- **GovCon Competitive Intelligence**: Track which vendors are winning contracts in your NAICS or PSC codes and which agencies are buying.
- **B2B Lead Generation & Subcontracting**: Find prime contractors winning multi-million dollar awards (plus optional UEI, street address, and subaward totals) to pitch subcontracting services.
- **Market Sizing & Grant Monitoring**: Analyze federal spending trends by agency, state, keyword, and dollar range.

### Input Example

```json
{
  "awardTypes": ["contracts"],
  "keywords": ["cybersecurity"],
  "startDate": "2026-10-01",
  "endDate": "2026-11-17",
  "naicsCodes": ["541512"],
  "includeDetails": true,
  "maxResults": 100
}
```

### Output Example

```json
{
  "awardId": "W912HQ27C0002",
  "generatedInternalId": "CONT_AWD_W912HQ27C0002_9700_-NONE-_-NONE-",
  "awardType": "DEFINITIVE CONTRACT",
  "recipientName": "LEIDOS, INC.",
  "awardAmountUsd": 89878042.44,
  "awardingAgency": "Department of Defense",
  "awardingSubAgency": "Department of the Army",
  "startDate": "2026-10-15",
  "endDate": "2029-10-14",
  "naicsCode": "541512",
  "pscCode": "D399",
  "description": "TASK 3001 - DOD CYBER CRIME CENTER (DC3) INFRASTRUCTURE AND OPERATIONS SUPPORT SERVICES",
  "usaspendingUrl": "https://www.usaspending.gov/award/CONT_AWD_W912HQ27C0002_9700_-NONE-_-NONE-",
  "recipientUei": "QLM1N7J82N21",
  "solicitationId": "HQ003425R0030",
  "extentCompeted": "FULL AND OPEN COMPETITION",
  "setAsideType": "NO SET ASIDE USED."
}
```

### Pricing & Free Tier Limits

- **Pay-per-event (PPE)**: You pay only for extracted award records (`award-record`) and optional detail enrichment calls (`award-detail-enrichment`).
- **Free tier**: Runs on the Apify Free plan are capped at **50 items per run** with a graceful status message.

### Data Source & Attribution

Data is retrieved in real time from the official **USAspending.gov REST API v2** (U.S. Department of the Treasury, public domain under the DATA Act).

# Actor input Schema

## `awardTypes` (type: `array`):

Categories of federal spending awards to extract (contracts, idvs, grants, loans, direct_payments, other).

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

Optional keywords to search across award descriptions and metadata (e.g. cybersecurity, cloud, AI).

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

Filter awards starting on or after this date (YYYY-MM-DD). Defaults to 30 days ago if omitted.

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

Filter awards up to this date (YYYY-MM-DD). Defaults to today if omitted.

## `agencies` (type: `array`):

Filter by exact top-tier awarding agency name (e.g. 'Department of Defense', 'Department of Health and Human Services').

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

Filter by 2-to-6 digit NAICS industry codes (e.g. '541512', '541519').

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

Filter by Product/Service Codes (e.g. 'D399', 'R425').

## `recipientSearchText` (type: `array`):

Filter by recipient company name or UEI.

## `placeOfPerformanceStates` (type: `array`):

Two-letter US state/territory codes for place of performance (e.g. 'VA', 'CA', 'TX').

## `minAwardAmount` (type: `number`):

Minimum obligated award amount in USD.

## `maxAwardAmount` (type: `number`):

Maximum obligated award amount in USD.

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

Fetch per-award detail endpoint to include recipient UEI, parent company, street address, solicitation ID, competition type, set-aside, and subaward totals.

## `maxResults` (type: `integer`):

Maximum number of award records to extract (1-50,000). Free Apify plan runs are capped at 50 items.

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

Field used to sort search results.

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

Sort direction.

## Actor input object example

```json
{
  "awardTypes": [
    "contracts"
  ],
  "keywords": [],
  "agencies": [],
  "naicsCodes": [],
  "pscCodes": [],
  "recipientSearchText": [],
  "placeOfPerformanceStates": [],
  "includeDetails": false,
  "maxResults": 100,
  "sortBy": "Award Amount",
  "sortOrder": "desc"
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

# 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 = {
    "awardTypes": [
        "contracts"
    ],
    "keywords": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("open-data-labs/usaspending-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 = {
    "awardTypes": ["contracts"],
    "keywords": [],
}

# Run the Actor and wait for it to finish
run = client.actor("open-data-labs/usaspending-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 '{
  "awardTypes": [
    "contracts"
  ],
  "keywords": []
}' |
apify call open-data-labs/usaspending-contracts-scraper --silent --output-dataset

```

## MCP server setup

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