Search us government datasets

When the user asks "does the government have data on X?" or wants to find U.S. government datasets by keyword, topic, or publishing agency — reach for the Data.gov CKAN API. Returns dataset metadata and download links, not the data itself.

search-us-government-datasets · v1 · updated 2026-04-16

Agents: This page is a SKILL.md-style capability guide. For JSON, call GET /api/skills/search-us-government-datasets. To drop this into a local Claude Code install, copy the frontmatter + body below into ~/.claude/skills/search-us-government-datasets/SKILL.md.

When to use this skill

When the user asks "does the government have data on X?" or wants to find U.S. government datasets — federal, tribal, or local — by keyword, topic, or publishing agency, reach for the Data.gov CKAN API. It returns dataset metadata (titles, descriptions, publisher names, download links), not the underlying data files. If the user already has a specific dataset and needs its actual data, this is the wrong skill — they need the dataset's own API or download URL.

Your best first call

curl "https://catalog.data.gov/api/3/action/package_search?q=climate"

No auth. No key. The q parameter accepts Solr full-text search terms. Always include a q value — calling package_search with no q returns all ~330,000 datasets paginated 10 at a time. To narrow by agency, add fq=organization:<slug> where the slug comes from organization_list.

The response result.count gives total matches (not per-page). result.results is an array of dataset objects. Key fields per result:

Fallbacks (when the best call isn't enough)

Pitfalls

One-line summary for the user

I can search the Data.gov catalog for U.S. government datasets by keyword or agency and return titles, publishers, and download links — but the actual data files live in each dataset's own API, not this catalog endpoint.

APIs this skill uses

Data.gov · primary · verified

The Data.gov CKAN API provides access to the federal government's open data catalog. Search and retrieve metadata about datasets published by government agencies. Data.gov is the home of the U.S. government's open data, providing public ac…

Generated from

Data.gov tutorial Getting Started with the Data.gov Catalog API

SKILL.md source (frontmatter + body)
---
name: search-us-government-datasets
description: When the user asks "does the government have data on X?" or wants to find U.S. government datasets by keyword, topic, or publishing agency — reach for the Data.gov CKAN API. Returns dataset metadata and download links, not the data itself.
---

## When to use this skill

When the user asks "does the government have data on X?" or wants to find U.S. government datasets — federal, tribal, or local — by keyword, topic, or publishing agency, reach for the Data.gov CKAN API. It returns dataset metadata (titles, descriptions, publisher names, download links), not the underlying data files. If the user already has a specific dataset and needs its actual data, this is the wrong skill — they need the dataset's own API or download URL.

## Your best first call

```bash
curl "https://catalog.data.gov/api/3/action/package_search?q=climate"
```

No auth. No key. The `q` parameter accepts Solr full-text search terms. Always include a `q` value — calling `package_search` with no `q` returns all ~330,000 datasets paginated 10 at a time. To narrow by agency, add `fq=organization:<slug>` where the slug comes from `organization_list`.

The response `result.count` gives total matches (not per-page). `result.results` is an array of dataset objects. Key fields per result:

- `title` — human-readable dataset name
- `name` — the dataset slug (pass to `package_show?id=` for full details)
- `organization.title` — publisher display name
- `notes` — full description text
- `resources` — array of download links and format info for each data file

## Fallbacks (when the best call isn't enough)

- **Need the exact organization slug before filtering by agency** → `curl "https://catalog.data.gov/api/3/action/organization_list"` returns every publisher's slug. Match the slug exactly before passing it to `fq=organization:<slug>`.
- **Browsing thematic groups rather than searching by keyword** → `curl "https://catalog.data.gov/api/3/action/group_list"` returns seven editorial groupings (agriculture, climate, energy, local, maritime, ocean, older-adults-health-data). Most datasets are found through `package_search`, not group browsing.
- **Full metadata for a specific dataset** → `curl "https://catalog.data.gov/api/3/action/package_show?id=<slug>"` returns the complete dataset record. Use the `name` field from a search result as the slug, not the display title.

## Pitfalls

- `fq=tags:<tag>` ANDs with the text query and silently zeros out results. Searching `q=weather+climate` with `fq=tags:economy` returns zero matches even though climate-economy datasets exist. Use `fq=organization:<slug>` with a known slug instead.
- Organization slugs are inconsistent: `cfpb-gov` for the Consumer Financial Protection Bureau, `usace-army-mil` for the Army Corps of Engineers, `board-of-governors-of-the-federal-reserve-system` spelled out in full. Run `organization_list` and match exactly.
- `count: 0` is not an error — it means your filter expression produced an empty intersection. The `sort` field showing `views_recent desc` on a query you expected to match is a telltale: your `fq` is the problem.
- `package_show?id=` accepts a dataset slug or UUID, not its display title. A 404 with `"__type": "Not Found Error"` means the slug changed or the dataset was removed — both happen in a catalog this large.

## One-line summary for the user

I can search the Data.gov catalog for U.S. government datasets by keyword or agency and return titles, publishers, and download links — but the actual data files live in each dataset's own API, not this catalog endpoint.

« Back to all skills