{
  "openapi": "3.0.1",
  "info": {
    "title": "US Healthcare Facility Leads Scraper (CMS)",
    "description": "Scrape every US Medicare-certified healthcare facility from the official CMS Provider of Services files: hospitals, ASCs, dialysis, skilled nursing, home health, hospice, rural health clinics & FQHCs. Name, phone, address, beds, services, ownership + lead score. Filter & monitor.",
    "version": "0.1",
    "x-build-id": "cDXqGJ4zjtfXUzHXm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~us-healthcare-facility-leads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-us-healthcare-facility-leads-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/scrapesage~us-healthcare-facility-leads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-us-healthcare-facility-leads-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/scrapesage~us-healthcare-facility-leads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-us-healthcare-facility-leads-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "states": {
            "title": "States",
            "uniqueItems": true,
            "type": "array",
            "description": "Two-letter state codes to scrape (e.g. [\"CA\",\"TX\"]). Leave empty to scrape all 50 states + DC. Territories also supported: PR, GU, VI, AS, MP.",
            "items": {
              "type": "string"
            }
          },
          "facilityCategories": {
            "title": "Facility categories",
            "uniqueItems": true,
            "type": "array",
            "description": "Keep only facilities of these categories. Allowed values: hospital, ambulatorySurgery, dialysis, skilledNursing, nursingFacility, icfIid, homeHealth, hospice, ruralHealthClinic, fqhc, communityMentalHealth, comprehensiveRehab, outpatientTherapy, portableXray, organProcurement, psychResidential. Leave empty for all. (Picking only QIES or only iQIES categories speeds the run by skipping the other file.)",
            "items": {
              "type": "string",
              "enum": [
                "hospital",
                "ambulatorySurgery",
                "dialysis",
                "skilledNursing",
                "nursingFacility",
                "icfIid",
                "homeHealth",
                "hospice",
                "ruralHealthClinic",
                "fqhc",
                "communityMentalHealth",
                "comprehensiveRehab",
                "outpatientTherapy",
                "portableXray",
                "organProcurement",
                "psychResidential"
              ],
              "enumTitles": [
                "Hospital (hospital)",
                "Ambulatory Surgical Center (ambulatorySurgery)",
                "Dialysis (ESRD) (dialysis)",
                "Skilled Nursing Facility (skilledNursing)",
                "Nursing Facility (nursingFacility)",
                "ICF/IID (icfIid)",
                "Home Health Agency (homeHealth)",
                "Hospice (hospice)",
                "Rural Health Clinic (ruralHealthClinic)",
                "Federally Qualified Health Center (fqhc)",
                "Community Mental Health Center (communityMentalHealth)",
                "Comprehensive Outpatient Rehab (comprehensiveRehab)",
                "Outpatient PT / Speech Pathology (outpatientTherapy)",
                "Portable X-Ray Supplier (portableXray)",
                "Organ Procurement Organization (organProcurement)",
                "Psychiatric Residential Treatment (psychResidential)"
              ]
            }
          },
          "hospitalSubtypes": {
            "title": "Hospital subtypes",
            "uniqueItems": true,
            "type": "array",
            "description": "When including hospitals, keep only these hospital subtypes. Allowed values: shortTerm (acute care), longTerm, psychiatric, rehabilitation, childrens, criticalAccess, transplant, ruralEmergency. Leave empty for all hospital subtypes.",
            "items": {
              "type": "string",
              "enum": [
                "shortTerm",
                "longTerm",
                "psychiatric",
                "rehabilitation",
                "childrens",
                "criticalAccess",
                "transplant",
                "ruralEmergency"
              ],
              "enumTitles": [
                "Short-Term (Acute Care) (shortTerm)",
                "Long-Term (longTerm)",
                "Psychiatric (psychiatric)",
                "Rehabilitation (rehabilitation)",
                "Children's Hospital (childrens)",
                "Critical Access Hospital (criticalAccess)",
                "Transplant Hospital (transplant)",
                "Rural Emergency Hospital (ruralEmergency)"
              ]
            }
          },
          "ownershipTypes": {
            "title": "Ownership types",
            "uniqueItems": true,
            "type": "array",
            "description": "Keep only facilities with these ownership categories. Allowed values: forProfit, nonProfit, government, physician, other. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "forProfit",
                "proprietary",
                "nonProfit",
                "government",
                "physician",
                "tribal"
              ],
              "enumTitles": [
                "For-profit (proprietary) (forProfit)",
                "Proprietary (alias of for-profit) (proprietary)",
                "Non-profit (nonProfit)",
                "Government (government)",
                "Physician-owned (physician)",
                "Tribal (tribal)"
              ]
            }
          },
          "serviceLines": {
            "title": "Service lines offered",
            "uniqueItems": true,
            "type": "array",
            "description": "Keep only facilities offering ALL of these service lines (case-insensitive substring match against the facility's service list, e.g. [\"MRI\",\"CT Scan\"], [\"Chemotherapy\"], [\"Emergency\"], [\"Cardiac Catheterization\"], [\"Dialysis\"]). Optional.",
            "items": {
              "type": "string"
            }
          },
          "cities": {
            "title": "Cities",
            "uniqueItems": true,
            "type": "array",
            "description": "Keep only facilities in these cities (case-insensitive, exact match on the facility's city). Optional.",
            "items": {
              "type": "string"
            }
          },
          "counties": {
            "title": "Counties",
            "uniqueItems": true,
            "type": "array",
            "description": "Keep only facilities in these counties (case-insensitive, matches the resolved county name, e.g. \"Los Angeles\"). Optional.",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes",
            "uniqueItems": true,
            "type": "array",
            "description": "Keep only facilities whose ZIP starts with any of these values (full ZIP or prefix, e.g. \"900\" or \"90210\"). Optional.",
            "items": {
              "type": "string"
            }
          },
          "nameQuery": {
            "title": "Facility name contains",
            "type": "string",
            "description": "Keep only facilities whose name contains this text (case-insensitive). Optional."
          },
          "ccnNumbers": {
            "title": "CCN numbers (lookup)",
            "uniqueItems": true,
            "type": "array",
            "description": "Look up specific facilities by CMS Certification Number / Provider Number (e.g. \"450002\"). When set, the state filter is ignored and only these facilities are returned.",
            "items": {
              "type": "string"
            }
          },
          "activeOnly": {
            "title": "Active facilities only",
            "type": "boolean",
            "description": "Keep only facilities with an active (non-terminated) Medicare certification.",
            "default": true
          },
          "withPhoneOnly": {
            "title": "With phone only",
            "type": "boolean",
            "description": "Keep only facilities that have a phone number.",
            "default": false
          },
          "minBeds": {
            "title": "Minimum beds",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only facilities with at least this many certified/total beds (hospitals, SNFs, ICF/IID, rehab, psych). Leave empty for no minimum."
          },
          "maxBeds": {
            "title": "Maximum beds",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only facilities with at most this many beds. Leave empty for no maximum."
          },
          "bedSizeTiers": {
            "title": "Bed size tiers",
            "uniqueItems": true,
            "type": "array",
            "description": "Keep only facilities in these bed-size tiers. Allowed values: small (<25), medium (25-99), large (100-299), veryLarge (300+). Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "small",
                "medium",
                "large",
                "veryLarge"
              ],
              "enumTitles": [
                "Small (<25 beds) (small)",
                "Medium (25–99) (medium)",
                "Large (100–299) (large)",
                "Very large (300+) (veryLarge)"
              ]
            }
          },
          "newlyCertifiedWithinDays": {
            "title": "Newly certified within N days",
            "minimum": 1,
            "type": "integer",
            "description": "Keep only facilities first certified (original participation / certification date) within the last N days — brand-new facilities that need equipment, software, staffing and supplies. Leave empty to disable."
          },
          "ownershipChangedWithinDays": {
            "title": "Ownership changed within N days",
            "minimum": 1,
            "type": "integer",
            "description": "Keep only facilities whose most recent change of ownership was within the last N days — an M&A / new-decision-maker signal. Leave empty to disable."
          },
          "minLeadScore": {
            "title": "Minimum lead score",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Keep only facilities with a lead score at or above this value (0-100)."
          },
          "includeQies": {
            "title": "Include QIES file (hospitals, RHCs, FQHCs, CMHCs)",
            "type": "boolean",
            "description": "Include the CMS QIES Provider of Services file: hospitals, rural health clinics, federally qualified health centers and community mental health centers.",
            "default": true
          },
          "includeIqies": {
            "title": "Include iQIES file (SNF, home health, hospice, dialysis, ASC...)",
            "type": "boolean",
            "description": "Include the CMS iQIES Provider of Services file: skilled nursing, home health, hospice, dialysis (ESRD), ambulatory surgery centers, ICF/IID, comprehensive rehab, outpatient therapy, portable X-ray and organ procurement organizations.",
            "default": true
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "leadScore",
              "bedsHigh",
              "newest",
              "name",
              "source"
            ],
            "type": "string",
            "description": "Order of the output.",
            "default": "leadScore"
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of facility records to return across all states.",
            "default": 1000
          },
          "maxResultsPerState": {
            "title": "Max results per state",
            "minimum": 1,
            "type": "integer",
            "description": "Optional cap on the number of facilities returned from each state (useful for balanced multi-state pulls). Leave empty for no per-state cap."
          },
          "deduplicateResults": {
            "title": "Deduplicate by CCN",
            "type": "boolean",
            "description": "Drop duplicate facilities that share the same CMS Certification Number.",
            "default": true
          },
          "includeRawFields": {
            "title": "Include raw source fields",
            "type": "boolean",
            "description": "Attach the raw CMS POS source row (all original columns — up to ~473) under sourceFields on each record.",
            "default": true
          },
          "monitorMode": {
            "title": "Monitoring mode (only new / changed)",
            "type": "boolean",
            "description": "Only return facilities that are new or whose certification, status, beds or ownership changed since the last run with the same monitor key. Ideal on a Schedule to capture newly-certified facilities each quarter.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Namespace for monitoring mode so independent monitors don't collide. Use a distinct key per saved configuration.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. The CMS data API needs no proxy, so leave this off for the fastest queries.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}