GET /datastore/sql

cms.gov:cms-provider-data-api

Summary: SQL Query (Basic)
Operation ID: querySql
Auth: none

Execute SQL SELECT queries directly against the datastore. Supports standard SQL syntax for querying datasets with JOINs, aggregations, WHERE clauses, and column selection. Limited to SELECT statements on public datasets only. This endpoint provides maximum flexibility for data retrieval when the simple query endpoint doesn't meet your needs. Useful for complex filtering, joining multiple tables, or computing aggregations on the server side.

Original spec description

Execute a SQL query against the datastore. Limited to SELECT statements on public datasets.

Usage Tips

- Only SELECT statements are allowed; no INSERT, UPDATE, DELETE - Query must be URL-encoded when passed as a query parameter - Use square bracket notation for dataset names: [dataset_id][index] - Returns 400 for syntax errors with detailed error messages

Parameters (1)

query (string, query, required)

SQL SELECT query

Examples (1)

TitleTypeURLAction
SQL Query - Select dialysis facility data with limit probe-gate https://data.cms.gov/provider-data/api/1/datastore/sql?query=[SELECT * FROM a106bb7d-22a0-5be5-be84-af58b992c236][LIMIT 5]

No probe data for this endpoint yet.