# New York State Open Data API

> New York State open data: 1,000+ datasets, from lottery results to notaries, with SoQL queries

- Vendor: `newyorkstateopendataapi` · version 1.0 · category Government Data · tags ny state api, ny state open data api, socrata api, government open data api, public records api, soql api
- Datasource: custom HTTP routes
- Marketplace page: https://apiclay.com/api/newyorkstateopendataapi
- This document: https://apiclay.com/docs/newyorkstateopendataapi.md
- OpenAPI 3.1: https://apiclay.com/api/newyorkstateopendataapi/openapi.json
- MCP: connect https://api.apiclay.com/v1/mcp (see https://apiclay.com/llms.txt), then `apiclay_describe_api` with vendor `newyorkstateopendataapi`
- Updated: 2026-11-18

## About

## New York State Open Data API

The open data portal of New York State (data.ny.gov, run on Socrata): about 1,037 datasets such as lottery winning numbers, horse racing rulings, equine deaths and commissioned notaries. Search the portal's datasets by keyword, category or tag, read any dataset row by row with SoQL filters, sorting, paging and aggregates, and get a dataset's column names, types and descriptions.

Data comes from **data.ny.gov** (https://data.ny.gov). Every route calls the source's own public API and returns it unchanged.

Typical flow: `/datasets?q=permits&amp;limit=5` for a dataset `id`, then `/columns?dataset=` for its field names and `/rows?dataset=&amp;$limit=10&amp;$order=...`.

### Routes

#### GET `/datasets` - Datasets
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| q | query | string | no | Keyword, e.g. `permits`. |
| categories | query | string | no | Portal category, e.g. `Public Safety`. |
| tags | query | string | no | Tag. |
| order | query | string | no | `page_views_total`, `updatedAt` or `name`. |
| limit | query | number | no | Datasets per page (up to 100). |
| offset | query | number | no | Datasets to skip, for paging. |

Returns: `resultSetSize` and `results`: `resource` (`id`, `name`, `description`, `updatedAt`, `columns_name`, `columns_field_name`, `page_views`), `classification` (`domain_category`, `domain_tags`), `permalink` and `link`.

#### GET `/rows` - Rows
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| dataset | path | string | yes | Dataset `id` (4x4, e.g. `ydr8-5enu`) from `/datasets`. |
| $limit | query | number | no | Rows to return (default 1,000). |
| $offset | query | number | no | Rows to skip, for paging. |
| $where | query | string | no | SoQL filter, e.g. `issue_date &gt; '2026-01-01'` (field names from `/columns`). |
| $select | query | string | no | Columns or aggregates, e.g. `count(*)`. |
| $order | query | string | no | e.g. `issue_date DESC`. |
| $q | query | string | no | Full-text search across the row. |

Returns: array of rows, each an object keyed by the dataset's column field names.

#### GET `/columns` - Columns
| Param | In | Type | Required | Description |
|---|---|---|---|---|
| dataset | path | string | yes | Dataset `id` from `/datasets`. |

Returns: the dataset's metadata: `name`, `description`, `attribution`, `rowsUpdatedAt`, `license` where set, and `columns` (`fieldName`, `name`, `dataTypeName`, `description`).

### Caveats

- Without an app token the portal throttles heavy use; page with `$limit` and `$offset`.
- Some datasets name individuals (licence holders, employees, drivers, arrestees) as published by the government; handle them under applicable privacy law.
- Each dataset keeps the terms shown on the portal; credit New York State.
- Upstream responses can change over time. Verify fields before relying on them.
- Not affiliated with or endorsed by data.ny.gov.

## Pricing

- Pay as you go: 0.0012 credits/request
- Trial: 1 free requests per buyer
- Billing order: trial requests -> subscribed plan requests -> pay as you go. 1 credit's USD value is shown on the marketplace page.

## HTTP routes

Only the public, buyer-facing parts of each route are listed; vendor-side credentials stay on the gateway.

### GET /datasets — Datasets
- Gateway: `GET https://api.apiclay.com/v1/api/newyorkstateopendataapi/datasets`
- Public query params: `q` (string), `categories` (string), `tags` (string), `order` (string), `limit` (number), `offset` (number)
- Upstream proxy: ApiClay proxy paid by the vendor (data cap 2 MB per call). Fetched through an ApiClay proxy paid by the vendor; a response larger than the route's data cap fails with 502 and is refunded in full.

### GET /rows — Rows
- Gateway: `GET https://api.apiclay.com/v1/api/newyorkstateopendataapi/rows`
- Public query params: `$limit` (number), `$offset` (number), `$where` (string), `$select` (string), `$order` (string), `$q` (string), `dataset` (string, required)
- Upstream proxy: ApiClay proxy paid by the vendor (data cap 2 MB per call). Fetched through an ApiClay proxy paid by the vendor; a response larger than the route's data cap fails with 502 and is refunded in full.

### GET /columns — Columns
- Gateway: `GET https://api.apiclay.com/v1/api/newyorkstateopendataapi/columns`
- Public query params: `dataset` (string, required)
- Upstream proxy: ApiClay proxy paid by the vendor (data cap 2 MB per call). Fetched through an ApiClay proxy paid by the vendor; a response larger than the route's data cap fails with 502 and is refunded in full.

## Call example

```bash
curl -X GET "https://api.apiclay.com/v1/api/newyorkstateopendataapi/datasets" \
  -H "token: <YOUR_APICLAY_TOKEN>"
```

Index of every published API: https://apiclay.com/llms.txt
