# Grants.gov Funding Opportunities Scraper (`knotty_mistveil/grants-gov-opportunities`) Actor

US federal grant opportunities from the official Grants.gov Search2 API: agency, ALN, deadline, award ceiling and floor, eligibility and agency contact.

- **URL**: https://apify.com/knotty\_mistveil/grants-gov-opportunities.md
- **Developed by:** [Jason](https://apify.com/knotty_mistveil) (community)
- **Categories:** Business, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 opportunity returneds

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Grants.gov Funding Opportunities Scraper

Pulls US federal funding opportunities from **Grants.gov**, the single government-wide portal for federal grant announcements, through its official public `search2` and `fetchOpportunity` APIs. No API key, no account, no browser automation. You get one flat JSON record per opportunity with the agency and its department, the Assistance Listing Number (ALN/CFDA) and programme title, open and close dates, the award ceiling, floor and estimated total funding, the expected number of awards, the cost-sharing flag, eligible applicant types, funding categories and instruments, the plain-text synopsis and the agency contact's name, email and phone - filtered by status, open-date window, keyword, agency, funding category, applicant eligibility, funding instrument and ALN prefix. On 8 September 2026 the API held **83,368 opportunities** (1,024 posted, 561 forecasted, 8,701 closed, 73,082 archived) and about **295 new opportunities per 30 days** across all four statuses.

### What you get

Every record contains:

| Field | Description |
| --- | --- |
| `id` | Grants.gov opportunity id, for example `363816` |
| `source` | `grants.gov`, constant |
| `url` | `https://www.grants.gov/search-results-detail/{id}` - the public opportunity page |
| `opportunityNumber` | The agency's own funding-opportunity number, e.g. `USDA-NIFA-ICGP-012261` |
| `title` | Opportunity title, with the agency's HTML character references decoded - `&ndash;`, `&rsquo;`, `&amp;`, `&nbsp;` and the rest come out as the real characters (see *Limits and freshness*) |
| `agencyCode` | Grants.gov agency code, e.g. `USDA-NIFA`, `HHS-NIH11`, `NSF` |
| `agencyName` | Sub-agency name, e.g. `National Institute of Food and Agriculture` |
| `departmentCode` / `departmentName` | Parent department, e.g. `USDA` / `Department of Agriculture` (detail only) |
| `status` | `posted`, `forecasted`, `closed` or `archived` |
| `docType` | `synopsis` (a real posting) or `forecast` (announced in advance) |
| `opportunityCategory` | `Discretionary`, `Mandatory`, `Continuation`, `Earmark`, ... (detail only) |
| `openDate` | Date applications open, `YYYY-MM-DD`. For a forecast, the estimated posting date |
| `closeDate` | Application due date, `YYYY-MM-DD`, or `null` when the agency published none |
| `archiveDate` | Date the opportunity leaves the active list (detail only; always `null` for forecasts) |
| `lastUpdatedDate` | Date the agency last revised the synopsis or forecast (detail only) |
| `alns` | Assistance Listing Numbers (the former CFDA numbers), e.g. `["10.443"]` |
| `alnTitles` | The matching programme titles (detail only) |
| `fundingCategories` | Funding-activity categories, e.g. `["Agriculture"]` (detail only) |
| `fundingInstruments` | `Grant`, `Cooperative Agreement`, `Procurement Contract`, `Other` (detail only) |
| `eligibleApplicants` | Applicant types the agency will accept, in full text (detail only) |
| `awardCeiling` / `awardFloor` | Largest and smallest single award, in USD (detail only) |
| `estimatedTotalFunding` | Total programme funding, in USD (detail only) |
| `expectedNumberOfAwards` | How many awards the agency expects to make (detail only) |
| `costSharingRequired` | `true`, `false`, or `null` when unstated (detail only) |
| `description` | The synopsis or forecast text, HTML stripped, trimmed to 2,000 characters (detail only) |
| `contactName` / `contactEmail` / `contactPhone` | The agency contact published on the notice (detail only). Where the agency leaves the email field empty and writes the mailbox into the free-text contact description instead - 30 of 400 records sampled, State Department notices in particular - the address is taken from that text, and a value published as `Email: x@agency.gov` is reduced to the address itself |
| `fetchedAt` | ISO timestamp of the run that produced the record |

Fields marked *detail only* come from the second API call and are `null` (or `[]`) when `includeDetails` is `false`. The dataset has three views: **Overview** (dates, agency, ALN, award sizes, link), **Agency contacts** (name, email, phone) and **Eligibility and terms** (applicant types, instruments, cost sharing, archive date).

### Input

| Input | Type | Default | Description |
| --- | --- | --- | --- |
| `statuses` | string\[] | `["posted"]` | Any of `posted` (open now), `forecasted` (announced in advance), `closed` (due date passed), `archived` (historical back-catalogue). |
| `daysBack` | integer | `30` | Look-back window in days on `openDate`, ending today. Ignored when `dateFrom`/`dateTo` are set. Max 9,000, which reaches the start of the archive (22 March 2004). |
| `dateFrom` | string | - | Start of the open-date window, `YYYY-MM-DD`, inclusive. |
| `dateTo` | string | today | End of the open-date window, `YYYY-MM-DD`, inclusive. |
| `keywords` | string\[] | none | Passed to the Grants.gov full-text search (title, opportunity number, agency, description). Terms are ORed; a term with spaces is searched as an exact phrase. |
| `agencies` | string\[] | all | Grants.gov agency codes. A department code keeps every sub-agency under it: `HHS` matches `HHS-NIH11` and `HHS-HRSA`. |
| `fundingCategories` | string\[] | all | Funding-activity codes: `HL` health, `ED` education, `ENV` environment, `ST` science and R\&D, `AG` agriculture, `EN` energy, and 22 more (see the input form). |
| `eligibilities` | string\[] | all | Applicant-type codes: `23` small businesses, `12` 501(c)(3) nonprofits, `06` public higher education, `00` state governments, and 13 more. |
| `fundingInstruments` | string\[] | all | `G` grant, `CA` cooperative agreement, `PC` procurement contract, `O` other. |
| `alnPrefixes` | string\[] | all | ALN (CFDA) numbers or prefixes. `93` = Health and Human Services, `47` = NSF, `84` = Education, `10` = Agriculture; `93.310` picks one programme. |
| `includeDetails` | boolean | `true` | Call `fetchOpportunity` once per kept opportunity for the synopsis, money, eligibility and contact fields. |
| `maxItems` | integer | `200` | Stop after this many opportunities. You are charged per opportunity, so this is also the cost cap. Newest open date first, so a value below the window's volume drops the **oldest** opportunities in the window. |

Example - open NIH and other HHS health grants from the last 90 days that a small business can apply for:

```json
{
  "statuses": ["posted"],
  "daysBack": 90,
  "agencies": ["HHS"],
  "eligibilities": ["23"],
  "alnPrefixes": ["93"],
  "maxItems": 200
}
```

Example - a daily watch on everything new, including forecasts, run on a schedule:

```json
{ "statuses": ["posted", "forecasted"], "daysBack": 3, "maxItems": 100 }
```

Example - the fast bulk mode: every opportunity opened in the last year, headline fields only:

```json
{ "statuses": ["posted", "forecasted", "closed", "archived"], "daysBack": 365, "includeDetails": false, "maxItems": 5000 }
```

Bad input fails fast: an unknown status, agency code, category, eligibility code, funding instrument, ALN prefix or malformed date stops the run with the validation message as its status, before any request is made.

### Output example

A real record from a live run on 8 September 2026 (`{"daysBack": 14, "maxItems": 6, "includeDetails": true}`), unedited:

```json
{
  "id": "363816",
  "source": "grants.gov",
  "url": "https://www.grants.gov/search-results-detail/363816",
  "opportunityNumber": "USDA-NIFA-ICGP-012261",
  "title": "Outreach and Assistance for Veteran Farmers and Ranchers Program",
  "agencyCode": "USDA-NIFA",
  "agencyName": "National Institute of Food and Agriculture",
  "departmentCode": "USDA",
  "departmentName": "Department of Agriculture",
  "status": "posted",
  "docType": "synopsis",
  "opportunityCategory": "Discretionary",
  "openDate": "2026-09-04",
  "closeDate": "2026-09-10",
  "archiveDate": "2026-10-10",
  "lastUpdatedDate": "2026-09-04",
  "alns": ["10.443"],
  "alnTitles": ["Outreach and Assistance for Veteran Farmers and Ranchers Program"],
  "fundingCategories": ["Agriculture"],
  "fundingInstruments": ["Grant"],
  "eligibleApplicants": ["Others (see text field entitled \"Additional Information on Eligibility\" for clarification)"],
  "awardCeiling": 1500000,
  "awardFloor": 250000,
  "estimatedTotalFunding": 23800000,
  "expectedNumberOfAwards": 36,
  "costSharingRequired": false,
  "description": "The purpose of the OAVFR program, under assistance listing number 10.443, is to assist Veterans in owning and operating farms and ranches and to ensure they are knowledgeable and participating in full range of USDA programs. With OAVFR funding, recipient organizations can provide outreach, technical assistance, and education in agriculture, agribusiness, forestry, and agricultural-related services. The program encourages technical assistance with accessing USDA programs, which includes working with local USDA Service Centers (Farm Service Agency, Natural Resources Conservation Service, and Rural Development).",
  "contactName": "Joseph Perez Lead Policy Analyst",
  "contactEmail": "grantapplicationquestions@usda.gov",
  "contactPhone": "202-445-5402",
  "fetchedAt": "2026-09-08T02:19:09.244Z"
}
```

A forecast from the same API looks the same but carries `"status": "forecasted"`, `"docType": "forecast"`, `"archiveDate": null`, an `openDate` that is the *estimated* posting date and a `closeDate` that is the *estimated* application due date - for example opportunity `363800`, `RFA-RM-28-004`, "NIH Director's Early Independence Award (DP5 Clinical Trial Optional)", `openDate` 2026-09-03, `closeDate` 2027-09-10, `awardCeiling` 350000, `estimatedTotalFunding` 5700000.

Every run also writes a `SUMMARY` record to the key-value store with the resolved date window, the filters used, how many hits each filter dropped, the number of pages read, any failed detail calls, and the two completeness flags `limitReached` and `windowExhausted` (see *Limits and freshness*).

### Pricing

Pay per result: **US$0.003 per opportunity delivered** (US$3 per 1,000 opportunities). You are charged only for records pushed to the dataset; a run that returns nothing costs nothing. Runs on the Apify free plan are limited by the platform's free-tier usage allowance.

### Data source and licence

- Search: `POST https://api.grants.gov/v1/api/search2`. Details: `POST https://api.grants.gov/v1/api/fetchOpportunity`. Both are public and, in the words of the Grants.gov API guide, "Authentication and authorization are not required" for them. Documentation: <https://www.grants.gov/api/api-guide> (read 8 September 2026).
- **Licence.** A funding notice on Grants.gov is written by federal agency staff as part of their official duties, which makes it a US Government work: not subject to domestic copyright under 17 U.S.C. § 105, and free to reuse commercially. The Grants.gov entry in the federal data.gov catalogue (<https://catalog.data.gov/dataset/grants-gov>, identifier `US-GOV-SSA-386`, registered by the Social Security Administration) lists its licence as the bare URL <https://www.usa.gov/government-copyright> - the standard U.S. Government Work terms. That catalogue entry is a metadata registration only: it publishes no distribution of its own and carries the DCAT flag `Access Level: non-public`, which says the *catalogue* offers no download, not that the API is restricted - the Grants.gov API guide above is explicit that these two endpoints need no authentication. Both pages read 8 September 2026.
- The two restrictions <https://www.usa.gov/government-copyright> does state: you may not use government material in a way that implies endorsement by a government agency, official or employee, and you may not use federal government trademarks or agency logos without permission. Attribute as "Source: Grants.gov" and link to the opportunity page.
- **Personal data.** `contactName`, `contactEmail` and `contactPhone` are the programme contact each agency publishes on its own funding notice - a named federal employee's work contact details, or a shared programme mailbox such as `grantapplicationquestions@usda.gov`. The agency publishes them so applicants can ask questions about that opportunity. Using them for anything else, marketing in particular, is the buyer's responsibility under the applicable regime (CAN-SPAM in the US, GDPR/PECR if you are contacting from or into the EU/UK). Some agencies also paste names into `description`.

### Limits and freshness

- **Volumes, measured 8 September 2026** by running this Actor over each window (`includeDetails: false`): opportunities with an open date in the last **30 days** - 183 posted, 62 forecasted, 44 closed, 6 archived, **295 in total**; last **7 days** - 51 posted; last **90 days** - 332 posted; last **365 days** - 527 posted and **2,525 across all four statuses**. Roughly **10 new opportunities a calendar day**, concentrated on business days. The whole archive on that date was 83,368 records (1,024 posted, 561 forecasted, 8,701 closed, 73,082 archived) going back to an open date of 22 March 2004, so `{"statuses": ["posted", "forecasted", "closed", "archived"], "dateFrom": "2004-01-01", "includeDetails": false, "maxItems": 100000}` is a complete historical download.
- **Size `maxItems` to the window, and check `windowExhausted`.** `maxItems` counts records *kept after filtering* and the stream is newest-first, so a value below the window's volume drops the **oldest** opportunities in it - but never silently. The run stops the moment the cap is filled and warns `maxItems (N) reached before the window was exhausted`, and the `SUMMARY` record carries `limitReached: true` with `windowExhausted: false`. `windowExhausted: true` is the guarantee that you hold the complete window: it is set only when the Actor read past the start of the window (or reached the end of the API's results) with no in-window opportunity left unread and every record it kept delivered. The default 200 covers a 30-day posted-only window with room to spare; a full year of all statuses needs about 2,600.
- **Speed, measured 8 September 2026.** With `includeDetails: true` the Actor delivered 100 opportunities in 22.5 s (about 4.4 a second, capped by its own detail-request throttle). With `includeDetails: false` it delivered 500 in 3.4 s. A full-year, all-status, no-detail run of 2,525 records takes well under a minute; at the same measured rates the run with details would take about ten minutes.
- **Rate limits.** Grants.gov documents none for these two endpoints, and 15 consecutive `fetchOpportunity` calls with no pacing all returned HTTP 200 (measured 8 September 2026). The Actor still caps detail calls at 5 per second and retries 429 and 5xx responses with exponential back-off, honouring `Retry-After`.
- **Paging.** Search results come 500 rows per request, sorted by open date descending; paging stops as soon as a page runs past the start of your window, the API runs out of results, or `maxItems` is filled - so a capped run never fetches a page, or a detail record, that it cannot deliver. The API itself returned 5,000 rows in one response in testing, so 500 is a deliberately conservative page size, not a ceiling.
- **The `dateRange` API parameter is deliberately not used.** Sending it makes the API ignore `oppStatuses`: on 8 September 2026, `{"oppStatuses": "closed", "dateRange": "30"}` returned *posted* opportunities. This Actor therefore filters the open-date window itself, on the `openDate` the API returns for every hit. In 11,585 hits sampled across all four statuses, every single one had an open date.
- **`agencies` and `alnPrefixes` are matched locally**, on the `agencyCode` and ALN the search returns, because the API's own `agencies` parameter needs an exact leaf code (`USDOJ` returns nothing, `USDOJ-OJP-BJA` returns 20) and its `cfda` parameter takes one full ALN and no prefixes. Local matching is what lets `HHS` and `93` behave as you would expect. `keywords`, `fundingCategories`, `eligibilities` and `fundingInstruments` are applied by the API itself.
- **Text arrives decoded, not raw.** Agencies type their notices into an HTML editor and the character references leak out of the synopsis into the plain fields: on 8 September 2026, **786 of the 11,585 titles** the API returns across the four statuses carried at least one, and 10 of the 183 records in this Actor's default 30-day posted run did (`&ndash;` is the commonest, then `&rsquo;`, `&amp;`, `&nbsp;` and `&mdash;`, plus Latin-1 names such as `&ocirc;` and `&uuml;` and numeric ones such as `&#332;`). Both endpoints send the identical encoded string, so `includeDetails` is not a repair path. Every text field this Actor publishes is decoded - named, numeric and hexadecimal references, and twice over where the agency itself encoded twice (`Children&amp;rsquo;s Advocacy Centers` becomes `Children’s Advocacy Centers`). `&nbsp;` becomes a real space so neighbouring words do not run together, zero-width marks and soft hyphens are dropped so exact matching on a title works, and a reference the table does not know is left exactly as published rather than mangled. `description` additionally has its HTML tags stripped, keeping the paragraph breaks.
- **Missing values are the agency's, not the Actor's.** 84 of the 1,024 posted opportunities published no `closeDate`, and all 561 forecasts leave it to the detail record's estimated response date; 1 posted and 11 of 5,000 archived opportunities carry no ALN; `estimatedTotalFunding`, `awardCeiling` and `awardFloor` are frequently absent. These stay `null` rather than being guessed. `contactEmail` is the one field the Actor will read out of free text: of 400 detail records sampled on 8 September 2026, 30 left `agencyContactEmail` empty and put the mailbox in the contact description instead, and 2 filled it with something that is not an address at all (an opportunity number), which the Actor returns as `null` rather than as a fake contact. With that handling, 149 of the 150 records in a live 30-day posted-and-forecast run carried a well-formed contact email and none carried a malformed one.
- **Freshness.** Agencies post on business days. Measured 8 September 2026: the newest posted opportunity in the API had an open date of 2026-09-07, and 51 opportunities had opened in the previous 7 days. Publication lag was not separately measured, so run an overlapping window (`daysBack: 3` daily) rather than a window that exactly abuts the previous run. Dates are calendar dates as Grants.gov publishes them (US Eastern), with no time component. An opportunity is revised in place, so re-run with an overlapping window and use `lastUpdatedDate` to spot changes.

### Use cases

- **Grant pipeline for a nonprofit, university or small business:** a scheduled daily run over your ALN prefixes and eligibility code, with `awardCeiling`, `closeDate` and the programme officer's email already on the record, so a bid/no-bid call takes minutes.
- **Grant-consultancy and RFP-response lead generation:** watch `forecasted` opportunities to reach applicants months before the notice is posted, and use `agencyCode`, `estimatedTotalFunding` and `expectedNumberOfAwards` to size the market.
- **Federal funding research and dashboards:** download the full 83,000-record archive with `{"statuses": ["archived", "closed"], "dateFrom": "2004-01-01", "includeDetails": false, "maxItems": 100000}` and analyse funding by department, ALN, category or award size back to March 2004.

### Support

Open an issue on the Actor's Issues tab on Apify Store. Replies within 14 days. Bug reports that name the run id and the input used are fixed fastest.

# Actor input Schema

## `statuses` (type: `array`):

Which opportunity states to return. Posted = open for applications; Forecasted = announced in advance, not yet posted; Closed = past its due date but not yet archived; Archived = removed from the active list (the whole historical back-catalogue, about 73,000 records). Default: posted.

## `daysBack` (type: `integer`):

Look-back window in days on the opportunity's open date (for a forecast, its estimated posting date), ending today. Ignored when Date from / Date to are set. The archive starts on 22 March 2004, so 9000 covers everything Grants.gov holds.

## `dateFrom` (type: `string`):

Start of the open-date window, YYYY-MM-DD (inclusive). Overrides Days back.

## `dateTo` (type: `string`):

End of the open-date window, YYYY-MM-DD (inclusive). Defaults to today.

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

Terms passed to the Grants.gov full-text search, which covers the title, opportunity number, agency and description. Terms are ORed; a term containing spaces is searched as an exact phrase. Empty = no keyword filter.

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

Grants.gov agency codes. A department code keeps every sub-agency under it: HHS matches HHS-NIH11 and HHS-HRSA, USDOJ matches USDOJ-OJP-BJA. Common codes: HHS, NSF, DOE, DOD, USDA, ED, EPA, DOI, DOS, DOT, HUD, USDOJ, DOL, DHS, NASA, NEA, NEH, SBA, VA, USAID. Empty = all agencies.

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

Grants.gov funding-activity categories. Empty = all categories.

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

Keep only opportunities open to at least one of these applicant types. Empty = all types.

## `fundingInstruments` (type: `array`):

Keep only opportunities offering these award types. Empty = all instruments.

## `alnPrefixes` (type: `array`):

Assistance Listing Numbers or their prefixes. Two digits selects a department (93 = Health and Human Services, 47 = National Science Foundation, 84 = Education, 10 = Agriculture, 81 = Energy, 66 = EPA, 16 = Justice, 20 = Transportation, 14 = HUD); the full number selects one programme (93.310). An opportunity is kept when any of its ALNs starts with any prefix. Empty = all.

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

Call the Grants.gov fetchOpportunity endpoint once per kept opportunity to add the synopsis text, award ceiling and floor, estimated total funding, expected number of awards, cost-sharing flag, eligible applicant types, funding categories and instruments, archive date and the agency contact name, email and phone. Turning this off makes the run far faster - measured 8 September 2026: 500 records in 3.4 s with details off, 100 records in 22.5 s with them on - but leaves those fields null.

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

Stop after this many opportunities. You are charged per opportunity delivered, so this is also the cost cap. Newest open date first, so a value below the window's volume drops the OLDEST opportunities in the window. Measured on 8 September 2026: 30 days of posted opportunities is about 180 records, 30 days of all four statuses about 295, a full year of all four about 2,525.

## Actor input object example

```json
{
  "statuses": [
    "posted"
  ],
  "daysBack": 30,
  "keywords": [],
  "agencies": [],
  "fundingCategories": [],
  "eligibilities": [],
  "fundingInstruments": [],
  "alnPrefixes": [],
  "includeDetails": true,
  "maxItems": 200
}
```

# Actor output Schema

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

All opportunities returned by the run, one JSON object each. Append ?format=csv or ?format=xlsx to download a spreadsheet.

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

Counts, the open-date window used, the filters applied, how many hits each filter dropped and any detail-fetch failures, written at the end of the 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 = {
    "statuses": [
        "posted"
    ],
    "daysBack": 30,
    "keywords": [],
    "agencies": [],
    "fundingCategories": [],
    "eligibilities": [],
    "fundingInstruments": [],
    "alnPrefixes": [],
    "includeDetails": true,
    "maxItems": 200
};

// Run the Actor and wait for it to finish
const run = await client.actor("knotty_mistveil/grants-gov-opportunities").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 = {
    "statuses": ["posted"],
    "daysBack": 30,
    "keywords": [],
    "agencies": [],
    "fundingCategories": [],
    "eligibilities": [],
    "fundingInstruments": [],
    "alnPrefixes": [],
    "includeDetails": True,
    "maxItems": 200,
}

# Run the Actor and wait for it to finish
run = client.actor("knotty_mistveil/grants-gov-opportunities").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 '{
  "statuses": [
    "posted"
  ],
  "daysBack": 30,
  "keywords": [],
  "agencies": [],
  "fundingCategories": [],
  "eligibilities": [],
  "fundingInstruments": [],
  "alnPrefixes": [],
  "includeDetails": true,
  "maxItems": 200
}' |
apify call knotty_mistveil/grants-gov-opportunities --silent --output-dataset

```

## MCP server setup

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

```

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/1FeVaGX1EmFuGTf5c/builds/nJt4yL5IW3mnBr8FY/openapi.json
