# Data.gov Dataset Scraper (`parseforge/data-gov-scraper`) Actor

Scrapes Data.gov catalog search results by keyword or URL. Returns each dataset as a flat row with title, description, publisher, formats, and metadata. Export to CSV, JSON, Excel, or XML.

- **URL**: https://apify.com/parseforge/data-gov-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Business, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 23 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $5.50 / 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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner-v4.webp)](https://apify.com/parseforge?fpr=vmoqkp)

### Data.gov Dataset Scraper

**Scrape the Data.gov catalog by any search term, up to a million datasets per run.** Every dataset comes with its title, description, publisher, formats, and metadata. No API key. Export to CSV, JSON, Excel, or XML.

Data.gov is the U.S. government's open data portal, but browsing it by hand means clicking through thousands of pages. This Actor reads the public catalog search directly, so you can pull every dataset that matches a keyword, sorted by relevance, popularity, or date, into one flat table.

| Who uses it | What they scrape Data.gov for |
|---|---|
| Data journalists | Find federal datasets on a beat, like climate or health, without manual browsing. |
| Researchers | Build a corpus of government datasets for a systematic review or meta-analysis. |
| Open data advocates | Monitor what new datasets a topic area publishes each week. |
| Data engineers | Feed a pipeline with fresh catalog metadata for a data discovery tool. |

### What it does

This Actor collects Data.gov dataset records by search query or catalog URL, and returns each dataset as one flat row with its metadata.

- 🔎 **Search by keyword:** type any term, like "air quality" or "medicare", and get every matching dataset.
- 🔗 **Start from a URL:** paste a Data.gov search URL and the Actor extracts the query for you.
- 📊 **Sort your results:** order by relevance, popularity, last published date, or date added.
- 📦 **Cap the output:** set a maximum from 1 to 1,000,000 datasets per run.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with Data.gov data

**📰 Build a federal data beat.**

A journalist searches "climate change" and exports the latest datasets to spot new sources for a story.

**🧪 Assemble a research corpus.**

A researcher pulls every dataset matching "air quality" to list available measurements for a meta-analysis.

**📈 Monitor open data releases.**

An open data advocate runs the Actor weekly with a topic query to track newly published datasets.

**🔧 Feed a data catalog.**

A data engineer scrapes the full catalog for a keyword and loads the rows into an internal discovery tool.

### Why choose this scraper

|  | What you get |
|---|---|
| **No API key** | Reads the public catalog search, so you start scraping in one click. |
| **Flat rows** | Each dataset is one row, ready for CSV, JSON, Excel, or XML export. |
| **Full metadata** | Title, description, publisher, formats, and more come with every record. |
| **Scale** | Collect up to a million datasets in a single run. |

### How it compares

No other Store actor targets Data.gov the same way, so the honest comparison is with the alternatives teams actually weigh.

| | Data.gov Dataset Scraper | Build it in-house | By hand |
|---|---|---|---|
| Setup | Run it now, zero config | Days of engineering | None, but hours per pull |
| When Data.gov changes | Maintained for you | You fix it | You re-learn the page |
| Proxies, retries, anti-bot | Built in | Your problem | Browser only |
| Output | Fixed JSON schema, CSV/Excel export | Whatever you build | Copy-paste |
| Cost | Pay per result | Engineering time | Analyst hours |

### Configure the run

Drive the Actor from a search term or a Data.gov search URL, and set a sort order and a maximum number of datasets to collect. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "searchQuery": "climate change",
  "maxItems": 25
}
```

A larger pull:

```json
{
  "searchQuery": "climate change",
  "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.00825 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $0.83 |
| 1,000 results | $8.25 |
| 10,000 results | $82.50 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [Data.gov Dataset Scraper](https://apify.com/parseforge/data-gov-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to Data.gov through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/data-gov-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check your search term. Try a broader keyword or remove special characters. Also verify that the startUrl, if used, contains a valid q parameter.

**The run stops before reaching my maxItems.**

The catalog may have fewer matching datasets than your maximum. Try a more general search term or lower the sort to relevance.

**Some fields are empty in the output.**

Not every dataset on Data.gov has all metadata fields. Empty values mean the catalog did not provide that field for that record.

**The run takes a long time.**

Large maxItems values mean more requests. Reduce the maximum or narrow your search term to speed up the run.

**I get an error when using a startUrl.**

Make sure the URL is a Data.gov search URL with a q parameter, like https://catalog.data.gov/dataset?q=water. Other URLs are not supported.

### FAQ

| Question | Answer |
|---|---|
| Do I need a Data.gov API key? | No. This Actor reads the public catalog search pages directly, so there is no registration or key required. |
| What does each row in the output contain? | Each row is one dataset with its title, description, publisher, formats, and other metadata fields from the catalog. |
| Can I scrape all datasets on Data.gov? | Yes, if you set a high maximum and use a broad search term, the Actor can collect up to one million datasets per run. |
| How do I sort the results? | Use the sort input to order by relevance, popularity, last published date, or date added. |
| Can I start from a Data.gov search URL instead of a keyword? | Yes, paste a URL like https://catalog.data.gov/dataset?q=water into the startUrl field and the Actor will use its query. |
| What export formats are supported? | You can export the results to CSV, JSON, Excel, or XML from the Apify dataset. |
| Is this Actor affiliated with Data.gov? | No, this is an independent scraper built on the public catalog. It is not operated by the U.S. General Services Administration. |
| How often is the data updated? | The Actor reads the live catalog on each run, so you get the current metadata as of the run time. |
| Can I filter by dataset format, like CSV or GeoJSON? | The Actor returns all matching datasets with their format list. You can filter the output afterward by the formats field. |
| What is the maximum number of datasets I can collect? | You can set maxItems up to 1,000,000 datasets per run. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by U.S. General Services Administration. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `searchQuery` (type: `string`):

Keyword(s) to search the Data.gov catalog, e.g. "climate change", "air quality", "medicare".

## `sort` (type: `string`):

How to order results.

## `startUrl` (type: `string`):

Optional. A Data.gov search URL (e.g. https://catalog.data.gov/dataset?q=water). Its "q" is used as the search query.

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

How many datasets to collect per run.

## Actor input object example

```json
{
  "searchQuery": "climate change",
  "sort": "relevance",
  "maxItems": 25
}
```

# Actor output Schema

## `datasets` (type: `string`):

Complete dataset with all fields including organization information, publisher details, topics, formats, download links, and metadata

## `overview` (type: `string`):

Overview view of datasets with key fields displayed in a table format

# 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 = {
    "searchQuery": "climate change",
    "maxItems": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/data-gov-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 = {
    "searchQuery": "climate change",
    "maxItems": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/data-gov-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 '{
  "searchQuery": "climate change",
  "maxItems": 25
}' |
apify call parseforge/data-gov-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/data-gov-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/hv3dpXV0H7rmkYxCg/builds/xU3KbQxVfPYj5XIC5/openapi.json
