{
  "openapi": "3.0.3",
  "info": {
    "title": "CareRegistry - US Healthcare Facility Data API",
    "description": "US licensed healthcare-facility data aggregated from state health departments and CMS Care Compare into one normalized API, deduplicated on CMS Certification Number (CCN). A directory of licensed facilities (organizations, not individuals): each record carries the facility name, address, city, county, state, business phone, license number, CMS CCN, facility type, status, and dates. Covers hospitals, nursing homes, assisted living, home health, hospice, dialysis, ICF/IID, ambulatory surgical centers, primary care and more across all 50 states and DC. Filter by state (municipality, a two-letter code such as tx or ca), facility type (license_type), city, and county, run full-text search across facility names and addresses, and call /healthcare_facility/coverage and /healthcare_facility/stats for live per-state counts and facility-type breakdowns. No personal information about any individual is included.",
    "version": "0.1.0"
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Health",
        "operationId": "/health",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/healthcare_facility": {
      "get": {
        "summary": "Search healthcare facilities",
        "operationId": "/healthcare_facility",
        "parameters": [
          {
            "name": "municipality",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Full-text search across data fields. Space-separated words require all terms (e.g. \"wood panel\"). Use OR to match any term (\"wood OR panel OR acoustic\"), quotes for exact phrases (\"supply arrangement\"), and a leading minus to exclude (\"software -hardware\")."
          },
          {
            "name": "program_exact",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Program name (exact match, grant). Faster than program= for known names."
          },
          {
            "name": "government_level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Level of government: federal, provincial, municipal, territorial, international"
          },
          {
            "name": "status_canonical",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Normalized permit status: issued, in_review, completed, expired, cancelled, unknown"
          },
          {
            "name": "license_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Liquor: filter by license type, substring match (e.g. Restaurant, Retail, Brewery). See /liquor_license/stats for values."
          },
          {
            "name": "license_status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Liquor: filter by license status (e.g. Active). Exact, case-insensitive."
          },
          {
            "name": "city",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Liquor: filter by city. Exact, case-insensitive."
          },
          {
            "name": "county",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Liquor: filter by county. Exact, case-insensitive."
          },
          {
            "name": "issued_after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Filter by licensure date >= YYYY-MM-DD (issued_date)"
          },
          {
            "name": "issued_before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Filter by date <= YYYY-MM-DD"
          },
          {
            "name": "closing_after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Filter tenders by closing_date >= YYYY-MM-DD."
          },
          {
            "name": "closing_before",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Filter tenders by closing_date <= YYYY-MM-DD."
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Sort field: published (publication_date for tenders, award_date for contracts), date (event date), value (contract/agreement value), closing (closing_date for tenders)"
          },
          {
            "name": "sort_order",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Sort order: asc or desc",
              "default": "desc",
              "title": "Sort Order"
            },
            "description": "Sort order: asc or desc"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Pagination cursor from next_cursor in a previous response. Use instead of offset for deep pagination."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/healthcare_facility/stats": {
      "get": {
        "summary": "Healthcare facility statistics",
        "operationId": "/healthcare_facility/stats",
        "parameters": [
          {
            "name": "municipality",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "title": "Municipality"
            }
          },
          {
            "name": "group_by",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Data field to group by"
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "30d, 90d, 1y, all",
              "default": "30d",
              "title": "Period"
            },
            "description": "30d, 90d, 1y, all"
          },
          {
            "name": "sum_field",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "nullable": true
            },
            "description": "Data field to sum (e.g. contract_value)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/healthcare_facility/coverage": {
      "get": {
        "summary": "Healthcare facility count per state",
        "operationId": "/healthcare_facility/coverage",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/healthcare_facility/{record_id}": {
      "get": {
        "summary": "Get healthcare facility by ID",
        "operationId": "/healthcare_facility/{record_id}",
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Record Id"
            },
            "example": "312132"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  },
  "servers": [
    {
      "url": "https://hv1nforwhi.execute-api.ca-central-1.amazonaws.com"
    }
  ]
}