# Grants Gov Opportunities Scraper (`kawsar/grants-gov-opportunities-scraper`) Actor

Extract US federal grant opportunities by searching keywords or specific IDs. Collect details like agency, status, close dates, and ALN numbers without logins. Download your structured datasets directly from Apify in JSON, CSV, or Excel formats.

- **URL**: https://apify.com/kawsar/grants-gov-opportunities-scraper.md
- **Developed by:** [Kawsar](https://apify.com/kawsar) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

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

## Grants.gov Scraper: US Federal Grant Opportunities

<p align="center">
  <img src="https://imgur.com/A7kKmv6.png" alt="Grants Gov Opportunities" style="max-width:100%; border-radius:14px; width:680px;" />
</p>

A handy tool to search, collect, and track US federal grant opportunities. Easily filter through open and forecasted grants, retrieve key details, and export everything directly to JSON, CSV, or Excel formats for quick analysis.

### Key Features & Use Cases

- **Grant Prospecting:** Discover new and upcoming funding opportunities for specific fields like education, healthcare, or climate change.
- **Deadline Tracking:** Keep an eye on closing dates, status updates, and key deadlines across multiple grant listings.
- **Agency Monitoring:** See which government agencies are active in your area of interest along with their organization names.
- **CFDA and ALN Lookup:** Easily capture Assistance Listing Numbers (ALN/CFDA) attached to grant records.
- **Automated Updates:** Set your search on a schedule to get fresh data whenever new grant notices drop.
- **Research & Reporting:** Extract structured records for grant research without needing to manually click through search pages.

***

### Data Collected

Depending on the mode you choose, you can grab basic search listings or deeper grant details.

| Field | Type | Description |
| :--- | :--- | :--- |
| `id` | string | Grant opportunity ID |
| `number` | string | Opportunity identification number |
| `opportunityTitle` | string | Title of the grant opportunity |
| `agencyCode` | string | Short code for the funding agency |
| `agency` | string | Full name of the funding agency |
| `openDate` | string | Date the opportunity was posted or opened |
| `closeDate` | string | Closing or application deadline date |
| `oppStatus` | string | Status (e.g., posted, forecasted) |
| `docType` | string | Document type (e.g., synopsis) |
| `cfdaList` | array | List of CFDA / ALN numbers |
| `scrapedAt` | string | Timestamp when the record was saved |
| `sourceUrl` | string | Reference link for the row |
| `error` | string | Description of any issue encountered during fetch |

#### Example Output

```json
{
  "id": "334326",
  "number": "21-595",
  "opportunityTitle": "Tribal Colleges and Universities Program (TCUP)",
  "agencyCode": "NSF",
  "agency": "U.S. National Science Foundation",
  "openDate": "06/24/2021",
  "closeDate": "10/14/2026",
  "oppStatus": "posted",
  "docType": "synopsis",
  "cfdaList": ["47.076"],
  "scrapedAt": "2026-10-12T00:00:00+00:00",
  "sourceUrl": "[https://www.grants.gov](https://www.grants.gov)"
}

```

***

### Configuration & Inputs

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `mode` | string | `search` | Choose between `search` or `details` |
| `keyword` | string | `education` | Topic or search term (Search mode) |
| `oppStatuses` | string | `forecasted|posted` | Status filter separated by pipes |
| `opportunityIds` | string list | `[]` | List of specific grant IDs (Details mode) |
| `includeDetails` | boolean | `false` | Fetch full grant details for search matches |
| `maxItems` | integer | `100` | Maximum number of rows to collect (Max 1000) |
| `timeoutSecs` | integer | `300` | Global runtime limit in seconds |
| `requestTimeoutSecs` | integer | `30` | Per-request timeout limit |

#### Example Inputs

**Search Mode:**

```json
{
  "mode": "search",
  "keyword": "education",
  "oppStatuses": "forecasted|posted",
  "includeDetails": false,
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30
}

```

**Details Mode:**

```json
{
  "mode": "details",
  "opportunityIds": ["334326"],
  "maxItems": 10,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30
}

```

***

### How It Works

- **Flexible Modes:** Run keyword searches or feed a list of specific grant IDs to fetch target information.
- **Smart Retries:** Automatically handles temporary connection glitches or rate pauses, retrying up to three times before logging an error row and moving on.
- **Pacing & Limits:** Processes requests smoothly and sequentially. You can collect up to 1,000 records per run.
- **Clean Handling:** If a search turns up empty, it simply logs a friendly note and finishes cleanly without stopping your pipeline.

***

### Frequently Asked Questions

**How many records can I collect in one run?**

By default, the runner collects up to 100 items, but you can set `maxItems` up to 1,000 per run.

**Can I export the data into spreadsheet formats?**

Yes! Once the run finishes, you can download your dataset in CSV, Excel, or JSON formats directly.

**What happens if a grant ID is missing or invalid?**

The tool logs the specific error message for that record and continues fetching the rest of your list uninterrupted.

***

#### Trademark notice

Grants.gov Opportunities and related names, logos, and trademarks belong to their respective owners. Their use in this documentation is solely to identify the source of the data and does not imply affiliation, sponsorship, endorsement, or partnership.

#### Disclaimer

Disclaimer: This Actor is an independent tool and is not affiliated with, endorsed by, sponsored by, or otherwise officially associated with Grants.gov Opportunities or its owners. All data is collected from publicly available sources. Users are responsible for complying with the source's terms of use, rate limits, and attribution or licensing requirements.

#### Is web scraping legal?

This Actor only collects publicly available data from Grants.gov Opportunities, mostly through its public API or feed, without logging in or bypassing any access controls. Scraping public data is generally legal, but how you use it matters:

- **Personal data:** If the results include personal data (for example names, emails, or profile details), laws such as the GDPR in the EU and the CCPA in California may apply. Only collect and store personal data when you have a legitimate reason.
- **Copyright:** Some content (articles, images, descriptions) may be protected by copyright. Do not republish full copyrighted content without permission.
- **Terms of use:** Respect the source's terms, stated rate limits, and any attribution or non-commercial-use requirements.
- **Legal advice:** This is general information, not legal advice. If you're unsure, consult a lawyer.

To learn more, read Apify's guide: [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/)

# Actor input Schema

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

Search returns one row per matching opportunity. Details loads full records for the ids you list.

## `keyword` (type: `string`):

Keyword sent to the Grants.gov search2 API. Used in search mode.

## `oppStatuses` (type: `string`):

Pipe-separated opportunity statuses, for example forecasted|posted. Used in search mode.

## `opportunityIds` (type: `array`):

Grants.gov opportunity ids for details mode. One id per line, such as 334326.

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

After a search hit, also call fetchOpportunity and fill the row from that record.

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

Maximum rows to save in one run, including error rows. Hard cap is 1000.

## `timeoutSecs` (type: `integer`):

Stop starting new requests after this many seconds.

## `requestTimeoutSecs` (type: `integer`):

How long to wait for a single Grants.gov response.

## `proxyConfiguration` (type: `object`):

Optional proxy. Leave Apify Proxy off. These public endpoints do not need a proxy, and a proxy must not be used to get around Grants.gov limits.

## Actor input object example

```json
{
  "mode": "search",
  "keyword": "education",
  "oppStatuses": "forecasted|posted",
  "opportunityIds": [
    "334326"
  ],
  "includeDetails": false,
  "maxItems": 100,
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `datasetUrl` (type: `string`):

Default dataset for this run, with one row per opportunity or error.

## `overviewUrl` (type: `string`):

Table of id, number, opportunity title, agency, dates, and status.

# 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 = {
    "mode": "search",
    "keyword": "education",
    "oppStatuses": "forecasted|posted",
    "opportunityIds": [
        "334326"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("kawsar/grants-gov-opportunities-scraper").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 = {
    "mode": "search",
    "keyword": "education",
    "oppStatuses": "forecasted|posted",
    "opportunityIds": ["334326"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("kawsar/grants-gov-opportunities-scraper").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 '{
  "mode": "search",
  "keyword": "education",
  "oppStatuses": "forecasted|posted",
  "opportunityIds": [
    "334326"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call kawsar/grants-gov-opportunities-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kawsar/grants-gov-opportunities-scraper"
        }
    }
}
```

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/IZToUEocBswYI7Nxq/builds/HTk0PmzUOa1iOLTdO/openapi.json
