# US Government Contracts & Grants (`ninja.dev/us-gov-contracts-grants`) Actor

Find who won US federal contracts and grants, and which grants are open now. Search by keyword, company, agency, NAICS or state: returns award amount, recipient, agency and dates from USAspending.gov, plus open Grants.gov opportunities with deadline, funding ceiling and eligibility.

- **URL**: https://apify.com/ninja.dev/us-gov-contracts-grants.md
- **Developed by:** [Matheus Coelho](https://apify.com/ninja.dev) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 awards

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 Government Contracts & Grants

Answer the two questions every government-market team asks:

1. **Who is winning federal money?** Contracts, delivery orders, IDVs, grants, loans and other awards from **USAspending.gov**: recipient, amount, awarding agency, NAICS, PSC, place of performance and dates, largest first.
2. **What can I still apply for?** Open and forecasted funding opportunities from **Grants.gov**: deadline, award ceiling and floor, estimated total funding, eligible applicants and the program contact.

Both are official, public US government APIs. No login, no API key.

### Use cases

- **Competitive intelligence**: every contract a competitor (e.g. `Palantir`) won this year, with amounts and agencies.
- **Lead generation**: companies that just won large cybersecurity or AI contracts are buying subcontractors, tools and staff.
- **Grant hunting**: open NSF, NIH, DOE or USDA opportunities for your topic, with deadline and how much you can get.
- **Market sizing**: total spend by agency, NAICS code or state on a topic.
- **AI agents**: structured JSON with a `recordType` on every row and error rows with hints.

### Input

| Field | What it does |
|---|---|
| `keywords` | Words to match, e.g. `artificial intelligence`, `cybersecurity`. Used by both sources. |
| `searchAwards` | Search awarded money on USAspending (default on). |
| `awardTypes` | `contracts` (default), `idvs`, `grants`, `loans`, `direct_payments`, `other_assistance`. |
| `recipientName` | Only awards to this company or university. |
| `agencies` | Awarding agency names as on USAspending, e.g. `Department of Defense`. |
| `naicsCodes` | Contracts only, e.g. `541512`. |
| `states` | Place of performance, e.g. `VA`, `TX`. |
| `startDate` / `endDate` | `YYYY-MM-DD`. Default: the last 12 months. Awards with any spending action in the period are included, so a multi-year contract signed earlier still shows up while it is being paid. |
| `minAmount` | Skip awards below this amount (USD). |
| `maxAwards` | Max awards per type, largest first (default 25). |
| `searchGrantOpportunities` | Search Grants.gov (default on). |
| `grantStatuses` | `posted` (open now) and `forecasted` (default), or `closed`, `archived`. |
| `grantAgencyCodes` | Grants.gov agency codes, e.g. `NSF`, `DOE`, `HHS-NIH11`. |
| `includeGrantDetails` | Description, ceiling, floor, eligibility and contact for each opportunity (default on). |
| `maxGrantOpportunities` | Max opportunities (default 25). |

### Output

**`award`**

```json
{
  "recordType": "award",
  "awardCategory": "contracts",
  "awardId": "W911QX20C0023",
  "recipientName": "ECS FEDERAL, LLC",
  "amount": 120492195.74,
  "awardingAgency": "Department of Defense",
  "description": "RESEARCH AND DEVELOPMENT EFFORT TO DESIGN AND DEVELOP PROTOTYPE ...",
  "startDate": "2020-09-28",
  "naics": { "code": "541715", "description": "RESEARCH AND DEVELOPMENT IN THE PHYSICAL, ENGINEERING, AND LIFE SCIENCES" },
  "url": "https://www.usaspending.gov/award/CONT_AWD_W911QX20C0023_9700_-NONE-_-NONE-"
}
```

**`grantOpportunity`**

```json
{
  "recordType": "grantOpportunity",
  "title": "Science of Learning and Augmented Intelligence (SL)",
  "agency": "U.S. National Science Foundation",
  "status": "posted",
  "closeDate": "2027-02-10",
  "awardCeiling": null,
  "eligibleApplicants": ["Unrestricted (i.e., open to any type of entity above) ..."],
  "contactEmail": "grantsgovsupport@nsf.gov",
  "url": "https://www.grants.gov/search-results-detail/320753"
}
```

**`error`**: unknown award type, search too broad, no results or an API error, each with a `hint`.

### Good to know

- Award searches need at least one of `keywords`, `recipientName`, `agencies` or `naicsCodes`. A search over all federal spending would return millions of rows.
- SAM.gov contract opportunities (open bids) need a personal SAM.gov API key and are not included yet.
- Amounts are the award's total obligated amount as reported by USAspending.

### Related Actors

- [SEC EDGAR Filings & Financials](https://apify.com/ninja.dev/sec-edgar-filings-financials): SEC filings and normalized financials.
- [Research Papers Search (OpenAlex)](https://apify.com/ninja.dev/research-papers-openalex): 250M+ papers with abstracts and citations.
- [Domain Availability Checker & WHOIS](https://apify.com/ninja.dev/domain-availability-whois): bulk domain availability and WHOIS.

# Actor input Schema

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

Words to match in award descriptions and grant opportunities, e.g. artificial intelligence, cybersecurity.

## `searchAwards` (type: `boolean`):

Who won what: recipient, amount, agency, dates.

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

contracts = purchase orders and delivery orders; idvs = indefinite delivery vehicles (GWACs, BPAs); grants = grants and cooperative agreements.

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

Only awards to this company, e.g. Palantir.

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

Top-tier agency names exactly as on USAspending, e.g. Department of Defense, Department of Health and Human Services.

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

Contracts only, e.g. 541512 (computer systems design).

## `states` (type: `array`):

Two-letter codes, e.g. VA, TX.

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

YYYY-MM-DD. Default: one year ago.

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

YYYY-MM-DD. Default: today.

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

Skip awards smaller than this.

## `maxAwards` (type: `integer`):

Largest awards first.

## `searchGrantOpportunities` (type: `boolean`):

Funding you can still apply for.

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

posted = open now; forecasted = announced, opening soon.

## `grantAgencyCodes` (type: `array`):

Grants.gov agency codes, e.g. NSF, HHS-NIH11, DOE.

## `includeGrantDetails` (type: `boolean`):

Adds description, funding ceiling and floor, eligibility and contact for each opportunity.

## `maxGrantOpportunities` (type: `integer`):

Maximum opportunities to return.

## Actor input object example

```json
{
  "keywords": [
    "artificial intelligence"
  ],
  "searchAwards": true,
  "awardTypes": [
    "contracts"
  ],
  "maxAwards": 25,
  "searchGrantOpportunities": true,
  "grantStatuses": [
    "posted",
    "forecasted"
  ],
  "includeGrantDetails": true,
  "maxGrantOpportunities": 25
}
```

# Actor output Schema

## `results` (type: `string`):

Awards (who won what) and open grant opportunities, plus error rows with hints.

## `summary` (type: `string`):

Counts per record type and the list of issues.

# 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": [
        "artificial intelligence"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ninja.dev/us-gov-contracts-grants").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": ["artificial intelligence"] }

# Run the Actor and wait for it to finish
run = client.actor("ninja.dev/us-gov-contracts-grants").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": [
    "artificial intelligence"
  ]
}' |
apify call ninja.dev/us-gov-contracts-grants --silent --output-dataset

```

## MCP server setup

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

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/LxEhTpV09xD7eYPz9/builds/2alxWb0MMrVatl9kB/openapi.json
