# Grants Closing Soon Alerts (Grants.gov + SAM.gov) (`utility-belt-labs/grants-closing-soon-alerts`) Actor

Federal grants closing in the next N days, sorted by deadline with days left. Filter by keyword, agency, eligibility. Optional SAM.gov.

- **URL**: https://apify.com/utility-belt-labs/grants-closing-soon-alerts.md
- **Developed by:** [Utility Belt Labs](https://apify.com/utility-belt-labs) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## 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

## Grants Closing Soon Alerts: federal grant deadlines from Grants.gov (+ SAM.gov bids)

**See which US federal grants are about to close, in deadline order, with a `daysLeft` field on every row.** Filter by keyword, agency, eligible applicant type and funding category. Optionally add SAM.gov contract opportunities (bring your own free SAM.gov API key). Schedule it daily or weekly and turn on **Only new since last run** to get just the opportunities you have not seen yet.

Official public APIs only (Grants.gov and SAM.gov). No scraping, no logins, no browser.

### Use cases

- **Grant writers and nonprofits:** a weekly "what closes in the next 30 days that fits us" list, filtered to 501(c)(3) eligibility or your funding category.
- **Universities and research offices:** track NIH, NSF, DOE and other agency deadlines for your faculty.
- **Small businesses and BD teams:** small-business-eligible grants and SAM.gov solicitations with a response deadline in the next N days, in one sorted list.
- **Consultants and newsletters:** run on a schedule, send the dataset to Slack, email, Google Sheets or a webhook using Apify integrations.
- **AI agents:** works as a tool through the Apify MCP server ("what federal grants for school districts close this month?").

### How it works

1. Grants.gov is queried for posted opportunities sorted by close date, and the Actor stops as soon as dates pass your window.
2. Optional SAM.gov search uses SAM's own response-deadline filter.
3. Rows are merged, de-duplicated, sorted by deadline, and given `daysLeft` and a readable `closingIn` ("closes in 2 days").
4. With *Only new since last run*, a small state record in a named key-value store remembers what was already reported, so scheduled runs only return new items.

### Input

| Field | What it does |
|---|---|
| `daysAhead` | Close date at most this many days from today (default 14). |
| `minDaysLeft` | Hide items closing sooner than this (default 0). |
| `keywords` | Optional list; one search per keyword, results merged, each row shows `matchedKeywords`. |
| `agencies` | Codes or names, e.g. `HHS`, `NSF`, `Department of Energy`, `HHS-NIH11`. A parent agency includes its sub-agencies. |
| `eligibilities` | Applicant types (nonprofits 501(c)(3), small businesses, states, tribes, universities...). |
| `fundingCategories` | Health, Education, Environment, Science and Technology, etc. |
| `sources` | `grants` (default) and/or `sam`. |
| `samApiKey` | Your own free SAM.gov key (secret field). Needed only for SAM.gov. |
| `samNaics`, `samSetAside`, `samNoticeType` | SAM.gov-only filters. |
| `includeDetails` | Adds description, award ceiling/floor, total funding, expected awards, cost sharing, eligible applicants for grants. |
| `onlyNewSinceLastRun`, `stateStoreName` | Only report items not seen in earlier runs that share the same store name. |
| `maxItems` | Cap on total rows (default 200). |

Example input:

```json
{
  "daysAhead": 30,
  "keywords": ["education", "literacy"],
  "agencies": ["ED", "NSF"],
  "eligibilities": ["12"],
  "onlyNewSinceLastRun": true
}
```

### Output

One dataset row per opportunity, sorted by `closeDate`:

```json
{
  "source": "grants.gov",
  "id": "361002",
  "number": "CDC-RFA-DD-26-0222",
  "title": "Long-term health outcomes of people living with spina bifida",
  "agency": "Centers for Disease Control - NCBDDD",
  "agencyCode": "HHS-CDC-NCBDDD",
  "status": "posted",
  "postedDate": "2026-08-26",
  "closeDate": "2026-10-26",
  "daysLeft": 2,
  "closingIn": "closes in 2 days",
  "assistanceListings": ["93.073"],
  "url": "https://www.grants.gov/search-results-detail/361002",
  "matchedKeywords": ["health"]
}
```

SAM.gov rows add `noticeType`, `naics`, `setAside`, `placeOfPerformanceState` and `closeDateTime`. A `SUMMARY` record in the default key-value store gives the result count and nearest deadline.

Export as JSON, CSV, Excel or HTML table, or open the **Closing soon** view in the Output tab.

### SAM.gov API key

SAM.gov requires a free personal API key: sign in at sam.gov, open Account Details, request a Public API Key, and paste it into *SAM.gov API key*. It is stored as a secret input and sent only to api.sam.gov in a request header. Without a key the Actor returns Grants.gov results and skips SAM.gov.

### Limits and honest notes

- **Days left uses US Eastern calendar dates.** A grant closing "today" has `daysLeft` 0. Grants.gov exposes only the close *date*; the exact cut-off time (often late evening Eastern, but it varies) is in the official listing. Always confirm deadlines and requirements there before applying.
- **Opportunities with no close date** (rolling or forecasted) are not included, because there is no deadline to sort by.
- **Grants.gov agency filter** matches agency codes; parent agencies are expanded using the codes that currently have open postings.
- **Keyword matching** is Grants.gov's own search (and SAM.gov's title search), so results depend on how those systems index text.
- **SAM.gov** applies per-key rate limits and daily quotas. If your quota is used up, SAM.gov results are skipped and the run says why. Keep SAM.gov runs modest, for example one daily schedule.
- **Only new since last run:** the state store is shared by every run that uses the same `stateStoreName`. Use a different name per alert configuration. The first run returns everything in the window.
- Data is only as current as Grants.gov and SAM.gov. This Actor is not affiliated with or endorsed by either.

### Pricing

Currently free to run (you only pay normal Apify platform usage). Pricing may change to pay-per-result in the future; check the Store page.

### Support

Questions or feature requests: please open an issue in the Issues tab of this Actor.

# Actor input Schema

## `daysAhead` (type: `integer`):

Return opportunities whose close date is at most this many days from today (US Eastern date). Today counts as 0 days left.

## `minDaysLeft` (type: `integer`):

Skip opportunities that close sooner than this, e.g. 3 to hide ones you can no longer realistically apply for. 0 keeps everything including items closing today.

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

Optional. One search per keyword; results are merged and de-duplicated, and each row lists the keywords it matched. Leave empty to list everything closing in the window. Use quotes for an exact phrase (Grants.gov), e.g. "clean water". On SAM.gov keywords match the notice title.

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

Optional. Agency codes or names, e.g. HHS, NSF, DOE, "Department of Energy", HHS-NIH11. A parent agency such as HHS or DOD includes all of its sub-agencies.

## `eligibilities` (type: `array`):

Optional. Only grants open to at least one of the selected applicant types.

## `fundingCategories` (type: `array`):

Optional. Only grants in at least one of the selected categories.

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

Grants.gov needs no key. SAM.gov contract opportunities need your own free SAM.gov API key (below).

## `includeDetails` (type: `boolean`):

Adds description, award ceiling/floor, total funding, expected awards, cost sharing and eligible applicants for each Grants.gov row (one extra API call each).

## `onlyNewSinceLastRun` (type: `boolean`):

Return only opportunities not reported by an earlier run that used the same state store name. Ideal for scheduled daily or weekly alerts. The first run returns everything in the window.

## `stateStoreName` (type: `string`):

Name of the key-value store that remembers what was already reported (used only with 'Only new since last run'). Use a different name per alert configuration. Lowercase letters, digits and dashes.

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

Maximum rows returned in total.

## `samApiKey` (type: `string`):

Only needed when SAM.gov is selected. Free: sign in at sam.gov, Account Details, Public API Key. Stored as a secret and sent only to api.sam.gov.

## `samNaics` (type: `string`):

Optional 6-digit NAICS code, e.g. 541511.

## `samSetAside` (type: `string`):

Optional, e.g. SBA, 8A, WOSB, SDVOSBC, HZC.

## `samNoticeType` (type: `string`):

Optional. Leave on 'Any' to include all notice types that have a response deadline.

## Actor input object example

```json
{
  "daysAhead": 14,
  "minDaysLeft": 0,
  "keywords": [
    "education"
  ],
  "sources": [
    "grants"
  ],
  "includeDetails": false,
  "onlyNewSinceLastRun": false,
  "stateStoreName": "grants-closing-soon-state",
  "maxItems": 200,
  "samNoticeType": ""
}
```

# Actor output Schema

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

Dataset of opportunities sorted by close date, each with days left, agency, title, source and link.

# 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 = {
    "daysAhead": 14,
    "keywords": [
        "education"
    ],
    "sources": [
        "grants"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("utility-belt-labs/grants-closing-soon-alerts").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 = {
    "daysAhead": 14,
    "keywords": ["education"],
    "sources": ["grants"],
}

# Run the Actor and wait for it to finish
run = client.actor("utility-belt-labs/grants-closing-soon-alerts").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 '{
  "daysAhead": 14,
  "keywords": [
    "education"
  ],
  "sources": [
    "grants"
  ]
}' |
apify call utility-belt-labs/grants-closing-soon-alerts --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,utility-belt-labs/grants-closing-soon-alerts"
        }
    }
}
```

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/5YY3fxrVqN8pS3nyH/builds/EWb8n4OhhcKcw9Cmj/openapi.json
