# US Federal Contracts & Grants API (USASpending & Grants.gov) (`francogb/us-federal-contracts-grants-api`) Actor

Fast, browserless HTTP API combining awarded US federal contracts and grants (USASpending.gov v2) with live Grants.gov funding opportunities into one unified JSON schema.

- **URL**: https://apify.com/francogb/us-federal-contracts-grants-api.md
- **Developed by:** [Franco García Bailez](https://apify.com/francogb) (community)
- **Categories:** Business, Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 federal records

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/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 Contracts & Grants API (USASpending & Grants.gov)

Fast, browserless Pay-Per-Event Apify Actor combining **USASpending.gov v2** (awarded federal contracts and grants) and **Grants.gov Search2** (open and forecasted federal funding opportunities) into a single clean 18-field JSON schema—built for GovCon BD teams, SaaS/defense sales, grant writers, and AI agents (MCP / n8n).

### Covered Official Feeds

| Dataset Key | Official Government API | Data Returned |
| :--- | :--- | :--- |
| `USASPENDING_CONTRACTS` | [USASpending.gov API v2](https://api.usaspending.gov/) | Prime federal contracts (`A/B/C/D`), recipient name, award amount USD, NAICS code, awarding agency & state |
| `USASPENDING_GRANTS` | [USASpending.gov API v2](https://api.usaspending.gov/) | Awarded federal grants (`02/03/04/05`), recipient organization, obligated USD amount, start/end dates |
| `GRANTS_GOV_OPPORTUNITIES` | [Grants.gov API v1 (`search2`)](https://www.grants.gov/) | Live posted and forecasted funding opportunities, CFDA codes, agency code, open/close dates |

### Example Input

```json
{
  "datasets": [
    "USASPENDING_CONTRACTS",
    "USASPENDING_GRANTS",
    "GRANTS_GOV_OPPORTUNITIES"
  ],
  "keywords": ["cloud", "cybersecurity"],
  "minAwardAmount": 100000,
  "startDate": "2026-01-01",
  "endDate": "2026-12-31",
  "grantStatuses": ["posted", "forecasted"],
  "maxResultsPerDataset": 25
}
```

### Example Output Record

```json
{
  "dataset": "USASPENDING_CONTRACTS",
  "recordId": "FA873226F0001",
  "title": "Enterprise Cloud Security Modernization & Zero Trust Operations...",
  "recipientOrApplicant": "EXAMPLE TECH SOLUTIONS LLC",
  "awardingAgency": "Department of Defense",
  "awardingSubAgency": "Department of the Air Force",
  "awardAmountUsd": 4250000.0,
  "status": "AWARDED",
  "awardType": "Federal Contract",
  "startDate": "2026-02-01",
  "endDate": "2029-01-31",
  "closeDate": null,
  "stateCode": "VA",
  "countryCode": "US",
  "naicsOrCfdaCodes": ["541512"],
  "description": "Enterprise Cloud Security Modernization & Zero Trust Operations...",
  "url": "https://www.usaspending.gov/award/CONT_AWD_...",
  "scrapedAt": "2026-11-30T10:40:00+00:00"
}
```

### How Much Does It Cost?

Transparent **Pay-Per-Event (PPE)** pricing with zero proxies and 128–512 MB lightweight HTTP execution:

| Event | Free | Bronze | Silver | Gold / Platinum / Diamond |
| :--- | :---: | :---: | :---: | :---: |
| **Actor Start** (`apify-actor-start`) | `$0.005` | `$0.005` | `$0.005` | `$0.005` |
| **Federal record** (`apify-default-dataset-item`) | `$0.003` | `$0.0025` | `$0.002` | `$0.0015` |

- **Example cost for 100 records**: **`$0.305`** on Free (`$0.005 + 100 × $0.003`) down to **`$0.155`** on Gold+ (`$0.005 + 100 × $0.0015`).
- **Strict Budget Protection**: Checks `maxTotalChargeUsd` before and after fetching so AI agents never overspend.

### Use with AI Agents (Apify MCP Server — Claude Desktop & Cursor)

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?actors=francogb/us-federal-contracts-grants-api"
    }
  }
}
```

**Example AI prompt:**

> *"Use `francogb/us-federal-contracts-grants-api` to pull the largest 2026 US federal contracts over `$500,000` for `cybersecurity` plus open `Grants.gov` opportunities matching `cloud`."*

### Python SDK (`apify-client`) & cURL

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("francogb/us-federal-contracts-grants-api").call(
    run_input={
        "datasets": ["USASPENDING_CONTRACTS", "GRANTS_GOV_OPPORTUNITIES"],
        "keywords": ["cloud"],
        "minAwardAmount": 100000,
        "maxResultsPerDataset": 25,
    }
)
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(f"Fetched {len(items)} federal records")
```

```bash
curl -X POST "https://api.apify.com/v2/acts/francogb~us-federal-contracts-grants-api/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "datasets": ["USASPENDING_CONTRACTS", "USASPENDING_GRANTS", "GRANTS_GOV_OPPORTUNITIES"],
    "keywords": ["cloud"],
    "maxResultsPerDataset": 25
  }'
```

### FAQ

- **Does this Actor require Playwright or residential proxies?**
  No. It queries official `api.usaspending.gov` and `api.grants.gov` endpoints over pure HTTP/JSON.
- **Can I filter by NAICS code, US state, recipient, or minimum award size?**
  Yes. Filter by `naicsCodes`, `stateCode`, `recipientOrCompany`, `agency`, `minAwardAmount`, and date range.
- **Does it return both past awarded money and open grant RFPs?**
  Yes. `USASPENDING_CONTRACTS` & `USASPENDING_GRANTS` return awarded obligations, while `GRANTS_GOV_OPPORTUNITIES` returns open/forecasted applications with close dates.

### More Fast, Official-API Actors by `francogb`

- **[EU Public Tenders & Procurement API (TED, TenderNed, BOAMP, UK)](https://apify.com/francogb/eu-public-tenders-aggregator)**
- **[EU Company, VAT (VIES) & LEI Verifier & Enricher API](https://apify.com/francogb/eu-company-vat-lei-verifier)**
- **[US Stock Insider (Form 4), FINRA Dark Pools & Odd-Lots API](https://apify.com/francogb/us-stock-insider-darkpool-altdata)**
- **[B2B Domain Tech Stack, DNS/DMARC, RDAP & Email Verifier API](https://apify.com/francogb/b2b-domain-techstack-dns-email-intel)**
- **[ClinicalTrials.gov v2 & openFDA Pharma / Biotech Data API](https://apify.com/francogb/clinical-trials-openfda-pharma-api)**

# Actor input Schema

## `datasets` (type: `array`):

Official federal feeds to query concurrently. Allowed values: USASPENDING_CONTRACTS, USASPENDING_GRANTS, GRANTS_GOV_OPPORTUNITIES.

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

Search keywords matched against award descriptions, contract titles, or grant opportunities (e.g. \['cloud', 'cybersecurity', 'ai']).

## `recipientOrCompany` (type: `string`):

Optional prime contractor or grant recipient name filter on USASpending.gov (e.g. 'Lockheed Martin', 'Palantir').

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

Optional awarding agency filter (e.g. 'Department of Defense', 'HHS', 'NASA').

## `stateCode` (type: `string`):

Optional 2-letter US state code for place of performance on USASpending.gov (e.g. 'VA', 'CA', 'TX').

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

Optional NAICS industry codes for USASpending contracts (e.g. \['541511', '541512', '541519']).

## `minAwardAmount` (type: `number`):

Minimum obligated/award amount in USD for USASpending records (0 for no minimum).

## `startDate` (type: `string`):

Time period start date (YYYY-MM-DD) for USASpending.gov awards.

## `endDate` (type: `string`):

Time period end date (YYYY-MM-DD) for USASpending.gov awards.

## `grantStatuses` (type: `array`):

Statuses for Grants.gov opportunities. Allowed values: posted, forecasted, closed, archived.

## `maxResultsPerDataset` (type: `integer`):

Maximum records to return per selected dataset (1-500). Results are merged round-robin and capped by maxTotalChargeUsd.

## Actor input object example

```json
{
  "datasets": [
    "USASPENDING_CONTRACTS",
    "USASPENDING_GRANTS",
    "GRANTS_GOV_OPPORTUNITIES"
  ],
  "keywords": [
    "cloud"
  ],
  "recipientOrCompany": "",
  "agency": "",
  "stateCode": "",
  "naicsCodes": [],
  "minAwardAmount": 0,
  "startDate": "2026-01-01",
  "endDate": "2026-12-31",
  "grantStatuses": [
    "posted",
    "forecasted"
  ],
  "maxResultsPerDataset": 25
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `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 = {
    "datasets": [
        "USASPENDING_CONTRACTS",
        "USASPENDING_GRANTS",
        "GRANTS_GOV_OPPORTUNITIES"
    ],
    "keywords": [
        "cloud"
    ],
    "grantStatuses": [
        "posted",
        "forecasted"
    ],
    "maxResultsPerDataset": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("francogb/us-federal-contracts-grants-api").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 = {
    "datasets": [
        "USASPENDING_CONTRACTS",
        "USASPENDING_GRANTS",
        "GRANTS_GOV_OPPORTUNITIES",
    ],
    "keywords": ["cloud"],
    "grantStatuses": [
        "posted",
        "forecasted",
    ],
    "maxResultsPerDataset": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("francogb/us-federal-contracts-grants-api").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 '{
  "datasets": [
    "USASPENDING_CONTRACTS",
    "USASPENDING_GRANTS",
    "GRANTS_GOV_OPPORTUNITIES"
  ],
  "keywords": [
    "cloud"
  ],
  "grantStatuses": [
    "posted",
    "forecasted"
  ],
  "maxResultsPerDataset": 25
}' |
apify call francogb/us-federal-contracts-grants-api --silent --output-dataset

```

## MCP server setup

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

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/QVivPztI5uXndYhVy/builds/rSEHB81RGU35n43Pl/openapi.json
