CMS Open Payments Datastore SQL API

SQL query over a datastore resource.

OpenAPI Specification

open-payments-datastore-sql-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: CMS Open Payments Datastore Query Datastore SQL API
  description: 'The CMS Open Payments public data API serves the federal transparency program that publishes payments and transfers of value from drug and medical device manufacturers and group purchasing organizations (GPOs) to physicians, non-physician practitioners, and teaching hospitals.


    The site at openpaymentsdata.cms.gov is a DKAN open data catalog. All read access is free and requires no authentication or API key. Data is organized as datasets (one per program year and payment category: General, Research, and Ownership and Investment), each backed by a datastore that can be queried with a structured query object, with SQL, or downloaded as CSV or JSON.


    This document models the public read surface only: the metastore catalog and search, the datastore structured query endpoints, the SQL query endpoint, and downloads. The DKAN write and moderation endpoints require Basic Authentication and are for CMS data publishers, not public consumers; they are out of scope here.'
  version: '1.0'
  contact:
    name: CMS Open Payments
    url: https://openpaymentsdata.cms.gov/about/api
  license:
    name: U.S. Government Work / Public Domain
    url: https://www.usa.gov/government-works
servers:
- url: https://openpaymentsdata.cms.gov/api/1
  description: CMS Open Payments public data API (DKAN)
tags:
- name: Datastore SQL
  description: SQL query over a datastore resource.
paths:
  /datastore/sql:
    get:
      operationId: queryDatastoreSql
      tags:
      - Datastore SQL
      summary: Run a SQL query
      description: Run a SQL-style query against a datastore resource. The query references a datastore table by its resource id (for example [SELECT * FROM resource-id][WHERE ...][LIMIT 10];). No authentication required. Returns HTTP 400 when the query parameter is missing.
      parameters:
      - name: query
        in: query
        required: true
        schema:
          type: string
        description: The SQL query string over a datastore resource.
      - name: show_db_columns
        in: query
        required: false
        schema:
          type: boolean
        description: Include the internal datastore column names in the response.
      responses:
        '200':
          description: An array of result rows.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
        '400':
          description: Missing or invalid query parameter.