New York State Open Data Scraper
Pricing
from $4.25 / 1,000 item extracteds
New York State Open Data Scraper
Search data.ny.gov datasets, export catalog metadata and column schemas, and fetch bounded rows from selected public dataset IDs.
Pricing
from $4.25 / 1,000 item extracteds
Rating
0.0
(0)
Developer
Stas Persiianenko
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
7 days ago
Last modified
Categories
Share
Search New York State open data on data.ny.gov, export dataset catalog metadata and column schemas, and fetch bounded rows from public dataset IDs.
Use the Actor to inventory government datasets, inspect stable Socrata field names before building a pipeline, or refresh selected public rows on an Apify schedule. It uses official anonymous JSON endpoints and does not need a data.ny.gov account or API token.
What does this Actor do?
The Actor supports two complementary jobs in one run:
- Search the data.ny.gov catalog by words such as
public health,transportation, orunemployment. - Fetch a bounded number of rows from explicit Socrata resource IDs such as
5xaw-6ayf.
Catalog records include:
- stable dataset ID;
- title and description;
- publishing agency or attribution;
- category and tags;
- source and API links;
- available update timestamps and usage counts;
- column names, API field names, source types, and descriptions.
Selected dataset rows preserve their original public fields inside data, together with dataset identity and provenance.
Who is it for?
Civic-data teams
Create a searchable inventory of New York State datasets and inspect when metadata or source data changed.
Data engineers
Resolve Socrata field names and types, then feed bounded row exports into recurring ETL jobs.
Researchers and journalists
Find official datasets on a topic, retain source links, and collect a reproducible sample for analysis.
Public-sector analysts
Review schemas across related datasets without opening each portal page manually.
Why use it?
- Official structured routes: requests go to Socrata's public catalog, metadata, and SODA row APIs.
- Catalog plus rows: discover datasets and sample selected resources with one input.
- Bounded output: explicit catalog and per-dataset limits prevent accidental unlimited exports.
- Pipeline-friendly: stable provenance fields wrap arbitrary source rows without renaming their original keys.
- Visible failures: invalid IDs and upstream errors fail the run instead of producing a misleading empty success.
- No paid proxy fallback: direct official APIs keep runtime and transfer costs predictable.
Getting started
- Open the Actor input tab.
- Enter a catalog
query, one or moredatasetIds, or both. - Set
maxCatalogItemsfor search results. - Set
rowsPerDatasetabove zero only when you want source rows. - Leave
includeCatalogenabled to receive metadata and column schemas. - Click Start.
- Open the default dataset to download JSON, CSV, Excel, XML, or RSS through Apify.
A small catalog search:
{"query": "public health","maxCatalogItems": 10,"rowsPerDataset": 0,"includeCatalog": true}
A selected dataset export:
{"datasetIds": ["5xaw-6ayf"],"rowsPerDataset": 25,"includeCatalog": true}
Input parameters
| Field | Type | Default | Description |
|---|---|---|---|
query | string | β | Search words for the data.ny.gov catalog. Maximum 200 characters. |
datasetIds | string[] | [] | Up to 50 data.ny.gov IDs in xxxx-xxxx form. |
maxCatalogItems | integer | 20 | Maximum catalog matches, from 1 to 1,000. |
rowsPerDataset | integer | 0 | Maximum rows per selected ID, from 0 to 5,000. |
includeCatalog | boolean | true | Include metadata and schema records. |
Provide query, datasetIds, or both.
When includeCatalog is false, at least one dataset ID is required because a query alone would otherwise have no output.
Duplicate IDs are fetched once.
Search catalog metadata
Set query and keep includeCatalog enabled.
The Actor pages the official Socrata Discovery API, restricts results to data.ny.gov, validates the returned source domain, and deduplicates by resource ID.
Search is full-text relevance search supplied by Socrata. It is not an exact phrase filter and may match titles, descriptions, categories, publishers, or tags.
Use a narrow term when you need a focused inventory:
{"query": "electric vehicle charging","maxCatalogItems": 50}
Export dataset schemas
Every catalog item contains a columns array.
Each column can include:
| Field | Meaning |
|---|---|
name | Human-readable portal column label. |
fieldName | Field name used in Socrata API rows and SoQL. |
dataType | Socrata source type such as Text, Number, or Calendar date. |
description | Publisher-provided explanation when available. |
Schema fields are nullable because publishers do not populate every metadata property consistently.
Fetch selected public dataset rows
Supply one or more IDs and set rowsPerDataset above zero.
Example using New York's Mega Millions winning-number dataset:
{"datasetIds": ["5xaw-6ayf"],"rowsPerDataset": 10,"includeCatalog": true}
The Actor first resolves public metadata, then requests rows in bounded pages. It does not fetch private datasets and does not accept credentials.
The original row is stored under data. Source column names therefore differ by selected dataset.
Output fields
The default dataset can contain two recordType values.
catalog
| Field | Description |
|---|---|
datasetId | Stable Socrata resource ID. |
name | Dataset title. |
description | Publisher's dataset description. |
attribution | Publishing agency or organization. |
category, tags | Discovery labels from data.ny.gov. |
createdAt, updatedAt | Available lifecycle timestamps. |
dataUpdatedAt, metadataUpdatedAt, rowsUpdatedAt | More specific update evidence when exposed. |
columns | Column schema array. |
sourceUrl | Human-readable portal page. |
apiUrl | Public JSON row endpoint. |
fetchedAt | Actor collection timestamp. |
datasetRow
| Field | Description |
|---|---|
datasetId | Source resource ID. |
datasetName | Resolved dataset title. |
rowIndex | Zero-based offset in this export. |
data | Original public row object. |
sourceUrl | Human-readable dataset page. |
apiUrl | Public endpoint for the row offset. |
fetchedAt | Actor collection timestamp. |
Output example
A catalog result has this shape:
{"recordType": "catalog","datasetId": "5xaw-6ayf","name": "Lottery Mega Millions Winning Numbers: Beginning 2002","attribution": "New York State Gaming Commission","tags": ["mega millions", "winning numbers"],"columns": [{"name": "Draw Date","fieldName": "draw_date","dataType": "Calendar date","description": null}],"sourceUrl": "https://data.ny.gov/d/5xaw-6ayf","apiUrl": "https://data.ny.gov/resource/5xaw-6ayf.json","fetchedAt": "2025-02-15T12:00:00.000Z"}
A row result has this shape:
{"recordType": "datasetRow","datasetId": "5xaw-6ayf","datasetName": "Lottery Mega Millions Winning Numbers: Beginning 2002","rowIndex": 0,"data": {"draw_date": "2025-01-15T00:00:00.000","winning_numbers": "01 02 03 04 05","mega_ball": "06"},"sourceUrl": "https://data.ny.gov/d/5xaw-6ayf"}
Values shown are representative and may differ from current source rows.
How much does it cost to export New York State open data?
Pricing uses one start event plus one item event for every useful catalog record or selected dataset row saved.
At the BRONZE tier:
- run start: $0.005;
- item: $0.007076 per saved record.
For example, 25 catalog records cost about $0.182 including the start event. A run producing one metadata record and 100 source rows costs about $0.720.
Apify plan tiers can change the per-item price. Check the Actor pricing panel for the applicable live tier before a large run.
Failed, duplicate, or rejected records are not item-charged.
Recurring civic-data ETL
Create an Apify schedule with stable datasetIds and rowsPerDataset.
Typical flow:
- Search once to identify relevant datasets.
- Save stable IDs and column field names.
- Create a Task containing the selected IDs.
- Schedule the Task daily, weekly, or monthly.
- Send dataset output to a webhook, cloud storage, database, or automation platform.
- Compare
fetchedAtruns or source update timestamps in your downstream system.
The Actor exports current snapshots. It does not itself store historical diffs or send change alerts.
Spreadsheet workflow
After a run:
- Open Dataset.
- Select the overview view for normalized provenance fields.
- Download JSON for complete nested
dataandcolumnsobjects. - Use CSV or Excel when your chosen output contains only fields suitable for tabular flattening.
Arbitrary dataset row columns remain nested under data; downstream code should select the source fields it needs.
API usage with cURL
Start a run and wait for its dataset:
curl -X POST \"https://api.apify.com/v2/acts/automation-lab~new-york-open-data-catalog-export/run-sync-get-dataset-items?token=$APIFY_TOKEN" \-H "Content-Type: application/json" \-d '{"query":"unemployment","maxCatalogItems":10}'
Keep the token in an environment variable or secret manager.
API usage with JavaScript
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });const run = await client.actor('automation-lab/new-york-open-data-catalog-export').call({datasetIds: ['5xaw-6ayf'],rowsPerDataset: 20,includeCatalog: true,});const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items);
API usage with Python
from apify_client import ApifyClientimport osclient = ApifyClient(os.environ['APIFY_TOKEN'])run = client.actor('automation-lab/new-york-open-data-catalog-export').call(run_input={'query': 'public health','maxCatalogItems': 20,})items = client.dataset(run['defaultDatasetId']).list_items().itemsprint(items)
Use with Apify MCP
Add the Actor to Claude Code:
claude mcp add --transport http apify \"https://mcp.apify.com?tools=automation-lab/new-york-open-data-catalog-export"
Claude Desktop, Cursor, and VS Code setup
Claude Desktop, Cursor, and VS Code clients can use this MCP server configuration:
{"mcpServers": {"apify": {"url": "https://mcp.apify.com?tools=automation-lab/new-york-open-data-catalog-export"}}}
Example prompts:
- "Search New York State open data for public health and return five datasets with their API field names."
- "Fetch ten rows from data.ny.gov dataset 5xaw-6ayf and summarize its schema."
- "Prepare an inventory of unemployment datasets with source links and update timestamps."
Limits and responsible scaling
- Catalog output is capped at 1,000 records per run.
- Up to 50 explicit dataset IDs are accepted.
- Row output is capped at 5,000 rows per selected dataset.
- Requests time out after 20 seconds and retry transient failures at most three times.
- Deterministic 4xx responses, including invalid or unavailable IDs, are not retried blindly.
- No proxy, browser, login, private app token, or CAPTCHA service is used.
Start small before increasing limits on a schedule.
Data freshness and completeness
The Actor reports what Socrata returns at run time.
Publishers control metadata quality, schemas, row ordering, update timing, and dataset availability. Some timestamps, descriptions, tags, usage counts, or column descriptions can be absent.
Rows use the source's default API order. If a stable business ordering matters, sort or key them downstream using fields from that dataset's schema.
Catalog search relevance and result totals can change as data.ny.gov content changes.
Error behavior
The run fails visibly when:
- neither a query nor a dataset ID is provided;
- a query is blank or too long;
- an ID does not match
xxxx-xxxx; - a requested dataset is missing, private, or unavailable;
- the source repeatedly times out or returns a transient server error;
- the source returns a non-JSON response.
A valid search with no matches succeeds with an empty dataset.
Troubleshooting
Why did my selected ID fail with HTTP 404?
Confirm the ID on the data.ny.gov dataset page. IDs from other Socrata portals are outside this Actor's scope, and deleted or private views are unavailable.
Why are row fields inside data?
Every Socrata dataset defines its own columns. Nesting the unchanged source row preserves field names while keeping common identity and provenance fields stable.
Why did search return fewer records than requested?
The source may have fewer relevant data.ny.gov records, or some catalog entries may not be tabular dataset IDs suitable for this product.
Can I use SoQL filters?
Not in this initial version. The Actor deliberately offers bounded first rows rather than arbitrary SQL. Use the emitted apiUrl and schema field names to build a specialized downstream request if needed.
Does it include NYC Open Data?
No. Search and selected IDs are restricted to the New York State data.ny.gov portal. NYC's data.cityofnewyork.us is a separate source.
Legal and responsible use
This Actor accesses public government open-data endpoints without authentication.
Users remain responsible for:
- following dataset-specific licenses and attribution requirements;
- reviewing publisher disclaimers and data-quality notes;
- avoiding harmful re-identification or misuse of sensitive public records;
- applying privacy, retention, and security rules in downstream systems;
- respecting Socrata and data.ny.gov usage policies and practical rate limits.
Public availability does not guarantee that every downstream use is appropriate.
Related Automation Lab Actors
- USGS LiDAR Downloads Scraper for specialized USGS point-cloud catalog and download-link acquisition.
- Schema-Guided Web Data to Excel for turning supported web data into a controlled spreadsheet schema.
- New York State Contract Reporter Scraper for procurement opportunity monitoring rather than general open-data catalog inventory.
Choose this Actor when you need data.ny.gov catalog discovery, schemas, or selected public Socrata rows.
FAQ
Do I need a data.ny.gov application token?
No. The Actor uses anonymous public endpoints for bounded requests.
Can I search and fetch rows in the same run?
Yes. Supply both query and datasetIds. Search matches do not automatically trigger row downloads; only explicit IDs do.
Are catalog records and rows separate datasets?
No. Both are in the default dataset and distinguished by recordType, which keeps standard Apify integrations simple.
Are duplicate dataset IDs charged twice?
No. Duplicate explicit IDs are deduplicated. Catalog metadata already emitted by search is not emitted again for the same selected ID.
Can the Actor export all rows from a very large dataset?
It intentionally caps each selected dataset at 5,000 rows. This protects schedules from unexpectedly large output and cost. For bulk archival, use the source's dedicated export facilities.
Does the Actor detect changes between runs?
It emits current metadata, timestamps, schemas, and rows. Schedule it and compare outputs in your own database or automation workflow; the Actor does not maintain a private change history.