# US Federal Spending: Contracts & Grants Search (MCP) (`amygraphics/us-government-spending`) Actor

Official USAspending API for AI agents: search awarded US federal contracts and grants by keyword, recipient or agency with amounts and dates, and monitor topics for new awards alerts. No key. MCP-ready.

- **URL**: https://apify.com/amygraphics/us-government-spending.md
- **Developed by:** [Zakaria el bouami](https://apify.com/amygraphics) (community)
- **Categories:** Lead generation, Automation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.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

## US Federal Spending: Contracts & Grants Search (MCP)

The **official USAspending API** — every federal contract and grant awarded, with the dollar amounts. Search by keyword, recipient or agency; monitor topics or companies and get **`new-award` alerts as money moves**. No key. MCP-compatible, agent-ready.

### Why it's a top vertical

Government BD teams, suppliers, analysts, consultants and journalists live in this data: "who won this contract?", "how much did X get from DoD this year?", "when did grant money reach our city?". Existing tools are scraper UX without monitors — this actor is the official API, keyless, typed, with a daily alert mode.

### What you get per row

PIID/FAIN award ID, recipient, **award amount in USD**, awarding agency/sub-agency, funding agency, start/end dates, award description (cleaned), USAspending link to the official award page.

### Two modes

#### `search` — research awarded money

```json
{ "mode": "search", "term": "cloud services", "awardTypes": "contracts",
  "dateFrom": "2025-01-01", "maxResults": 10 }
```

Combine filters freely: `recipient: "LOCKHEED MARTIN"`, `agency: "Department of Defense"`, types (`contracts`, `grants`, `loans`, `direct_payments`, `other`, `all`).

#### `monitor` — money radar

```json
{ "mode": "monitor",
  "watchQueries": ["cybersecurity", "recipient:BOOZ ALLEN"] }
```

- **Run 1 = free baseline** — snapshots award IDs (60-day window).
- **Run 2+** emits only **`new-award`** rows for fresh awards since.
- Schedule daily; silence = **$0.001**.

### Recipes

1. **Competitive intelligence** — watch `recipient:Competitor` daily; first to know when they win federal money.
2. **BD hunting** — "cloud services" + FY2026 filters → target agencies by amount.
3. **Civic/press**: grant flows into a state or city, quotes with official record links.

### Data honesty

All rows from usaspending.gov at run time. Amounts are as published (may be estimated for some grants types); `internalId` + PIID kept for exact dedup.

### Pricing

| event | price |
|---|---|
| Actor start | $0.001 |
| US award | $0.001 / row |

Typical: 10-row search ≈ **$0.011** · daily monitor ≈ **$0.001–0.01**.

### MCP / AI-agent usage

```
https://api.apify.com/v2/acts/YOUR_HANDLE~us-government-spending/run-sync-get-dataset-items?token=YOUR_TOKEN
```

# Actor input Schema

## `mode` (type: `string`):

search = query awarded contracts/grants by keyword, recipient or agency · monitor = new-award alerts for topics/recipients.

## `term` (type: `string`):

(search) e.g. "cloud services", "solar", "cybersecurity".

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

(search) e.g. "LOCKHEED MARTIN", "BOOZ ALLEN".

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

(search) toptier agency name, e.g. "Department of Defense", "National Aeronautics and Space Administration".

## `awardTypes` (type: `string`):

contracts (default) | grants | loans | direct_payments | other | all — comma-separated combos allowed.

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

(search) ISO date e.g. 2025-10-01.

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

(search) ISO date.

## `watchQueries` (type: `array`):

(monitor) Keywords, or "recipient:NAME" to track a company, e.g. \["cloud services", "recipient:BOOZ ALLEN"]. New awards -> `new-award` alerts.

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

Cap rows per run (each billed row $0.001).

## `requestDelaySecs` (type: `number`):

Politeness delay across watch queries.

## Actor input object example

```json
{
  "mode": "search",
  "term": "",
  "recipient": "",
  "agency": "",
  "awardTypes": "contracts",
  "dateFrom": "",
  "dateTo": "",
  "watchQueries": [],
  "maxResults": 10,
  "requestDelaySecs": 0.3
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("amygraphics/us-government-spending").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("amygraphics/us-government-spending").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 amygraphics/us-government-spending --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,amygraphics/us-government-spending"
        }
    }
}
```

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/TecbNY17g6LUwJmR5/builds/2MeJeAy5t2CAYpQ2P/openapi.json
