# US Health Data: CDC & HealthData.gov API

> CDC and HealthData.gov data API: search open datasets and export rows to JSON, CSV or Excel. Use SoQL filters. No login or API key.

URL: https://cliqtomedia.com/actors/us-health-data-api/

Category: Government & open data · Status: coming soon · Apify profile: https://apify.com/cliqtomedia?fpr=cliqto

Search the open data of the CDC and HealthData.gov by keyword or dataset ID. Export the rows as JSON, CSV or Excel. You need no login or key.

## How to use it: 3 steps

1. **Follow us on Apify.** The tool is built and waits in the queue for the Apify Store. Apify is the cloud platform where our tools run.
2. **Paste your input and press Start.** No code needed: you fill in a form (the input). It already has a working example. For example: `data.cdc.gov` in Portals. Each start is one run.
3. **Download the results.** When the run ends, the results are in a table (the dataset). Open Output, press Export and pick Excel or CSV. JSON and the API are there too.

## What it does

Search the open data portals of the CDC (data.cdc.gov) and HealthData.gov by keyword or dataset ID, and export the rows of the dataset as clean JSON, CSV or Excel.

- Data rows mode (default): give a dataset ID or a search query. The Actor finds the dataset, reads its rows page by page and saves each row with every source column, plus the dataset ID, dataset name, portal, last update of the data and the time of reading.
- Dataset search mode: list the datasets that match your keywords, with name, category, last update, licence, columns, page views and the API endpoint. No rows.
- Search: both portals are searched separately and the matches are merged (alternating by relevance: CDC first, then HealthData.gov; or newest first, exact for up to 100 datasets). With the default `maxDatasets: 1`, rows come from the top CDC match; for a HealthData.gov table set `domains` to `["healthdata.gov"]` or pick its ID in Dataset search mode.

### Good for

- Export a CDC table (COVID-19 deaths, vaccinations, measles, wastewater, overdose and many more) to CSV or Excel with a filter, without writing code.
- Feed health statistics to a database, a notebook or an AI agent through the Apify API, with the same field names as the source.
- Find which CDC or HHS dataset holds the numbers you need, and how fresh it is.

### Not a good fit

- Only data.cdc.gov and healthdata.gov. Other Socrata portals (cities, states) are not searched.
- The Actor returns what the portal publishes. It does not fix, merge or interpret the numbers. Many CDC datasets are provisional or no longer updated; check `datasetUpdatedAt`.
- Some HealthData.gov entries are only links to files on other websites. They have no rows in the API; you get a free status row instead.
- Up to 50,000 rows per run. Very wide or slow datasets can stop earlier (see Pricing and limits).

## Price

Prices will be shown after release.

## Questions

### Do I need a login or an API key?

No. Both portals are public. A Socrata app token is optional.

### Why are some numbers null?

The source has no value there. The tool never turns a missing value into 0.

### Is the data up to date?

It reads the portal live. How fresh it is depends on the dataset.

### Does it search other city or state portals?

No. It searches data.cdc.gov and healthdata.gov only.

### Can I get the same output as the website export?

The column names are the API field names, which can differ from the titles on the website. The values are the same; numbers are typed unless you set `typedValues: false`.

## Data fields

- `recordType` (string): row = one data row of a dataset; dataset = one catalog record (Dataset search mode); status = free not_found / no_rows / error row.
- `status` (string): ok for data rows and dataset records; not_found, no_rows or error for status rows.
- `statusCode` (string): Machine code on status rows, e.g. DATASET_NOT_FOUND, INVALID_DATASET_ID, SOURCE_BAD_REQUEST, RATE_LIMITED.
- `statusReason` (string): Plain-English reason on status rows.
- `input` (string): Your dataset ID or URL as given (status rows).
- `datasetId` (string): Socrata 4x4 dataset ID, e.g. 3rge-nu2a.
- `datasetName` (string): Dataset title on the portal.
- `domain` (string): Portal: data.cdc.gov or healthdata.gov.
- `datasetUpdatedAt` (string): When the dataset rows were last updated by the publisher (ISO 8601); null if the portal does not say.
- `rowNumber` (integer): Position of the row in this export, from 1 (data rows).
- `sourceUrl` (string): API URL the row or record was read from.
- `fetchedAt` (string): When the Actor read the data (ISO 8601).
- `metadataUpdatedAt` (string): When the dataset description or columns last changed (ISO 8601).
- `category` (string): Portal category, e.g. Vaccinations.
- `license` (string): Dataset licence as published, e.g. Public Domain U.S. Government.
- `attribution` (string): Publisher named by the portal, e.g. Centers for Disease Control and Prevention.
- `permalink` (string): Human page of the dataset on the portal.
- `description` (string): Dataset description (Dataset search mode).
- `createdAt` (string): When the dataset was created (ISO 8601).
- `tags` (array): Portal tags.
- `columns` (array): Columns: name, fieldName (use it in where/select), dataType, description.
- `columnCount` (integer): Number of data columns.
- `apiEndpoint` (string): SODA endpoint of the dataset rows, e.g. https://data.cdc.gov/resource/3rge-nu2a.json.
- `searchQuery` (string): The search query that found this dataset.
- `searchRank` (integer): Position in the search results, from 1.
- `pageViewsLastMonth` (integer): Portal page views last month, as reported by the catalog.
- `pageViewsTotal` (integer): Portal page views in total.
- `downloadCount` (integer): Downloads, as reported by the catalog.

## Input settings

- `searchQuery` (string): Keywords to find datasets on data.cdc.gov and HealthData.gov, e.g. covid vaccinations, measles or hospital capacity. In Data rows mode, without dataset IDs, the rows of the best match(es) are exported; check datasetName on the rows. Ignored when dataset IDs are given. Up to 300 characters.
- `datasetIds` (array): Up to 20 dataset IDs (the 4x4 code, e.g. 3rge-nu2a) or dataset URLs from data.cdc.gov or healthdata.gov. A bare ID is looked up on data.cdc.gov first, then on healthdata.gov. Unknown IDs get a free not_found row. Leave empty to use the search query.
- `mode` (string): Data rows (default): export the rows of the datasets. Dataset search: list matching datasets with name, last update, category, columns and API endpoint, without rows.
- `maxRows` (integer): Maximum paid results in the run, 1–50,000: data rows in Data rows mode (shared across datasets), dataset records in Dataset search mode (the catalog serves at most 10,000 matches). Default 100.
- `where` (string): Optional SoQL filter on the source columns, e.g. year = '2023' or state = 'CA' AND deaths > 10. Column names are the API field names (see the dataset's columns in Dataset search mode). A rejected filter returns INVALID_INPUT with the source's message.
- `select` (string): Optional comma-separated list of columns or SoQL expressions to return, e.g. state, year, deaths. Default: all columns. Whole-result aggregates such as count(*), sum(deaths) work too (no GROUP BY, so do not mix them with plain columns); then the source's row order is not applied.
- `order` (string): Optional SoQL order, e.g. week_end_date DESC. Default: the source's stable row order, so paging never skips or repeats rows.
- `maxDatasets` (integer): Data rows mode with a search query only: how many of the best-matching datasets to export rows from, 1–20. Max results is split between them. Default 1.
- `domains` (array): Portals to search: data.cdc.gov, healthdata.gov or both (default).
- `sortDatasetsBy` (string): Order of search matches: relevance (default) or most recently updated.
- `typedValues` (boolean): Convert number columns to JSON numbers and checkbox columns to true/false, when lossless. Off: keep every value as the source's text. Missing values are always null, never 0.
- `appToken` (string): Optional free Socrata app token for higher rate limits on very large exports. Not needed for normal use. Stored encrypted; never written to the output or logs.

## Step by step on Apify

1. Open the Input tab.
2. Type keywords in Search query (`searchQuery`), for example `covid vaccinations`. Or paste a dataset ID such as `9bhg-hcku` into Dataset IDs or URLs (`datasetIds`).
3. Keep Max results (`maxRows`) at the prefilled 20, or set up to 50,000.
4. Click Start.
5. Open the Output tab. Check `datasetName` on the first row: it tells you which dataset matched your words.

## Use cases

| Task | Input | You get | Key fields | Next step |
|---|---|---|---|---|
| Export one known CDC table with a filter | `datasetIds` + `where` | data row | source columns, `datasetName`, `datasetUpdatedAt` | CSV / Excel download, API |
| Quick look at data on a topic | `searchQuery` | data row | source columns, `datasetName` | Dataset view, API |
| Find the right dataset first | `mode: datasets` + `searchQuery` | dataset record | `datasetId`, `datasetName`, `datasetUpdatedAt`, `columns`, `apiEndpoint` | then run Data rows mode with that `datasetId` |
| Totals without downloading rows | `datasetIds` + `select` with `count(*)`, `sum(...)` | one data row | your aggregate columns | API, AI agent |

## Tips

- Use dataset search mode first to find the right dataset.
- Check the last update date of a dataset. Some datasets are old.
- Set domains to healthdata.gov when you want a HealthData.gov table.

## Limits



- Up to 50,000 rows per run (tested on an earlier build with the same row reader: 50,000 rows of a CDC dataset in 32 seconds).
- The Actor stops reading the source 250 seconds after the start, so a run fits the default 5-minute timeout. Very wide or slow datasets can stop earlier: a 135-column HealthData.gov dataset needed 204 seconds for 20,000 rows, so a bigger request on it reaches the limit. Then the run ends with `CAPPED`, and the dataset's outcome in `RUN_SUMMARY` is `stopped` with `DEADLINE_REACHED`; run again with a `where` filter on a date or ID to get the next part.
- Up to 20 dataset IDs and 20 datasets from a search per run.
- The source has no published quota. If it answers HTTP 429, the Actor waits and retries; your own free Socrata app token (`appToken`) raises the limit.

## Sample result

```json
{
  "recordType": "row",
  "status": "ok",
  "datasetId": "9bhg-hcku",
  "datasetName": "Provisional COVID-19 Deaths by Sex and Age",
  "domain": "data.cdc.gov",
  "datasetUpdatedAt": "2023-09-27T14:43:31.000Z",
  "rowNumber": 1,
  "sourceUrl": "https://data.cdc.gov/resource/9bhg-hcku.json?%24where=state+%3D+%27California%27&%24order=%3Aid&%24limit=21&%24offset=0",
  "fetchedAt": "2026-10-17T13:26:07.250Z",
  "data_as_of": "2023-09-27T00:00:00.000",
  "start_date": "2020-01-01T00:00:00.000",
  "end_date": "2023-09-23T00:00:00.000",
  "group": "By Total",
  "year": null,
  "month": null,
  "state": "California",
  "sex": "All Sexes",
  "age_group": "All Ages",
  "covid_19_deaths": 109248,
  "total_deaths": 1178346,
  "pneumonia_deaths": 125177,
  "influenza_deaths": 1753,
  "footnote": null
}
```

## Similar tools

- [EU TED Tenders Scraper & Monitor](https://cliqtomedia.com/actors/eu-ted-tenders-scraper/)
- [UK Bank Holidays & Business Day Calculator](https://cliqtomedia.com/actors/uk-bank-holidays-business-days/)
- [UK Postcode Lookup](https://cliqtomedia.com/actors/gb-postcode-lookup/)
- [USAspending Federal Awards & Recipient Monitor](https://cliqtomedia.com/actors/usaspending-federal-awards-monitor/)
- [VIN Decoder & Vehicle Recalls](https://cliqtomedia.com/actors/vin-decoder-vehicle-recalls/)
- [FDA Recalls & Enforcement Monitor](https://cliqtomedia.com/actors/fda-recalls-enforcement-monitor/)
