{
  "openapi": "3.0.1",
  "info": {
    "title": "SAMHSA Treatment Facility Scraper - Rehab & Mental Health Leads",
    "description": "Scrape US addiction & mental-health treatment facilities from the official SAMHSA findtreatment.gov locator: phone, website, address, payer mix, accreditation, services & lead score. Filter by state, service & payment. Monitor mode returns only new facilities. No login, no browser.",
    "version": "1.0",
    "x-build-id": "G7lb1S8ca5BTYysuL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~samhsa-treatment-facility-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-samhsa-treatment-facility-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~samhsa-treatment-facility-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-samhsa-treatment-facility-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~samhsa-treatment-facility-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-samhsa-treatment-facility-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": {
          "facilityTypes": {
            "title": "Facility types",
            "type": "array",
            "description": "Which treatment facilities to pull. SA = substance-use / addiction treatment (rehab, detox, MAT/methadone). MH = mental-health treatment. Default: both.",
            "items": {
              "type": "string",
              "enum": [
                "SA",
                "MH"
              ],
              "enumTitles": [
                "SA — Substance use / addiction",
                "MH — Mental health"
              ]
            },
            "default": [
              "SA",
              "MH"
            ]
          },
          "location": {
            "title": "Location (ZIP or \"City, ST\") — radius search",
            "type": "string",
            "description": "Optional. A US ZIP code or \"City, ST\" to run a radius search around (e.g. \"33101\" or \"Miami, FL\"). Results come back nearest-first; use \"Max distance\" to set the radius. Leave empty to pull facilities nationwide (optionally narrowed by the state filter)."
          },
          "maxMiles": {
            "title": "Max distance (miles)",
            "minimum": 1,
            "type": "integer",
            "description": "Only used with a Location. Keep facilities within this many miles of the location.",
            "default": 100
          },
          "states": {
            "title": "Filter by state",
            "type": "array",
            "description": "Keep only facilities in these US states/territories (2-letter codes, e.g. CA, TX, FL). Leave empty for all states.",
            "items": {
              "type": "string"
            }
          },
          "cities": {
            "title": "Filter by city",
            "type": "array",
            "description": "Keep only facilities in these cities (case-insensitive, exact city name). Leave empty for all cities.",
            "items": {
              "type": "string"
            }
          },
          "nameQuery": {
            "title": "Facility name contains",
            "type": "string",
            "description": "Keep only facilities whose name (or alternate name) contains this text (case-insensitive). E.g. \"recovery\", \"behavioral\", \"VA\"."
          },
          "serviceSettings": {
            "title": "Filter by service setting",
            "type": "array",
            "description": "Keep only facilities offering at least one of these care settings.",
            "items": {
              "type": "string",
              "enum": [
                "Outpatient",
                "Intensive outpatient",
                "Residential",
                "Hospital inpatient",
                "Detox",
                "Partial hospitalization",
                "Methadone"
              ],
              "enumTitles": [
                "Outpatient",
                "Intensive outpatient",
                "Residential / 24-hour",
                "Hospital inpatient",
                "Detoxification",
                "Partial hospitalization / day",
                "Methadone / buprenorphine"
              ]
            }
          },
          "paymentTypes": {
            "title": "Filter by payment accepted",
            "type": "array",
            "description": "Keep only facilities that accept at least one of these payment / funding types.",
            "items": {
              "type": "string",
              "enum": [
                "Medicaid",
                "Medicare",
                "Private health insurance",
                "Cash or self-payment",
                "Military",
                "State-financed",
                "No payment accepted"
              ],
              "enumTitles": [
                "Medicaid",
                "Medicare",
                "Private insurance",
                "Cash / self-pay",
                "Military (TRICARE)",
                "State-financed",
                "Free / no payment"
              ]
            }
          },
          "specialPrograms": {
            "title": "Filter by special program / population",
            "type": "array",
            "description": "Keep only facilities offering programs for these populations.",
            "items": {
              "type": "string",
              "enum": [
                "Veterans",
                "Adolescents",
                "Adult women",
                "Pregnant",
                "Adult men",
                "Seniors",
                "Criminal justice",
                "co-occurring",
                "HIV",
                "trauma"
              ],
              "enumTitles": [
                "Veterans",
                "Adolescents",
                "Adult women",
                "Pregnant / postpartum",
                "Adult men",
                "Seniors",
                "Criminal justice",
                "Co-occurring disorders",
                "HIV / AIDS",
                "Trauma"
              ]
            }
          },
          "ageGroups": {
            "title": "Filter by age group accepted",
            "type": "array",
            "description": "Keep only facilities accepting these age groups.",
            "items": {
              "type": "string",
              "enum": [
                "Children",
                "Young Adults",
                "Adults",
                "Seniors"
              ],
              "enumTitles": [
                "Children / adolescents",
                "Young adults",
                "Adults",
                "Seniors"
              ]
            }
          },
          "facilityOperation": {
            "title": "Filter by operation type",
            "type": "array",
            "description": "Keep only facilities with these ownership / operation types (the commercial signal: for-profit centers buy the most vendor services).",
            "items": {
              "type": "string",
              "enum": [
                "For-profit",
                "Non-profit",
                "Government",
                "VA"
              ],
              "enumTitles": [
                "Private for-profit",
                "Private non-profit",
                "Government",
                "Dept. of Veterans Affairs"
              ]
            }
          },
          "accreditations": {
            "title": "Filter by accreditation",
            "type": "array",
            "description": "Keep only facilities holding at least one of these accreditations / certifications.",
            "items": {
              "type": "string",
              "enum": [
                "joint commission",
                "carf",
                "federally qualified",
                "opioid treatment"
              ],
              "enumTitles": [
                "The Joint Commission",
                "CARF",
                "FQHC",
                "SAMHSA OTP (opioid)"
              ]
            }
          },
          "matOnly": {
            "title": "Only facilities offering MAT",
            "type": "boolean",
            "description": "Keep only facilities offering medication-assisted treatment (methadone, buprenorphine, naltrexone, etc.).",
            "default": false
          },
          "telehealthOnly": {
            "title": "Only facilities offering telehealth",
            "type": "boolean",
            "description": "Keep only facilities that offer telemedicine / telehealth services.",
            "default": false
          },
          "withWebsiteOnly": {
            "title": "Only facilities with a website",
            "type": "boolean",
            "description": "Keep only facilities that publish a website (almost all do).",
            "default": false
          },
          "includeContactEnrichment": {
            "title": "Enrich with website emails & socials",
            "type": "boolean",
            "description": "For each facility, crawl its own website (home, contact, admissions & about pages) for publicly listed contact emails and social-media links. Adds the email wedge SAMHSA does not publish. Billed per enriched facility.",
            "default": false
          },
          "includeRawServices": {
            "title": "Include raw service rows (richest output)",
            "type": "boolean",
            "description": "Attach the full original SAMHSA services array (every category, code and value) so nothing is lost. Turn off for a slimmer record.",
            "default": true
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of facilities to output across the whole run. Default 100. Set to 0 for ALL matching facilities nationwide (~12k substance-use + ~12.5k mental-health) — best combined with a state/city filter, and expect a longer run.",
            "default": 100
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "leadScore",
              "distance",
              "name"
            ],
            "type": "string",
            "description": "Order of the output records.",
            "default": "leadScore"
          },
          "monitorMode": {
            "title": "Monitor mode (only new facilities)",
            "type": "boolean",
            "description": "Remember facilities seen in previous runs and output only NEW ones — a fresh feed of newly listed treatment facilities. Works alongside Apify Schedules; it does not replace them.",
            "default": false
          },
          "monitorKey": {
            "title": "Monitor key",
            "type": "string",
            "description": "Namespace for monitor-mode memory. Use a distinct key per saved search (e.g. \"ca-rehab\") so different monitors don't share state.",
            "default": "default"
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Apify Proxy (fallback). The SAMHSA gov API is clean over a direct connection, so the actor fetches directly first (fastest, cheapest) and only falls back to this proxy — then US residential — if a direct request is ever blocked.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}