# DCAT / data.json Open-Data Catalog Harvester (`datamule/dcat-datajson-harvester`) Actor

Point at ANY DCAT / Project-Open-Data data.json (energy.gov, NASA, CDC & 100s of gov portals) and harvest every dataset's metadata — title, publisher, contact, accessLevel, landing page, downloads + full distribution\[] + raw. Streams even huge feeds. Pay per dataset.

- **URL**: https://apify.com/datamule/dcat-datajson-harvester.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 dataset harvesteds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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

## DCAT / data.json Open-Data Catalog Harvester

A **generic "point at any DCAT / Project-Open-Data `data.json` catalog" harvester**. Under the
U.S. [Project Open Data](https://resources.data.gov/resources/pods/) mandate, every federal agency
(and many state, city and international portals) publishes a machine-readable
[DCAT](https://www.w3.org/TR/vocab-dcat-2/) catalog at a `…/data.json` URL that lists **every
dataset it holds**. They all share the identical envelope
(`{"@type": "dcat:Catalog", "dataset": [ … ]}`), so **one actor harvests the whole open-data
estate** — no per-portal scraper needed.

Give it a `data.json` URL (or several, or pick from the built-in agency registry), optionally
filter by a keyword, and it turns each catalog entry into a clean, flat dataset row plus a
lossless `raw` copy — **streaming** the file so even a 71 MB catalog is harvested in a few MB of
RAM.

One actor, every DCAT catalog.

### What it does

- **Harvest a catalog** — point `dataUrl` at any `data.json` and it walks the `dataset[]` array,
  emitting one row per dataset: `title`, `description`, `identifier`, `accessLevel`, `issued` /
  `modified`, `publisher`, `contactPoint` + `contactEmail`, `landingPage`, `license`, `keyword[]`,
  `theme[]`, the first `downloadURL` + `format`, the `distributionCount`, the **full
  `distribution[]` array**, and a lossless **`raw`** copy of the whole dataset object.
- **Harvest many at once** — pass a `dataUrls` list, an `agencies` list, or `allAgencies` to sweep
  several catalogs in one run. The `maxRecords` cap applies across all sources together.
- **Keyword filter** — set `keyword` to keep only datasets whose title, description, identifier,
  `keyword[]` or `theme[]` match (case-insensitive).
- **Streams, never loads-all** — the catalog is parsed incrementally, so huge feeds (e.g. NASA's
  71 MB `data.json`) are safe and `maxRecords` stops early without downloading the rest.

### Example inputs

Harvest the U.S. Department of Energy catalog (small, clean, ~480 datasets):

```json
{ "dataUrl": "https://www.energy.gov/data.json", "maxRecords": 1000 }
````

Only climate-related datasets from NASA's (large) catalog:

```json
{ "dataUrl": "https://data.nasa.gov/data.json", "keyword": "climate", "maxRecords": 500 }
```

Sweep several agencies from the built-in registry in one run:

```json
{ "agencies": ["energy", "cdc", "nsf"], "maxRecords": 2000 }
```

Any DCAT catalog you like — point at your own:

```json
{ "dataUrls": ["https://data.cdc.gov/data.json", "https://www.justice.gov/data.json"] }
```

### Input reference

- `dataUrl` — a single DCAT / Project-Open-Data `data.json` URL.
- `dataUrls` — a list of `data.json` URLs to harvest together.
- `agencies` — pick from the built-in US-federal registry: `energy`, `nasa`, `cdc`, `doj`, `nsf`,
  `opm`, `sba`, `treasury`.
- `allAgencies` — harvest every agency in the built-in registry.
- `keyword` — optional case-insensitive keyword filter.
- `maxRecords` — total dataset cap across all sources (default 1000). Each returned dataset is one
  billable event.
- `bearerToken` / `extraHeaders` — optional, for gated catalogs; never required, never logged.

> **Tip:** do **not** use `https://catalog.data.gov/data.json` — that aggregated endpoint 404s
> behind Cloudflare. Use the individual agency catalogs (like `https://www.energy.gov/data.json`),
> which are the actual Project-Open-Data source of record.

### Output

One dataset row per catalog entry, with normalized columns plus:

- `distribution` — the full array of distributions (each a `downloadURL` / `accessURL`, `format`,
  `mediaType`, `title`, …), and `downloadURL` / `format` / `distributionCount` summarizing it.
- `publisher` (name) and `publisherObject` (the full nested organization), `contactPoint` +
  `contactEmail`.
- `_sourceUrl` / `_catalogTitle` — which catalog the row came from.
- `raw` — the complete, untouched DCAT dataset object.

A catalog with no matching datasets returns **0 rows, not an error**. A wrong URL that returns a
404 / Cloudflare / HTML page fails fast with a clear message.

### Pricing

**Pay per dataset** — one `dataset` event per row returned. A run that matches nothing costs
nothing.

### Notes

- Reads the DCAT-US / Project-Open-Data 1.1 `data.json` schema; scope is catalog **metadata**
  (what datasets exist and where to get them), not the underlying data files.
- Streams with an incremental JSON parser, so large catalogs never blow memory.
- Not affiliated with or endorsed by any agency or portal. Respect each provider's terms and any
  per-dataset licensing.

# Actor input Schema

## `dataUrl` (type: `string`):

The URL of ANY DCAT / Project-Open-Data catalog `data.json`. Every US federal agency (and many state, city and international portals) publishes one. Examples: https://www.energy.gov/data.json, https://data.nasa.gov/data.json, https://data.cdc.gov/data.json. Do NOT use https://catalog.data.gov/data.json — it 404s behind Cloudflare. Leave empty if you use the Agencies picker or a data.json URL list below.

## `dataUrls` (type: `array`):

Harvest several catalogs in one run — a list of data.json URLs. Combined with the single URL above and the Agencies picker; duplicates are removed. The Max records cap applies across ALL sources together.

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

Convenience shortcut: pick from a small built-in registry of verified US-federal agency catalogs instead of typing URLs. Allowed keys: energy, nasa, cdc, doj, nsf, opm, sba, treasury. (The primary way to use this actor is still the data.json URL field — this registry just saves typing for common agencies.)

## `allAgencies` (type: `boolean`):

When on, harvest every agency in the built-in registry (energy, nasa, cdc, doj, nsf, opm, sba, treasury). The Max records cap still applies across all of them. Ignored if you provide your own URLs.

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

Optional case-insensitive keyword. Only datasets whose title, description, identifier, keyword\[] or theme\[] contain this text are returned. Leave empty to harvest every dataset in the catalog. Example: climate, budget, health.

## `maxRecords` (type: `integer`):

Maximum total number of datasets to return across all sources (the actor streams the catalog and stops at this cap — it never loads the whole file into memory, so even the 71 MB NASA feed is safe). Each returned dataset is one billable event. Default 25.

## `bearerToken` (type: `string`):

Optional OAuth2 bearer token for a gated catalog. Sent as Authorization: Bearer \*\*\*. NOT required for public government catalogs — leave empty. Never logged.

## `extraHeaders` (type: `object`):

Optional extra HTTP headers to send with every request, as a JSON object, e.g. {"Ocp-Apim-Subscription-Key": "..."} for a gated deployment. Leave empty for public catalogs.

## Actor input object example

```json
{
  "dataUrl": "https://www.energy.gov/data.json",
  "agencies": [],
  "allAgencies": false,
  "maxRecords": 25
}
```

# Actor output Schema

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

No description

# 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 = {
    "dataUrl": "https://www.energy.gov/data.json",
    "agencies": [],
    "maxRecords": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/dcat-datajson-harvester").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 = {
    "dataUrl": "https://www.energy.gov/data.json",
    "agencies": [],
    "maxRecords": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/dcat-datajson-harvester").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "dataUrl": "https://www.energy.gov/data.json",
  "agencies": [],
  "maxRecords": 25
}' |
apify call datamule/dcat-datajson-harvester --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamule/dcat-datajson-harvester",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "DCAT / data.json Open-Data Catalog Harvester",
        "description": "Point at ANY DCAT / Project-Open-Data data.json (energy.gov, NASA, CDC & 100s of gov portals) and harvest every dataset's metadata — title, publisher, contact, accessLevel, landing page, downloads + full distribution[] + raw. Streams even huge feeds. Pay per dataset.",
        "version": "0.1",
        "x-build-id": "tTvOieMJdrY9FrJnm"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datamule~dcat-datajson-harvester/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datamule-dcat-datajson-harvester",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/datamule~dcat-datajson-harvester/runs": {
            "post": {
                "operationId": "runs-sync-datamule-dcat-datajson-harvester",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/datamule~dcat-datajson-harvester/run-sync": {
            "post": {
                "operationId": "run-sync-datamule-dcat-datajson-harvester",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "dataUrl": {
                        "title": "data.json URL",
                        "type": "string",
                        "description": "The URL of ANY DCAT / Project-Open-Data catalog `data.json`. Every US federal agency (and many state, city and international portals) publishes one. Examples: https://www.energy.gov/data.json, https://data.nasa.gov/data.json, https://data.cdc.gov/data.json. Do NOT use https://catalog.data.gov/data.json — it 404s behind Cloudflare. Leave empty if you use the Agencies picker or a data.json URL list below."
                    },
                    "dataUrls": {
                        "title": "data.json URLs (multiple)",
                        "type": "array",
                        "description": "Harvest several catalogs in one run — a list of data.json URLs. Combined with the single URL above and the Agencies picker; duplicates are removed. The Max records cap applies across ALL sources together.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "agencies": {
                        "title": "US federal agencies (built-in registry)",
                        "type": "array",
                        "description": "Convenience shortcut: pick from a small built-in registry of verified US-federal agency catalogs instead of typing URLs. Allowed keys: energy, nasa, cdc, doj, nsf, opm, sba, treasury. (The primary way to use this actor is still the data.json URL field — this registry just saves typing for common agencies.)",
                        "items": {
                            "type": "string"
                        }
                    },
                    "allAgencies": {
                        "title": "Harvest all built-in agencies",
                        "type": "boolean",
                        "description": "When on, harvest every agency in the built-in registry (energy, nasa, cdc, doj, nsf, opm, sba, treasury). The Max records cap still applies across all of them. Ignored if you provide your own URLs.",
                        "default": false
                    },
                    "keyword": {
                        "title": "Keyword filter",
                        "type": "string",
                        "description": "Optional case-insensitive keyword. Only datasets whose title, description, identifier, keyword[] or theme[] contain this text are returned. Leave empty to harvest every dataset in the catalog. Example: climate, budget, health."
                    },
                    "maxRecords": {
                        "title": "Max records (total)",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum total number of datasets to return across all sources (the actor streams the catalog and stops at this cap — it never loads the whole file into memory, so even the 71 MB NASA feed is safe). Each returned dataset is one billable event. Default 25.",
                        "default": 25
                    },
                    "bearerToken": {
                        "title": "Bearer token (optional)",
                        "type": "string",
                        "description": "Optional OAuth2 bearer token for a gated catalog. Sent as Authorization: Bearer ***. NOT required for public government catalogs — leave empty. Never logged."
                    },
                    "extraHeaders": {
                        "title": "Extra request headers",
                        "type": "object",
                        "description": "Optional extra HTTP headers to send with every request, as a JSON object, e.g. {\"Ocp-Apim-Subscription-Key\": \"...\"} for a gated deployment. Leave empty for public catalogs."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
