# USASpending Scraper - Federal Contract & Grant Data (`lulzasaur/usaspending-scraper`) Actor

Scrape federal spending data from USASpending.gov. Search contracts, grants, loans and direct payments by keyword, agency, recipient and fiscal year. No auth needed.

- **URL**: https://apify.com/lulzasaur/usaspending-scraper.md
- **Developed by:** [lulz bot](https://apify.com/lulzasaur) (community)
- **Categories:** E-commerce
- **Features:** Limited permissions
- **Stats:** 4 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.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 Contract & Grant Data

Scrape federal spending data from [USASpending.gov](https://www.usaspending.gov/) using the official open API. Search contracts, grants, loans, and direct payments by keyword, agency, recipient, fiscal year, and award amount.

### What data can you get?

USASpending.gov tracks **all federal spending** going back to 2007 -- over 5 million awards per year. This scraper lets you extract:

- **Contracts** (types A, B, C, D) -- government procurement
- **Grants** (types 02-05) -- financial assistance
- **Loans** (types 07-08) -- federal lending
- **Direct Payments** (types 06, 10) -- benefit payments, subsidies

### Output Fields

| Field | Description |
|-------|-------------|
| `awardId` | Official award/contract ID |
| `recipientName` | Company or organization receiving the award |
| `awardAmount` | Total award value in USD |
| `awardingAgency` | Top-level awarding agency (e.g. Department of Defense) |
| `awardingSubAgency` | Sub-agency (e.g. Army, Navy) |
| `awardType` | Human-readable type (Contract, Grant, etc.) |
| `description` | Award description text |
| `startDate` | Award start date |
| `endDate` | Award end date |
| `recipientId` | USASpending recipient ID |
| `internalId` | USASpending internal ID |
| `usaspendingUrl` | Direct link to award page on USASpending.gov |
| `fiscalYear` | Federal fiscal year |
| `scrapedAt` | ISO timestamp of when data was scraped |

### Input Options

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `awardType` | select | contracts | Award type: contracts, grants, loans, direct_payments, all |
| `keyword` | text | | Search keyword (e.g. "cybersecurity", "COVID", "construction") |
| `agency` | text | | Filter by awarding agency name (e.g. "Department of Defense") |
| `recipientName` | text | | Filter by recipient name (e.g. "Lockheed Martin") |
| `fiscalYear` | integer | current FY | Federal fiscal year (FY2024 = Oct 2023 - Sep 2024) |
| `minAmount` | number | | Minimum award amount in USD |
| `maxAmount` | number | | Maximum award amount in USD |
| `maxResults` | integer | 500 | Max results to return (up to 50,000) |
| `proxyConfiguration` | object | | Optional proxy configuration |

### Use Cases

- **Government contract research**: Find who wins the biggest federal contracts
- **Grant tracking**: Monitor grants by agency, keyword, or recipient
- **Competitive intelligence**: See which companies win contracts in your sector
- **Lobbying research**: Track spending patterns by agency and contractor
- **Journalism**: Investigate federal spending trends and outliers
- **Business development**: Identify agencies spending in your area of expertise

### Example Output

```json
{
  "awardId": "W911NF-24-C-0001",
  "recipientName": "LOCKHEED MARTIN CORPORATION",
  "awardAmount": 145000000,
  "awardingAgency": "Department of Defense",
  "awardingSubAgency": "Department of the Army",
  "awardType": "Definitive Contract",
  "description": "Advanced research and development for defense systems",
  "startDate": "2024-01-15",
  "endDate": "2026-12-31",
  "usaspendingUrl": "https://www.usaspending.gov/award/CONT_AWD_...",
  "fiscalYear": 2024,
  "scrapedAt": "2026-04-25T12:00:00.000Z"
}
```

### Notes

- **No authentication required** -- USASpending.gov is open government data
- Federal fiscal year runs October 1 to September 30 (FY2024 = Oct 2023 - Sep 2024)
- Results are sorted by award amount (largest first) by default
- The API has millions of records. Use filters to narrow results and set `maxResults` appropriately
- 500ms delay between pages to be respectful to the API

### Data Source

All data comes from the [USASpending.gov API](https://api.usaspending.gov/), maintained by the U.S. Department of the Treasury. The data is updated daily and includes all federal awards reported under the DATA Act.

***

### Run on Apify

This scraper runs on the [Apify platform](https://apify.com/?fpr=lulzasaur) -- a full-stack web scraping and automation cloud. Sign up for a free account to get started with 30-day trial of all features.

[Try Apify free](https://apify.com/?fpr=lulzasaur)

# Actor input Schema

## `awardType` (type: `string`):

Type of federal award to search for.

## `keyword` (type: `string`):

Search keyword to filter awards (e.g. 'cybersecurity', 'construction', 'COVID'). Leave empty for all.

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

Filter by awarding agency name (e.g. 'Department of Defense', 'NASA'). Leave empty for all agencies.

## `recipientName` (type: `string`):

Filter by recipient/contractor name (e.g. 'Lockheed Martin', 'Deloitte'). Leave empty for all recipients.

## `fiscalYear` (type: `integer`):

Federal fiscal year (e.g. 2024 = Oct 2023 - Sep 2024). Leave empty for current FY.

## `minAmount` (type: `number`):

Minimum award amount in USD. Leave empty for no minimum.

## `maxAmount` (type: `number`):

Maximum award amount in USD. Leave empty for no maximum.

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

Maximum number of results to return (up to 50,000).

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

Optional proxy to use for requests.

## Actor input object example

```json
{
  "awardType": "contracts",
  "maxResults": 500
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("lulzasaur/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 = {}

# Run the Actor and wait for it to finish
run = client.actor("lulzasaur/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 '{}' |
apify call lulzasaur/usaspending-scraper --silent --output-dataset

```

## MCP server setup

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