# USAspending Scraper: Federal Contracts, Grants & Awards (`api-co/usaspending-federal-contracts`) Actor

Search U.S. federal contracts, grants, IDVs and other federal awards from the official USAspending.gov API: government spending by keyword, agency, recipient, NAICS, PSC, state and amount. Find recompete leads with contracts expiring soon. No API key.

- **URL**: https://apify.com/api-co/usaspending-federal-contracts.md
- **Developed by:** [Emilio Cisneros](https://apify.com/api-co) (community)
- **Categories:** Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 awards

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?

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, Grants & Awards

Search **U.S. federal contracts, IDVs, grants, loans and direct payments** from **USAspending.gov**, the official source of federal spending data, and export clean rows to JSON, CSV or Excel. No API key, no login, no proxies.

### How to use

1. Add at least one filter: keywords, agency, recipient, NAICS/PSC code, state, date range or minimum amount.
2. For recompete leads, set *Expiring within days* (e.g. 180). Turn on *Include award details* for competition data (number of offers, set-aside).
3. Click **Start** and export the awards to CSV/Excel or your CRM.

### What you can do

- **Find contracts by keyword, agency, sub-agency, recipient (name or UEI), NAICS, PSC, set-aside, state, amount and date.**
- **Find recompete leads**: contracts *expiring within N days* (e.g. 180), so BD teams can line up bids before the solicitation drops.
- **Research competitors**: every award to a contractor, with amounts, agencies and periods of performance.
- **Optional award details**: extent competed, **number of offers received**, set-aside type, contract pricing type, solicitation ID, parent IDV, the recipient's **parent company**, location, subaward totals, and the NAICS/PSC hierarchy.
- Covers grants and other assistance too, with assistance listings (CFDA).

### Why this Actor

| | This Actor | Typical SAM.gov / USAspending scrapers |
|---|---|---|
| Source | Official USAspending API (no key) | Often SAM.gov HTML or a key you must request |
| Recompete / expiring filter | **Yes** | Rarely |
| Competition data (offers, set-aside) | **Yes** (optional) | No |
| Contracts + IDVs + grants in one run | **Yes** | Usually one type |
| Price | **$1.50 / 1,000 awards** | $2 to $3 / 1,000 |

### Input examples

**Cybersecurity contracts over $1M in FY2026**

```json
{ "keywords": ["cybersecurity"], "dateFrom": "2025-10-01", "dateTo": "2026-09-30", "minAmount": 1000000 }
```

**DHS IT contracts expiring within 180 days (recompete pipeline)**

```json
{ "agencies": ["Department of Homeland Security"], "naicsCodes": ["541512", "541519"], "expiringWithinDays": 180, "includeDetails": true }
```

**Everything awarded to a competitor since 2024**

```json
{ "recipients": ["Booz Allen Hamilton"], "awardTypes": ["contracts", "idvs"], "dateFrom": "2024-01-01", "maxItems": 2000 }
```

**Broadband grants**

```json
{ "keywords": ["broadband"], "awardTypes": ["grants"] }
```

### Output (one row per award)

```json
{ "awardId": "FA862118F6251", "awardCategory": "Contract", "awardType": "DELIVERY ORDER", "recipientName": "LOCKHEED MARTIN CORPORATION", "recipientUei": "KDT2YLB34NT6",
  "awardAmount": 666315748.84, "startDate": "2018-02-08", "endDate": "2027-01-31", "daysUntilEnd": 105, "awardingAgency": "Department of Defense",
  "awardingSubAgency": "Department of the Air Force", "naicsCode": "336413", "pscCode": "J069", "popState": "FL", "description": "...",
  "usaspendingUrl": "https://www.usaspending.gov/award/CONT_AWD_...", "extentCompeted": "FULL AND OPEN COMPETITION", "numberOfOffers": 4, "setAside": null, "pricingType": "FIRM FIXED PRICE", "recipientParentName": "LOCKHEED MARTIN CORP" }
```

### Pricing (pay per event)

- **$0.0015 per award** ($1.50 per 1,000).
- **$0.001 per award with details**, only when *Include award details* is on.
- Error records and scanned-but-filtered awards are free. Set a max cost per run and the Actor stops at your limit.

### How much does it cost?

You only pay for results, never for compute time:

| You get | You pay (Starter/Bronze plan price) |
|---|---|
| 100 awards | $0.15 |
| 1,000 awards | $1.50 |
| 10,000 awards | $15.00 |

Apify's **free plan includes $5 of usage every month**, and free-plan users pay **half price** on this Actor, so that covers about **6,666 awards** at no cost. Paid plans get volume discounts (Silver -10%, Gold -20%). Set a *maximum cost per run* and the Actor stops cleanly at your limit.

### Notes

- The data is public U.S. government data. We omit executive-compensation names on purpose.
- USAspending search supports action dates from **2007-10-01**.
- Use exact agency names as shown on usaspending.gov (e.g. "Department of Veterans Affairs").

### Use cases

- **Government contractors (BD/capture teams)**: find recompete opportunities and see who holds the current contract.
- **Competitive intelligence**: list every award a competitor has won, by agency and NAICS.
- **Market sizing**: total federal spend by keyword, agency, NAICS or state.
- **Journalism and research**: follow the money on grants and contracts.

### Run it from code (API, Python, JavaScript)

```bash
curl -X POST "https://api.apify.com/v2/acts/api-co~usaspending-federal-contracts/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" -d '{"keywords": ["cybersecurity"], "minAmount": 1000000, "maxItems": 20}'
```

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("api-co/usaspending-federal-contracts").call(run_input={"keywords": ["cybersecurity"], "minAmount": 1000000, "maxItems": 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

```javascript
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('api-co/usaspending-federal-contracts').call({"keywords": ["cybersecurity"], "minAmount": 1000000, "maxItems": 20});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

It also works from **AI agents through the Apify MCP server**, and with Zapier, Make, n8n, Google Sheets and webhooks. You can schedule it in the Apify Console.

### FAQ

**Do I need a SAM.gov or USAspending API key?**
No. The Actor uses the public USAspending.gov API, which needs no key or login.

**How fresh is the data?**
USAspending is updated daily from FPDS and agency submissions. Contract actions usually appear within a few days.

**Can I find contracts that are about to expire?**
Yes. Set *Expiring within days* (for example 180) to build a recompete pipeline.

**Does it include grants?**
Yes. Choose grants, loans, direct payments or IDVs in *Award types*.

# Actor input Schema

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

Words or phrases to match in award descriptions, recipient names and IDs (min 3 characters each), e.g. cybersecurity, 'cloud migration'.

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

Which award categories to search.

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

Only awards with activity on/after this date (YYYY-MM-DD, earliest 2007-10-01).

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

Only awards with activity on/before this date (YYYY-MM-DD).

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

Which date the range applies to.

## `expiringWithinDays` (type: `integer`):

Only awards whose period of performance ends between today and N days from now. Great for finding contracts coming up for recompete.

## `endDateFrom` (type: `string`):

Only awards ending on/after this date (YYYY-MM-DD). Ignored if 'Expiring within N days' is set.

## `endDateTo` (type: `string`):

Only awards ending on/before this date (YYYY-MM-DD). Ignored if 'Expiring within N days' is set.

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

Only awards worth at least this much.

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

Only awards worth at most this much.

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

Top-tier agency names exactly as on USAspending, e.g. 'Department of Defense', 'Department of Homeland Security', 'General Services Administration'.

## `subAgencies` (type: `array`):

Sub-tier agency names, e.g. 'Department of the Air Force', 'Federal Emergency Management Agency'.

## `recipients` (type: `array`):

Recipient (contractor) names or UEIs, e.g. 'Booz Allen Hamilton' or a 12-character UEI.

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

Industry codes (2-6 digits), e.g. 541512 (Computer Systems Design Services).

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

Product/Service codes, e.g. DA01 or R425.

## `setAsideCodes` (type: `array`):

Contract set-aside codes, e.g. SBA (small business), 8A, SDVOSBC, WOSB, HZC.

## `assistanceListings` (type: `array`):

For grants/assistance, e.g. 11.035.

## `states` (type: `array`):

Two-letter US state codes, e.g. VA, MD, CA.

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

Result order (ignored when an end-date window is set; those are scanned latest end date first).

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

Descending or ascending.

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

Add competition (extent competed, number of offers), set-aside, pricing type, solicitation ID, parent IDV, recipient parent company & location, subaward totals, NAICS/PSC hierarchy. Charged as one extra 'award details' event per award.

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

Stop after this many awards. You are only charged per award returned.

## `maxScan` (type: `integer`):

Safety cap on awards read from the API per award type when post-filtering by end date (free; only returned awards are charged).

## Actor input object example

```json
{
  "keywords": [
    "cybersecurity"
  ],
  "awardTypes": [
    "contracts"
  ],
  "dateType": "action_date",
  "sortBy": "amount",
  "sortOrder": "desc",
  "includeDetails": false,
  "maxItems": 20,
  "maxScan": 20000
}
```

# Actor output Schema

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

One item per federal award (contract, IDV, grant...) with optional competition details.

# 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 = {
    "keywords": [
        "cybersecurity"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-co/usaspending-federal-contracts").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 = {
    "keywords": ["cybersecurity"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("api-co/usaspending-federal-contracts").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 '{
  "keywords": [
    "cybersecurity"
  ],
  "maxItems": 20
}' |
apify call api-co/usaspending-federal-contracts --silent --output-dataset

```

## MCP server setup

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

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/gJvdrKixNc4GCHpLJ/builds/izufYJjzLMIzssn59/openapi.json
