# USAspending Scraper — Federal Contracts & Grants (`datadeltas/usaspending-scraper`) Actor

Search every US federal contract, grant, loan and IDV on USAspending.gov by keyword, agency, recipient, state, amount or date — with contract duration and the recompete window worked out for you.

- **URL**: https://apify.com/datadeltas/usaspending-scraper.md
- **Developed by:** [Daniel Matthee](https://apify.com/datadeltas) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.80 / 1,000 award scrapeds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Scraper — Federal Contracts & Grants

Every US federal contract, grant, loan and IDV on USAspending.gov, searchable
by keyword, agency, recipient, state, amount or date — with **contract
duration and the recompete window already worked out**.

**No API key. No account.** US federal spending data is public domain, read
through the Treasury's own documented API.

### Why this one

Most USAspending tools hand back the API's raw columns. The two fields a
govcon seller actually sorts on aren't in the API at all:

- **`daysUntilEnd`** — how long before this award's period of performance ends
- **`expiringWithin180Days`** — the recompete window, ready to filter on

Set `expiringSoonOnly` with an agency filter and you have a list of incumbent
contracts about to come up for renewal, largest first.

### Example output record

```json
{
  "awardId": "19AQMM20F1777",
  "recipientName": "PERATON INC.",
  "awardAmount": 338694143.24,
  "awardingAgency": "Department of State",
  "awardingSubAgency": "Department of State",
  "startDate": "2020-07-10",
  "endDate": "2027-06-03",
  "durationDays": 2519,
  "daysUntilEnd": 273,
  "expiringWithin180Days": false,
  "description": "CYBER SECURITY SUPPORT SERVICES",
  "placeOfPerformanceState": "VA",
  "recipientState": "VA",
  "url": "https://www.usaspending.gov/award/CONT_AWD_19AQMM20F1777"
}
```

### Input options

| Option | Default | What it does |
|---|---|---|
| `keywords` | — | Free-text across descriptions, recipients and identifiers |
| `awardTypes` | `contracts` | `contracts`, `idvs`, `grants`, `direct_payments`, `loans`, `other` |
| `agencies` | — | Top-tier agency names, e.g. `Department of Defense` |
| `recipients` | — | Recipient name or identifier, e.g. `Peraton` |
| `recipientStates` | — | Two-letter state codes for the recipient's location |
| `awardedFrom` / `awardedTo` | — | Award action date range |
| `minAmount` / `maxAmount` | — | Award value bounds in USD |
| `expiringSoonOnly` | `false` | Only awards ending within 180 days |
| `sort` / `order` | Amount, desc | Sort before paging |
| `maxItems` | `500` | Hard cap per run |

### Use cases

- **Recompete pipeline.** `agencies` + `expiringSoonOnly` gives every incumbent
  contract at your target agency coming up for renewal. Search terms:
  *federal contract data*, *govcon leads*.
- **Competitor tracking.** Put a rival in `recipients` and watch what they win,
  from which agency, for how long. Search terms: *usaspending api*,
  *government contract awards*.
- **Grant prospecting.** Switch `awardTypes` to `grants` and filter by state to
  see who funds work like yours. Search terms: *federal grants data*.

### Honest limits

- **Award search cannot go earlier than 2007-10-01.** That is the API's own
  floor, reported in its response messages; earlier data exists only through
  the bulk download endpoints. An open-ended date range is anchored there
  rather than silently dropping the filter.
- **Award types are not freely mixable.** Contracts and assistance awards
  carry different columns, so a run takes one coherent set — this actor uses
  the field set the API accepts for every group.
- Amounts are the award's current total value, not outlays to date.
- `Description` is as filed by the agency, which means it is sometimes an
  acronym soup. That is the source data, not a parsing failure.

### Pricing

Pay per event: **$0.004 per award returned**. A 500-award sweep is $2. Runs
that match nothing cost nothing beyond the platform's start fee.

### Changelog

- **0.1** — first release: keyword, agency, recipient, state, amount, date and
  award-type filters; duration and recompete-window derivation; direct
  USAspending.gov links per award.

# Actor input Schema

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

Free-text search across award descriptions, recipients and identifiers. Leave empty to take everything matching the other filters.

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

Which kind of federal spending to return. Contracts by default.

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

Top-tier agency names exactly as USAspending writes them, e.g. 'Department of Defense', 'General Services Administration'.

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

Match recipient names or identifiers, e.g. 'Peraton' or a UEI.

## `recipientStates` (type: `array`):

Two-letter US state codes for the recipient's location, e.g. VA, MD.

## `awardedFrom` (type: `string`):

Earliest award action date, YYYY-MM-DD.

## `awardedTo` (type: `string`):

Latest award action date, YYYY-MM-DD.

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

Skip awards below this value.

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

Skip awards above this value.

## `expiringSoonOnly` (type: `boolean`):

Keep only awards whose period of performance ends in the next six months - the recompete window.

## `sort` (type: `string`):

Which column to sort by before paging. Largest awards first is the default.

## `order` (type: `string`):

Sort direction.

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

Hard cap on awards returned in one run.

## Actor input object example

```json
{
  "keywords": [
    "cyber security"
  ],
  "awardTypes": [
    "contracts"
  ],
  "expiringSoonOnly": false,
  "sort": "Award Amount",
  "order": "desc",
  "maxItems": 500
}
```

# Actor output Schema

## `records` (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 = {
    "keywords": [
        "cyber security"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("datadeltas/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 = { "keywords": ["cyber security"] }

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

```

## MCP server setup

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