# US Federal Contracts & Grants API: SAM.gov, Grants.gov, Awards (`codepulsehq/us-federal-opportunities-api`) Actor

Search US federal contract opportunities (SAM.gov), grants (Grants.gov) and past awards (USAspending) by keyword, NAICS, agency, state and set-aside. No API key. Schedule it for daily alerts.

- **URL**: https://apify.com/codepulsehq/us-federal-opportunities-api.md
- **Developed by:** [Code Pulse](https://apify.com/codepulsehq) (community)
- **Categories:** Lead generation, Automation, News
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.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 Contracts & Grants API: SAM.gov opportunities, Grants.gov grants and USAspending awards, no API key

Find US government work before your competitors do. Search **contract opportunities from SAM.gov**, **grant opportunities from Grants.gov** and **past contract awards from USAspending**, filtered by keyword, NAICS code, agency, state, set-aside and deadline. All from official public sources, with no SAM.gov key to request and no rate limit to manage.

**Try it free:** Apify's free plan includes $5 of monthly credit, enough for about 1,600 contract opportunities. Press **Start** at the top of this page.

### At a glance

- **What it is:** an API and no-code tool for federal contract, grant and award data.
- **Three sources in one:** contract opportunities (SAM.gov), grants (Grants.gov), awards (USAspending: who won, how much).
- **Filters:** keywords (title matches listed first), NAICS codes, agencies, state, set-aside (SBA, 8(a), HUBZone, SDVOSB, WOSB), notice type, posted and closing dates, minimum amount.
- **Output:** one row per opportunity, with deadline, days left, contact person and email, set-aside and a link. Grants add award ceiling and floor, eligibility and expected awards.
- **Price:** $0.003 per contract or grant opportunity and $0.002 per award. Errors are free.
- **How to call it:** the Apify Console, the REST API, n8n, Make, Zapier, or an AI agent through MCP. Put it on a daily schedule for new-opportunity alerts.

### Does this sound like you?

| What's going wrong | What this does about it |
|---|---|
| "SAM.gov's search is slow and I can't get the results into a spreadsheet." | Run a search and download CSV, Excel or JSON. |
| "I want an alert when a relevant solicitation is posted." | Schedule it daily with *Posted in the last 1 day* and send the results to email or Slack. |
| "The SAM.gov API needs a key, a role, and has strict limits." | No key needed here: it reads the public data SAM.gov publishes every day. |
| "Which opportunities are for small businesses in my NAICS code?" | Filter by NAICS, set-aside code and state. |
| "Who won the last contract like this, and for how much?" | Switch to *Past awards* with the same keywords and a minimum value. |
| "I never find grants alongside contracts." | One run can search both. |

### Who uses it

- **Small businesses and government contractors:** a daily list of new opportunities in your NAICS codes and set-aside category.
- **Business development and capture teams:** competitor and incumbent research from award data.
- **Consultants and grant writers:** open federal grants with deadlines, ceilings and eligibility.
- **Researchers and journalists:** federal spending by keyword, agency and period.
- **AI agents:** give a research or sales agent a "find federal opportunities" tool through MCP.

### How to use it in 3 steps

1. Choose **Where to look** and add **Keywords** or other filters.
2. Press **Start**.
3. Read the **Output** tab, or download JSON, CSV or Excel. To get alerts, add a schedule.

### What you get

A contract opportunity:

```json
{
  "success": true, "source": "SAM.gov", "type": "contract_opportunity",
  "title": "Military Sealift Command (MSC) Cybersecurity Support Services", "notice_type": "Solicitation",
  "agency": "DEPT OF DEFENSE", "sub_tier": "DEPT OF THE NAVY", "naics": "541519", "psc": "D302",
  "set_aside": "Total Small Business Set-Aside (FAR 19.5)", "set_aside_code": "SBA",
  "posted_date": "2026-11-12 10:05:00", "response_deadline": "2026-12-04T17:00:00+00:00", "days_until_deadline": 16,
  "place_of_performance": { "city": "Norfolk", "state": "VA", "country": "USA" },
  "contact": { "name": "A. Contracting Officer", "email": "contracting.officer@navy.mil" },
  "matched_in": "title", "matched_keywords": ["cybersecurity"],
  "url": "https://sam.gov/workspace/contract/opp/..."
}
```

A grant:

```json
{
  "success": true, "source": "Grants.gov", "type": "grant_opportunity",
  "title": "Fiscal Years 2025 and 2026 Congestion Relief Program", "agency": "DOT Federal Highway Administration",
  "number": "FHWA-CRPP-27-001", "posted_date": "11/17/2026", "close_date": "12/17/2026", "days_until_close": 29,
  "award_ceiling": 100000000, "award_floor": 10000000, "eligible_applicants": ["State governments"],
  "url": "https://www.grants.gov/search-results-detail/364277"
}
```

An award:

```json
{ "success": true, "source": "USAspending", "type": "award", "recipient": "MAVERIS LLC", "amount": 219100000, "agency": "Department of Veterans Affairs",
  "description": "VA CYBERSECURITY OPERATIONS CENTER NEXT GENERATION", "url": "https://www.usaspending.gov/award/..." }
```

Problems come back as `success: false` rows with a plain-English reason. Those rows are free.

### Input options

| Option | What it does |
|---|---|
| **Where to look** | `contracts`, `grants`, `awards`. Pick one or several. |
| **Keywords / Leave out keywords** | Any-match search in titles and descriptions. Title matches come first. |
| **NAICS codes** | A short code matches everything under it (5415 = computer systems design). |
| **Agencies** | Part of an agency name (defense, veterans, navy). |
| **Place of performance** | Two-letter state codes. Contracts only. |
| **Set-asides, notice types** | SBA, 8A, HZC, SDVOSBC, WOSB. Solicitation, Sources Sought and so on. Contracts only. |
| **Posted in the last / Closing within** | Date windows in days. |
| **Minimum amount** | Grant ceiling or award value. |
| **Maximum results per source** | A cost cap. Default 100. |

### Call it from code

```bash
curl -X POST "https://api.apify.com/v2/acts/codepulsehq~us-federal-opportunities-api/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "sources": ["contracts"], "keywords": ["cybersecurity"], "naics": ["5415"], "setAsides": ["SBA"], "postedWithinDays": 7 }'
```

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("codepulsehq/us-federal-opportunities-api").call(run_input={"sources": ["contracts", "grants"], "keywords": ["artificial intelligence"], "postedWithinDays": 7})
for row in client.dataset(run.default_dataset_id).iterate_items():
    print(row["source"], row["title"], row.get("days_until_deadline") or row.get("days_until_close"))
```

### Use it from an AI agent (MCP)

```json
{ "mcpServers": { "federal-opportunities": { "url": "https://mcp.apify.com?tools=codepulsehq/us-federal-opportunities-api" } } }
```

Ask: *"Find small-business set-aside cybersecurity solicitations posted this week and list the contacts."*

### Get a daily alert

In Apify, create a **Schedule** for this Actor with *Posted in the last (days)* set to `1`. Connect the run to Slack, email, Google Sheets or a webhook from the **Integrations** tab, and you get only the new opportunities each day.

### Pricing

| Result | Price |
|---|---|
| Contract or grant opportunity | $0.003 |
| Past award | $0.002 |

You pay only for results returned. Errors are free, and you can set a maximum cost per run.

### Quick answers

**How do I get SAM.gov contract opportunities without an API key?** Use this Actor. It reads SAM.gov's public daily extract of active contract opportunities, so there's no key to request.

**How do I find opportunities for small businesses in my NAICS code?** Add your NAICS code and set *Set-asides* to SBA (or 8A, HZC, SDVOSBC, WOSB).

**How do I get alerts for new federal contracts?** Schedule the Actor daily with *Posted in the last (days)* set to 1 and send the results to email or Slack.

**How do I find out who won a contract?** Choose *Past awards* and search by keyword, agency or amount.

**Is the data official?** Yes: SAM.gov's public extract, Grants.gov's API and USAspending.gov's API. This Actor isn't affiliated with or endorsed by the US government.

### Limits you should know

- **Contract data is as fresh as SAM.gov's daily extract** (refreshed overnight US time), not live.
- **Award data is from USAspending and trails real events.** Agencies report with a delay, and award amounts are what was obligated, not always what was paid.
- **Keyword search is plain text matching**, not semantic search. Boilerplate in a description (for example a security clause) can match a keyword. Title matches are listed first to help.
- **Attachments** (the solicitation documents) aren't downloaded. Each row links to the notice.

### More from CodePulse

- [SEC EDGAR API](https://apify.com/codepulsehq/sec-edgar-api): what public companies disclose in their filings.
- [Domain Intelligence API](https://apify.com/codepulsehq/domain-intelligence-api): check a contractor's or prospect's domain, email security and tech stack.
- [Speech to Text API](https://apify.com/codepulsehq/speech-to-text-api): transcribe agency webinars and industry-day recordings.

### FAQ

**Something broke or you need another filter?** Open an issue from the **Issues** tab with your input.

# Actor input Schema

## `sources` (type: `array`):

Contract opportunities come from SAM.gov, grants from Grants.gov and past awards from USAspending. Pick one or several.

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

Find opportunities mentioning any of these words or phrases, such as cybersecurity or cloud migration. Titles that match are listed first. Leave empty to see everything that matches your other filters.

## `excludeKeywords` (type: `array`):

Skip opportunities that mention any of these words.

## `naics` (type: `array`):

Industry codes. A short code matches everything under it, for example 5415 for computer systems design and related services.

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

Part of an agency name, such as defense, veterans, homeland security or navy. For awards use the full department name, for example Department of Defense.

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

Two-letter state codes such as TX or VA.

## `setAsides` (type: `array`):

Codes such as SBA (small business), 8A, HZC (HUBZone), SDVOSBC (service-disabled veteran-owned) or WOSB (woman-owned).

## `noticeTypes` (type: `array`):

For example Solicitation, Combined Synopsis, Presolicitation, Sources Sought or Special Notice.

## `postedWithinDays` (type: `integer`):

Only opportunities posted in this many days. Use 1 on a daily schedule to get new ones only. Default 30.

## `closingWithinDays` (type: `integer`):

Only contract opportunities whose response deadline is within this many days.

## `onlyOpen` (type: `boolean`):

Hide opportunities whose deadline has passed and closed grants.

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

For grants: smallest award ceiling. For awards: smallest award value.

## `awardedWithinDays` (type: `integer`):

How far back to look for awards. Default 365.

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

Stops a broad search from running up a big bill. Default 100.

## `includeDescription` (type: `boolean`):

Return the whole description instead of the first 600 characters.

## Actor input object example

```json
{
  "sources": [
    "contracts"
  ],
  "keywords": [
    "cybersecurity"
  ],
  "onlyOpen": true,
  "maxResults": 100,
  "includeDescription": false
}
```

# Actor output Schema

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

All results for this run.

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

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

# Run the Actor and wait for it to finish
run = client.actor("codepulsehq/us-federal-opportunities-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 '{
  "keywords": [
    "cybersecurity"
  ]
}' |
apify call codepulsehq/us-federal-opportunities-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codepulsehq/us-federal-opportunities-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/L4rkKXf5gpOlvYH1V/builds/rx1PBsRgVp5XBSAu4/openapi.json
