# USAspending Federal Spending Search (`ryanclinton/usaspending-search`) Actor

Search and extract US federal government spending data directly from the official USAspending.gov API. This actor provides structured access to over $2 trillion in annual federal spending across contracts, grants, loans, direct payments, and other financial assistance programs.

- **URL**: https://apify.com/ryanclinton/usaspending-search.md
- **Developed by:** [Ryan Clinton](https://apify.com/ryanclinton) (community)
- **Categories:** AI, Developer tools
- **Stats:** 6 total users, 1 monthly users, 97.8% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 record fetcheds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## USAspending Federal Spending Search

Search and extract US federal government spending data directly from the official USAspending.gov API. This actor provides structured access to over $2 trillion in annual federal spending across contracts, grants, loans, direct payments, and other financial assistance programs. Whether you are tracking defense procurement, monitoring grant allocations, or analyzing government spending trends, this actor delivers clean, normalized award data sorted by dollar value with direct links back to USAspending.gov.

---

### Why use USAspending Federal Spending Search?

The USAspending.gov website is the authoritative source for federal spending data, maintained by the US Department of the Treasury. But manually searching the site is slow, repetitive, and limited -- there is no built-in way to export structured data at scale, schedule recurring searches, or integrate results into automated workflows.

The underlying API is powerful but requires building POST request bodies with complex filter objects, handling page-based pagination, managing different field sets for different award types (loans use entirely different fields than contracts), and transforming nested response structures into usable formats. That is a significant engineering investment before you get a single row of data.

This actor handles all of that complexity. It builds the correct API request for your chosen award type, paginates through results automatically, normalizes loan and non-loan fields into a consistent output schema, constructs recipient location strings, and generates direct USAspending.gov URLs for every award. You get clean, flat JSON records ready for analysis, export, or integration -- without writing a single line of code.

Running on Apify's cloud infrastructure, you can schedule daily or weekly monitoring runs, push results to Google Sheets or Slack, trigger webhooks for downstream processing, and access data programmatically through the Apify API in JSON, CSV, or Excel format.

---

### Key features

- **Six award type categories** -- search contracts, grants, loans, direct payments, IDVs (Indefinite Delivery Vehicles), and other financial assistance independently, each with the correct API codes and field mappings.
- **Keyword search** -- filter awards by description keywords such as "cybersecurity," "renewable energy," "artificial intelligence," or any topic area.
- **Agency filtering** -- narrow results to a specific top-tier awarding agency like the Department of Defense, NASA, or the Department of Energy.
- **Recipient search** -- find all awards going to a specific contractor or organization by name (e.g., "Lockheed Martin," "Deloitte," "RAND Corporation").
- **Date range filtering** -- restrict results to a specific fiscal period using YYYY-MM-DD format, with data available back to fiscal year 2008 (2007-10-01).
- **Minimum amount threshold** -- filter out small awards by setting a dollar floor (e.g., only contracts above $1,000,000).
- **Automatic pagination** -- the actor handles multi-page API responses transparently, fetching up to 1,000 results across multiple requests with built-in rate limiting.
- **Consistent output schema** -- loans use different fields (Loan Value, Issued Date) than contracts and grants (Award Amount, Start/End Date), but the actor normalizes everything into a single consistent format.
- **Direct USAspending links** -- every output record includes a URL linking directly to the full award page on USAspending.gov for verification and further research.
- **No API key required** -- the USAspending API is free, open, and requires no registration or authentication tokens.

---

### How to use USAspending Federal Spending Search

1. Navigate to the [USAspending Federal Spending Search](https://apify.com/ryanclinton/usaspending-search) actor on the Apify Store.
2. Click **Try for free** to open the actor in Apify Console.
3. Enter an optional **keyword** to search across award descriptions (e.g., "cybersecurity," "renewable energy").
4. Select an **award type** -- contracts (default), grants, loans, direct payments, IDVs, or other financial assistance.
5. Optionally add filters for **agency**, **recipient name**, **date range**, or **minimum dollar amount**.
6. Set **max results** (default 25, maximum 1,000) and click **Start**.
7. Download results as JSON, CSV, or Excel from the Dataset tab, or connect via API.

#### Using the API

You can start the actor programmatically via the Apify API. See the [API & integration](#api--integration) section below for Python, JavaScript, and cURL examples.

---

### Input parameters

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `keyword` | String | No | -- | Search term matched against award descriptions (e.g., "artificial intelligence", "infrastructure", "wildfire suppression"). |
| `awardType` | String | No | `contracts` | Category of federal award. Options: `contracts`, `grants`, `loans`, `direct_payments`, `other`, `idvs`. |
| `agency` | String | No | -- | Top-tier awarding agency name (e.g., "Department of Defense", "Department of Energy", "National Aeronautics and Space Administration"). Must be the exact official name. |
| `recipient` | String | No | -- | Recipient or contractor name to search for (e.g., "Lockheed Martin", "Booz Allen Hamilton", "Johns Hopkins University"). |
| `dateRange` | String | No | -- | Date range in the format `YYYY-MM-DD to YYYY-MM-DD` (e.g., "2024-01-01 to 2024-12-31"). Earliest supported date is 2007-10-01. |
| `minAmount` | Number | No | -- | Minimum award amount in US dollars (e.g., 1000000 for awards of $1M or more). |
| `maxResults` | Integer | No | 25 | Maximum number of awards to return. Minimum 1, maximum 1,000. |

#### Input example

**Find large DoD cybersecurity contracts:**

```json
{
    "keyword": "cybersecurity",
    "awardType": "contracts",
    "agency": "Department of Defense",
    "minAmount": 1000000,
    "maxResults": 50
}
````

**Search NIH grants for a specific organization:**

```json
{
    "keyword": "cancer research",
    "awardType": "grants",
    "agency": "Department of Health and Human Services",
    "recipient": "Johns Hopkins",
    "maxResults": 100
}
```

**Federal loans issued in 2024:**

```json
{
    "awardType": "loans",
    "dateRange": "2024-01-01 to 2024-12-31",
    "minAmount": 5000000,
    "maxResults": 200
}
```

#### Input tips

- **Use specific keywords** -- broad terms like "technology" or "services" return millions of results. More specific phrases like "quantum computing" or "wildfire suppression" produce focused results.
- **Agency names must be exact** -- use the full official name such as "Department of Defense" rather than abbreviations like "DoD." Check USAspending.gov for correct names.
- **Award types cannot be mixed** -- the USAspending API requires searching one award type per request. Run the actor separately for contracts and grants if you need both.
- **Date ranges start at FY2008** -- the earliest available data begins on 2007-10-01 (fiscal year 2008).
- **Combine filters for precision** -- using keyword + agency + date range together produces the most targeted results.

***

### Output

Each award in the output dataset contains the following fields:

```json
{
    "awardId": "W911NF23C0045",
    "title": "CYBERSECURITY OPERATIONS AND DEFENSE SUPPORT SERVICES",
    "awardType": "Contract",
    "awardAmount": 48750000,
    "awardingAgency": "Department of Defense",
    "fundingAgency": "Department of the Army",
    "recipientName": "BOOZ ALLEN HAMILTON INC.",
    "recipientLocation": "McLean, VA",
    "startDate": "2023-03-15",
    "endDate": "2028-03-14",
    "description": "CYBERSECURITY OPERATIONS AND DEFENSE SUPPORT SERVICES FOR ARMY NETWORK ENTERPRISE TECHNOLOGY COMMAND",
    "usaspendingUrl": "https://www.usaspending.gov/award/CONT_AWD_W911NF23C0045_9700_-NONE-_-NONE-",
    "extractedAt": "2026-02-17T14:30:00.000Z"
}
```

#### Output field reference

| Field | Type | Description |
|-------|------|-------------|
| `awardId` | String | Official award identification number assigned by the contracting agency. |
| `title` | String | Short description of the award (truncated to 500 characters). |
| `awardType` | String | Human-readable award type label: Contract, Grant, Loan, Direct Payment, IDV, or Other Financial Assistance. |
| `awardAmount` | Number or null | Total award value in US dollars. For loans, this is the loan face value. Null if no amount is recorded. |
| `awardingAgency` | String | Name of the federal agency that made the award. |
| `fundingAgency` | String or null | Name of the agency providing the funding, if different from the awarding agency. |
| `recipientName` | String | Name of the company, organization, or individual receiving the award. |
| `recipientLocation` | String or null | City and state of the recipient (e.g., "McLean, VA"). Includes country name for non-US recipients. |
| `startDate` | String or null | Award start date (or issue date for loans) in YYYY-MM-DD format. |
| `endDate` | String or null | Award end date in YYYY-MM-DD format. Not available for loans. |
| `description` | String | Full description text of the award as reported in the system. |
| `usaspendingUrl` | String | Direct link to the award page on USAspending.gov for full details and documentation. |
| `extractedAt` | String | ISO 8601 timestamp of when the data was extracted by this actor. |

***

### Use cases

- **Government contracting research** -- identify which companies win the largest federal contracts in your industry and track spending trends by agency, keyword, or time period.
- **Grant opportunity analysis** -- discover which organizations receive federal grants in specific research areas to benchmark your own grant applications and identify potential collaborators.
- **Competitive intelligence** -- monitor what contracts your competitors are winning from federal agencies and at what dollar amounts, broken down by award type and time period.
- **Journalism and transparency** -- investigate how taxpayer money is allocated across agencies, programs, and geographic regions with structured, exportable data.
- **Policy analysis** -- track federal spending patterns by agency, award type, or time period to support policy research, legislative advocacy, and budget analysis.
- **Business development** -- identify federal agencies that are actively spending in your product or service area to target BD efforts and build a qualified pipeline.
- **Due diligence** -- verify a company's claimed government contracts and check the actual dollar values of their federal awards before making investment or partnership decisions.
- **Academic research** -- build datasets of federal spending for economics, political science, or public administration research projects with clean, structured data.
- **Loan portfolio analysis** -- search federal loan programs to understand which organizations receive government-backed financing and at what face values.
- **Spending alerts** -- schedule recurring runs to monitor new awards in a specific area and trigger notifications when large contracts or grants are issued.

***

### API & integration

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_API_TOKEN")

run = client.actor("ryanclinton/usaspending-search").call(run_input={
    "keyword": "cybersecurity",
    "awardType": "contracts",
    "agency": "Department of Defense",
    "minAmount": 1000000,
    "maxResults": 100,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"${item['awardAmount']:,.0f} -- {item['recipientName']} -- {item['title'][:80]}")
```

#### JavaScript

```javascript
import { ApifyClient } from "apify-client";

const client = new ApifyClient({ token: "YOUR_APIFY_API_TOKEN" });

const run = await client.actor("ryanclinton/usaspending-search").call({
    keyword: "cybersecurity",
    awardType: "contracts",
    agency: "Department of Defense",
    minAmount: 1000000,
    maxResults: 100,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const item of items) {
    console.log(`$${item.awardAmount?.toLocaleString()} -- ${item.recipientName} -- ${item.title.slice(0, 80)}`);
}
```

#### cURL

```bash
## Start the actor
curl -X POST "https://api.apify.com/v2/acts/ryanclinton~usaspending-search/runs?token=YOUR_APIFY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "keyword": "cybersecurity",
    "awardType": "contracts",
    "agency": "Department of Defense",
    "minAmount": 1000000,
    "maxResults": 100
  }'

## Retrieve results (use the defaultDatasetId from the run response)
curl "https://api.apify.com/v2/datasets/DATASET_ID/items?token=YOUR_APIFY_API_TOKEN&format=json"
```

#### Integrations

The output dataset can be consumed through any of Apify's built-in integrations:

- **Google Sheets** -- automatically export federal spending data to a spreadsheet for team review and analysis.
- **Slack / Email** -- receive notifications when new large awards are detected in scheduled runs.
- **Webhooks** -- push results to your CRM, BI platform, or custom data pipeline.
- **Zapier / Make** -- connect to thousands of apps for automated workflow triggers.
- **Amazon S3** -- archive results to cloud storage for long-term trend analysis.
- **API access** -- retrieve results programmatically in JSON, CSV, XML, or Excel format via the Apify dataset API.

***

### How it works

1. **Input parsing** -- the actor reads your search parameters and validates the award type against six supported categories (contracts, grants, loans, direct\_payments, other, idvs).

2. **Filter construction** -- a POST request body is built with the correct award type codes (e.g., contracts = A/B/C/D, grants = 02/03/04/05), along with keyword, agency, recipient, date range, and minimum amount filters.

3. **Field selection** -- the actor selects the appropriate field set based on award type. Loans use different fields (Loan Value, Subsidy Cost, Issued Date) than standard awards (Award Amount, Start Date, End Date).

4. **Paginated fetching** -- the actor sends POST requests to the USAspending API (`api.usaspending.gov/api/v2/search/spending_by_award/`), fetching up to 100 results per page. It continues paginating until the requested number of results is reached or no more results are available, with a 300ms delay between requests.

5. **Transformation** -- each raw API result is normalized into a consistent output schema. Loan fields are mapped to the same output fields as standard awards, recipient location is assembled from city/state/country components, and a direct USAspending.gov URL is constructed from the internal award ID.

6. **Output** -- clean JSON records are pushed to the Apify dataset one at a time. A summary log shows the total count, aggregate dollar amount, top awarding agencies, and top recipients.

```
Input (keyword, awardType, agency, recipient, dateRange, minAmount)
  |
  v
+---------------------------------------------+
| Filter Builder                              |
| - Award type codes (A/B/C/D for contracts)  |
| - Keywords, agency, recipient filters       |
| - Date range, minimum amount                |
+---------------------+-----------------------+
                      |
                      v
+---------------------------------------------+
| USAspending API (POST)                      |
| api.usaspending.gov/api/v2/search/          |
|   spending_by_award/                        |
| - 100 per page, sorted by amount desc      |
| - 300ms delay between pages                 |
| - Up to 10 pages (1,000 results max)        |
+---------------------+-----------------------+
                      |
                      v
+---------------------------------------------+
| Transform & Normalize                       |
| - Map loan fields to standard schema        |
| - Build recipient location string           |
| - Construct USAspending.gov award URL       |
| - Truncate title to 500 chars               |
+---------------------+-----------------------+
                      |
                      v
+---------------------------------------------+
| Output to Apify Dataset                     |
| - JSON records with 13 fields each          |
| - Summary: total amount, top agencies,      |
|   top recipients                            |
+---------------------------------------------+
```

***

### Performance & cost

USAspending Federal Spending Search is extremely cost-efficient. It runs with only 256 MB of memory and calls a free government API -- no web scraping or browser rendering involved.

| Scenario | Results | Pages | Estimated time | Estimated cost |
|----------|---------|-------|----------------|----------------|
| Quick lookup | 25 | 1 | ~5 sec | ~$0.001 |
| Standard search | 100 | 1 | ~8 sec | ~$0.002 |
| Deep scan | 500 | 5 | ~20 sec | ~$0.005 |
| Maximum extraction | 1,000 | 10 | ~40 sec | ~$0.01 |
| Daily monitoring (1 month) | 100/day | 1/day | ~8 sec/run | ~$0.06/month |

**Apify Free Tier:** New Apify accounts receive $5 of free platform credits each month. This is enough to run the actor hundreds of times per month at no cost.

**USAspending API:** The API is completely free with no API key, no registration, and no rate limits for reasonable usage.

***

### Limitations

- **One award type per run** -- the USAspending API requires searching one award type category per request. Run the actor separately for contracts, grants, and loans if you need multiple types.
- **1,000 result maximum** -- the actor caps at 1,000 results per run (100 per page, 10 pages). For larger datasets, narrow your search with date ranges, keywords, or agency filters and run multiple times.
- **Agency names must be exact** -- the agency filter requires the full official top-tier agency name (e.g., "Department of Defense," not "DoD" or "Pentagon"). Misspelled or abbreviated names will return no results.
- **Federal spending only** -- USAspending.gov tracks only federal government spending. State, local, and tribal government data is not available through this API.
- **Data update lag** -- USAspending.gov data is updated monthly by the Treasury Department. Recent awards may take 30-90 days to appear after they are obligated.
- **Loan end dates unavailable** -- the USAspending API does not return end dates for loan awards. The `endDate` field will always be null for loan searches.
- **No sub-award data** -- this actor searches prime awards only. Sub-award and sub-contract data is available through a different USAspending API endpoint not covered by this actor.

***

### Responsible use

- **Public data only** -- all data returned by this actor comes from publicly available federal spending records on USAspending.gov. No private or restricted information is accessed.
- **Respect API capacity** -- while the USAspending API has no formal rate limits, the actor includes a 300ms delay between page requests. Avoid scheduling excessively frequent runs that could burden the API.
- **Accuracy verification** -- while the actor normalizes and structures the data, always verify critical details on the official USAspending.gov website before making business, investment, or reporting decisions.
- **Intended purposes** -- this data is provided for research, journalism, business development, policy analysis, and transparency purposes. Use it responsibly and in compliance with applicable laws.
- **Recipient information** -- recipient names and locations are public record. Do not use this data for harassment, unsolicited marketing, or any purpose that violates recipient privacy expectations.

***

### FAQ

**Do I need a USAspending API key?**
No. The USAspending API is completely free and open to the public. No registration, API key, or authentication of any kind is required.

**How current is the data?**
USAspending.gov data is updated monthly by the Treasury Department. Recent awards may take 30-90 days to appear in the system after they are obligated by the awarding agency.

**Can I search for multiple award types at once?**
No. The USAspending API requires one award type category per request. Run the actor multiple times with different `awardType` values (e.g., once for contracts, once for grants) to cover multiple categories.

**What is an IDV?**
An IDV (Indefinite Delivery Vehicle) is a contract that does not specify a firm quantity of supplies or a fixed scope of work at the time of award. This includes GWAC contracts (Government-Wide Acquisition Contracts), Federal Supply Schedules (GSA Schedules), and blanket purchase agreements.

**Why are some award amounts null?**
Some awards, particularly those in early stages or certain assistance programs, may not have a dollar amount recorded in the system yet. The `awardAmount` field will be null in these cases.

**Can I search for state or local government spending?**
No. USAspending.gov tracks only federal government spending. For state-level data, you would need separate data sources such as individual state transparency portals.

**What date range is supported?**
The earliest available data begins on 2007-10-01 (the start of federal fiscal year 2008). You can search any date range from that point to the present using the format "YYYY-MM-DD to YYYY-MM-DD."

**How are results sorted?**
Results are always sorted by award amount in descending order (largest first). For loan searches, results are sorted by loan face value. This means setting a small `maxResults` value gives you the biggest awards immediately.

**What is the difference between awarding agency and funding agency?**
The awarding agency is the federal agency that issues and manages the contract or grant. The funding agency provides the money. These are often the same, but in some cases (such as interagency agreements), the funding comes from a different agency than the one managing the award.

**Can I get results in CSV or Excel format?**
Yes. After the actor completes, click "Export" on the dataset page and choose CSV, Excel, JSON, or XML. The Apify API also supports `format=csv` and `format=xlsx` query parameters for programmatic access.

**How do I find the correct agency name?**
Visit [USAspending.gov](https://www.usaspending.gov) and browse the Agency page to find the exact official name. Common examples include "Department of Defense," "Department of Health and Human Services," "National Aeronautics and Space Administration," and "Department of Energy."

**Is this the same data as on USAspending.gov?**
Yes. This actor queries the same official USAspending.gov API that powers the website. The data is identical -- the actor simply provides it in a structured, machine-readable format with automated search and export capabilities.

***

### Related actors

| Actor | Description | Link |
|-------|-------------|------|
| SAM.gov Contract Monitor | Search active federal contract opportunities and solicitations on SAM.gov | [View](https://apify.com/ryanclinton/sam-gov-contract-monitor) |
| Grants.gov Federal Grant Search | Search active federal grant opportunities across all agencies | [View](https://apify.com/ryanclinton/grants-gov-search) |
| Congress Bill Search | Search US congressional bills and legislation by keyword, sponsor, or status | [View](https://apify.com/ryanclinton/congress-bill-search) |
| FEC Campaign Finance Search | Search Federal Election Commission data for campaign contributions and political spending | [View](https://apify.com/ryanclinton/fec-campaign-finance) |
| Federal Register Search | Search proposed rules, final rules, and notices in the Federal Register | [View](https://apify.com/ryanclinton/federal-register-search) |
| Congressional Stock Trade Tracker | Track stock transactions reported by members of the US Congress | [View](https://apify.com/ryanclinton/congress-stock-tracker) |
| OFAC Sanctions Search | Screen entities against the US Treasury OFAC sanctions list | [View](https://apify.com/ryanclinton/ofac-sanctions-search) |
| SEC EDGAR Filing Analyzer | Search and analyze SEC financial filings and corporate disclosures | [View](https://apify.com/ryanclinton/sec-edgar-filing-analyzer) |
| CFPB Consumer Complaints | Search consumer complaints filed with the Consumer Financial Protection Bureau | [View](https://apify.com/ryanclinton/cfpb-consumer-complaints) |
| FDIC Bank Data Search | Search FDIC bank financial data and institution information | [View](https://apify.com/ryanclinton/fdic-bank-search) |

# Actor input Schema

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

Search keyword across award descriptions (e.g. 'cybersecurity', 'renewable energy', 'healthcare'). Leave empty to search by recipient/agency/date only.

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

Type of federal spending award to search. Awards from different groups cannot be mixed in one search.

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

Filter by awarding agency name (e.g. 'Department of Defense', 'Department of Energy')

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

Search by recipient/contractor name (e.g. 'Lockheed Martin', 'Deloitte')

## `dateRange` (type: `string`):

Filter by date range in format 'YYYY-MM-DD to YYYY-MM-DD' (e.g. '2024-01-01 to 2024-12-31'). Earliest supported: 2007-10-01.

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

Minimum award amount in dollars (e.g. 1000000 for $1M+)

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

Maximum number of awards to return (API returns up to 100 per page)

## Actor input object example

```json
{
  "keyword": "cybersecurity",
  "awardType": "contracts",
  "maxResults": 25
}
```

# Actor output Schema

## `results` (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 = {
    "keyword": "cybersecurity",
    "maxResults": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("ryanclinton/usaspending-search").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 = {
    "keyword": "cybersecurity",
    "maxResults": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("ryanclinton/usaspending-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keyword": "cybersecurity",
  "maxResults": 25
}' |
apify call ryanclinton/usaspending-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ryanclinton/usaspending-search",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "USAspending Federal Spending Search",
        "description": "Search and extract US federal government spending data directly from the official USAspending.gov API. This actor provides structured access to over $2 trillion in annual federal spending across contracts, grants, loans, direct payments, and other financial assistance programs.",
        "version": "1.0",
        "x-build-id": "u63adMsvqn0fRkLZz"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/ryanclinton~usaspending-search/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-ryanclinton-usaspending-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/ryanclinton~usaspending-search/runs": {
            "post": {
                "operationId": "runs-sync-ryanclinton-usaspending-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/ryanclinton~usaspending-search/run-sync": {
            "post": {
                "operationId": "run-sync-ryanclinton-usaspending-search",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "keyword": {
                        "title": "Search Keyword",
                        "type": "string",
                        "description": "Search keyword across award descriptions (e.g. 'cybersecurity', 'renewable energy', 'healthcare'). Leave empty to search by recipient/agency/date only."
                    },
                    "awardType": {
                        "title": "Award Type",
                        "enum": [
                            "contracts",
                            "grants",
                            "loans",
                            "direct_payments",
                            "other",
                            "idvs"
                        ],
                        "type": "string",
                        "description": "Type of federal spending award to search. Awards from different groups cannot be mixed in one search.",
                        "default": "contracts"
                    },
                    "agency": {
                        "title": "Awarding Agency",
                        "type": "string",
                        "description": "Filter by awarding agency name (e.g. 'Department of Defense', 'Department of Energy')"
                    },
                    "recipient": {
                        "title": "Recipient Name",
                        "type": "string",
                        "description": "Search by recipient/contractor name (e.g. 'Lockheed Martin', 'Deloitte')"
                    },
                    "dateRange": {
                        "title": "Date Range",
                        "type": "string",
                        "description": "Filter by date range in format 'YYYY-MM-DD to YYYY-MM-DD' (e.g. '2024-01-01 to 2024-12-31'). Earliest supported: 2007-10-01."
                    },
                    "minAmount": {
                        "title": "Minimum Award Amount",
                        "type": "number",
                        "description": "Minimum award amount in dollars (e.g. 1000000 for $1M+)"
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of awards to return (API returns up to 100 per page)",
                        "default": 25
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
