# SAMHSA Treatment Facility Scraper - Rehab & Mental Health Leads (`scrapesage/samhsa-treatment-facility-scraper`) Actor

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.

- **URL**: https://apify.com/scrapesage/samhsa-treatment-facility-scraper.md
- **Developed by:** [Scrape Sage](https://apify.com/scrapesage) (community)
- **Categories:** Lead generation, Automation, Developer tools
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 treatment facility leads

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## SAMHSA Treatment Facility Scraper — Addiction & Mental Health Leads (Phones, Websites & Payer Mix)

Extract **every US addiction and mental-health treatment facility** from the official **SAMHSA findtreatment.gov** locator — the government's own behavioral-health directory. Get **phone, intake line, website, full address and geo for ~100% of facilities**, plus the data that turns a directory listing into a qualified B2B lead: **payer mix** (Medicaid / Medicare / private insurance / self-pay / sliding scale), **operation type** (for-profit / non-profit / government / VA), **accreditation** (Joint Commission, CARF, FQHC, SAMHSA OTP) and a complete **service profile** (outpatient / residential / inpatient / detox, MAT, telehealth, special populations, languages). Optionally crawl each facility's website for **contact emails and socials**.

No login, no API key, no browser — fast JSON extraction straight from the SAMHSA locator.

### Why this scraper?

Treatment centers are aggressively marketed *to* — by behavioral-health marketing & SEO agencies, EHR / billing / RCM software, lab and toxicology services, staffing and recruiting firms, PR, call-tracking, and admissions-CRM vendors. Most "rehab" or "therapist" scrapers only return individual clinicians from a directory and stop at name + rating. This actor ships the **richest facility-level dataset in the category** and scores every facility as a lead.

| Data | Typical scrapers | This actor |
|---|---|---|
| Facility phone + intake line | partial | ✅ ~100% |
| Facility website | ❌ | ✅ ~100% |
| Full address + geo (lat/lng) | partial | ✅ |
| Payer mix (Medicaid / Medicare / private / self-pay / sliding scale) | ❌ | ✅ |
| Operation type (for-profit / non-profit / government / VA) | ❌ | ✅ |
| Accreditation (Joint Commission, CARF, FQHC, OTP) | ❌ | ✅ |
| Service settings (outpatient / residential / inpatient / detox / PHP) | ❌ | ✅ |
| MAT (methadone / buprenorphine / naltrexone) + telehealth flags | ❌ | ✅ |
| Special populations (veterans, adolescents, pregnant women, co-occurring…) | ❌ | ✅ |
| Languages, treatment approaches, recovery support, medical services | ❌ | ✅ |
| Contact **emails** + socials (from the facility's website) | ❌ | ✅ opt-in |
| Lead score (0–100) | ❌ | ✅ |

Coverage: **~12,000 substance-use** and **~12,500 mental-health** facilities nationwide.

### Use cases

- **Lead generation** — treatment centers buy software, marketing, staffing, labs and supplies. Score them by commercial signal (`operationCategory = For-profit`, `acceptsPrivateInsurance`, `isAccredited`, `hasResidential`) and contact them directly (`phone`, `intakePhone`, enriched `email`).
- **Healthcare market intelligence** — map the behavioral-health landscape by state, city, service setting, payer mix and accreditation; size the for-profit vs non-profit vs government segments.
- **Referral & care-coordination networks** — build provider directories filtered by service setting, MAT availability, telehealth, payment accepted and special populations.
- **Territory & TAM analysis** — count and segment facilities per state/metro for sales planning.
- **Fresh-facility monitoring** — schedule recurring runs with **Monitor mode** to capture newly listed facilities the moment they appear.

### How to use

1. [Sign up for Apify](https://console.apify.com/sign-up) — the free plan is enough to try this actor.
2. Open the **SAMHSA Treatment Facility Scraper**, choose facility types and filters (or a `location` for a radius search), and click **Start**.
3. Watch results stream into the dataset table.
4. **Export** as JSON, CSV, Excel, XML, or RSS — or pull results programmatically via the [Apify API](https://docs.apify.com/api/v2).

### Input

```json
{
    "facilityTypes": ["SA", "MH"],
    "states": ["CA"],
    "serviceSettings": ["Residential"],
    "paymentTypes": ["Private health insurance"],
    "facilityOperation": ["For-profit"],
    "includeContactEnrichment": true,
    "maxResults": 500,
    "sortBy": "leadScore"
}
````

- **facilityTypes** — `SA` (substance-use / addiction) and/or `MH` (mental health). Default both.
- **location** *(optional)* — a US ZIP or `City, ST` to run a **radius search** (nearest-first); set the radius with **maxMiles**. Leave empty to pull nationwide.
- **states / cities / nameQuery** — keep only facilities in given states, cities, or whose name contains a phrase.
- **serviceSettings / paymentTypes / specialPrograms / ageGroups / facilityOperation / accreditations** — precise care, payer-mix, population and credential filters.
- **matOnly / telehealthOnly / withWebsiteOnly** — quick boolean filters.
- **includeContactEnrichment** *(default false)* — crawl each facility's own website (home + contact + admissions + about, max 3 pages) for publicly listed emails and socials. SAMHSA never publishes emails — this is the only way to get them. Billed per enriched facility.
- **includeRawServices** *(default true)* — attach the full original SAMHSA `services` array so nothing is lost.
- **maxResults / sortBy** — cap output and order by lead score, distance, or name.
- **monitorMode / monitorKey** — output only facilities not seen in previous runs (fresh-leads feed).

### Output

One record per facility (Substance Use or Mental Health):

```json
{
    "facilityType": "Substance Use",
    "name": "Recovery Center of America",
    "alternateName": "RCA Outpatient",
    "phone": "215-555-0123",
    "intakePhone": "800-555-0144",
    "website": "https://www.example-recovery.com",
    "websiteDomain": "example-recovery.com",
    "email": "admissions@example-recovery.com",
    "emails": ["admissions@example-recovery.com", "info@example-recovery.com"],
    "socialLinks": { "facebook": "https://facebook.com/exrecovery" },
    "street": "123 Main St",
    "city": "Philadelphia",
    "state": "PA",
    "zip": "19103",
    "fullAddress": "123 Main St, Philadelphia, PA 19103",
    "latitude": 39.9526,
    "longitude": -75.1652,
    "operationCategory": "For-profit",
    "isAccredited": true,
    "accreditations": ["The Joint Commission", "CARF"],
    "acceptsMedicaid": true,
    "acceptsMedicare": false,
    "acceptsPrivateInsurance": true,
    "acceptsCashSelfPay": true,
    "slidingFeeScale": true,
    "typeOfCare": ["Substance use treatment", "Detoxification"],
    "serviceSettings": ["Residential/24-hour residential", "Intensive outpatient treatment"],
    "hasResidential": true,
    "hasDetox": true,
    "matOffered": true,
    "telehealthAvailable": true,
    "specialPrograms": ["Veterans", "Clients with co-occurring mental and substance use disorders"],
    "ageGroups": ["Adults", "Young Adults"],
    "languages": ["Spanish"],
    "leadScore": 92,
    "source": "SAMHSA findtreatment.gov",
    "scrapedAt": "2026-06-20T12:00:00.000Z"
}
```

Arrays also come with display-friendly joined strings (`serviceSettingsText`, `paymentAcceptedText`, `specialProgramsText`, `accreditationsText`, `languagesText`) and, with `includeRawServices`, the full original `rawServices` array.

### Automate & schedule

Run this actor on autopilot and pull results into your own stack:

- **[Apify API](https://docs.apify.com/api/v2)** — start runs, fetch datasets, and manage schedules over REST.
- **[apify-client for JavaScript](https://docs.apify.com/api/client/js/)** and **[apify-client for Python](https://docs.apify.com/api/client/python/)** — official SDKs.
- **[Schedules](https://docs.apify.com/platform/schedules)** — run it daily/weekly and combine with **Monitor mode** to capture only newly listed facilities; perfect for lead pipelines.
- **[Webhooks](https://docs.apify.com/platform/integrations/webhooks)** — trigger downstream actions (CRM import, Slack alert, email sequence) the moment a run finishes.

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'MY_APIFY_TOKEN' });

const run = await client.actor('scrapesage/samhsa-treatment-facility-scraper').call({
    facilityTypes: ['SA'],
    states: ['FL'],
    facilityOperation: ['For-profit'],
    includeContactEnrichment: true,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Got ${items.length} treatment-facility leads`);
```

### Integrate with any app

Connect the dataset to 5,000+ apps — no code required:

- **[Make](https://docs.apify.com/platform/integrations/make)** — multi-step automation scenarios.
- **[Zapier](https://docs.apify.com/platform/integrations/zapier)** — push new facility leads straight into your CRM.
- **[Slack](https://docs.apify.com/platform/integrations/slack)** — get notified when a monitored search finds new facilities.
- **[Google Drive / Sheets](https://docs.apify.com/platform/integrations/drive)** — auto-export every run to a spreadsheet.
- **[Airbyte](https://docs.apify.com/platform/integrations/airbyte)** — pipe results into your data warehouse.
- **[GitHub](https://docs.apify.com/platform/integrations/github)** — trigger runs from commits or releases.

### Use with AI assistants (MCP)

The output is clean, LLM-ready JSON. Call this actor from Claude, ChatGPT, or any agent framework through the **[Apify MCP server](https://docs.apify.com/platform/integrations/mcp)** — ask your assistant to "find for-profit residential rehabs in Texas that take private insurance" and let it run this scraper for you.

### Agent-ready: autonomous payments (x402 & Skyfire)

This actor is **agent-ready** — AI agents can discover it, run it, and **pay for it autonomously**, with no Apify account and no human in the loop. It uses [pay-per-event](https://docs.apify.com/platform/actors/publishing/monetize/pay-per-event) pricing and [limited permissions](https://docs.apify.com/platform/actors/development/permissions), so it qualifies for Apify's agentic-payment standards:

- **[x402](https://docs.apify.com/platform/integrations/x402)** — an open, HTTP-native payment protocol. Agents pay per run in USDC on the Base network directly through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp) — no account, no API key.
- **[Skyfire](https://docs.apify.com/platform/integrations/skyfire)** — agent-to-service payments for fully autonomous AI-agent workflows.

Building an AI agent, MCP tool, or autonomous data pipeline? This scraper is ready to plug in and pay as it goes.

### More US lead-gen scrapers from scrapesage

Build a complete healthcare & B2B lead-gen stack:

- **[NPI Registry Scraper](https://apify.com/scrapesage/npi-nppes-scraper)** — healthcare providers & organizations with NPI, taxonomy & address.
- **[Healthgrades Scraper](https://apify.com/scrapesage/healthgrades-scraper)** — doctors, reviews & provider leads.
- **[WebMD Scraper](https://apify.com/scrapesage/webmd-scraper)** — doctors, insurance accepted & provider leads.
- **[TherapyDen Scraper](https://apify.com/scrapesage/therapyden-scraper)** — therapist & mental-health provider leads.
- **[Doctoralia Scraper](https://apify.com/scrapesage/doctoralia-scraper)** — doctors, clinics & provider leads.
- **[CMS Open Payments Scraper](https://apify.com/scrapesage/open-payments-scraper)** — pharma/device payments to physicians.
- **[Nonprofit & IRS 990 Scraper](https://apify.com/scrapesage/nonprofit-990-scraper)** — charities, officers & financials (many treatment non-profits).
- **[US Business Formation Scraper](https://apify.com/scrapesage/us-business-formation-scraper)** — newly registered LLCs & companies.
- **[Website Contact Scraper](https://apify.com/scrapesage/website-contact-scraper)** — emails, phones & socials from any site.

### Tips

- **National pull**: leave `location` empty and add a `states` filter; the actor pulls the full SAMHSA universe and keeps your states.
- **Near-me search**: set `location` to a ZIP or `City, ST` and a `maxMiles` radius for the cleanest geo results.
- **Warmest leads**: filter `facilityOperation = For-profit` + `paymentTypes = Private health insurance` and sort by `leadScore` — for-profit centers with private-pay revenue buy the most vendor services.
- **Emails**: turn on `includeContactEnrichment`. SAMHSA never publishes emails; the actor reads them from each facility's own website.
- **Recurring monitoring**: combine [Schedules](https://docs.apify.com/platform/schedules) with `monitorMode` to feed only newly listed facilities into your CRM.

### FAQ

**Where does the data come from?** The official **SAMHSA Behavioral Health Treatment Services Locator** at [findtreatment.gov](https://findtreatment.gov) — the U.S. government's public directory of licensed substance-use and mental-health treatment facilities. No API key or login required.

**Is this the same as a therapist scraper?** No. This actor returns **facilities / treatment centers** (organizations) with payer mix, accreditation and a full service profile — distinct from individual-clinician directories. For individual providers, see the [TherapyDen](https://apify.com/scrapesage/therapyden-scraper), [Healthgrades](https://apify.com/scrapesage/healthgrades-scraper) and [WebMD](https://apify.com/scrapesage/webmd-scraper) scrapers above.

**How do I get only new facilities?** Turn on **Monitor mode**. The actor remembers facilities from previous runs (in a named key-value store) and outputs only new ones. It works alongside Apify **Schedules** — schedule the run, and Monitor mode keeps the feed fresh — they don't conflict.

**Where do the emails come from?** Never from SAMHSA (they don't publish emails). With `includeContactEnrichment` on, the actor visits each facility's own public website and extracts publicly listed contact emails and socials — the same thing a human visitor would see.

**Can I export to Google Sheets, CSV, or Excel?** Yes — one click in the dataset view, or automatically on every run via the [Google Drive integration](https://docs.apify.com/platform/integrations/drive).

**A field is null — why?** Some facilities genuinely don't publish an alternate name, intake line, or certain services. Fields are `null` only when the data doesn't exist, not because the scraper skipped them.

**Is scraping this data legal?** This actor collects publicly available government data only. You are responsible for using the data in compliance with applicable laws and the source's terms. This directory is for connecting people to treatment and for legitimate business use — not for contacting patients.

### Need help?

Open an issue on the actor's **Issues** tab, or visit the [Apify help center](https://help.apify.com/). Feature requests are welcome — this actor is actively maintained.

# Actor input Schema

## `facilityTypes` (type: `array`):

Which treatment facilities to pull. SA = substance-use / addiction treatment (rehab, detox, MAT/methadone). MH = mental-health treatment. Default: both.

## `location` (type: `string`):

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` (type: `integer`):

Only used with a Location. Keep facilities within this many miles of the location.

## `states` (type: `array`):

Keep only facilities in these US states/territories (2-letter codes, e.g. CA, TX, FL). Leave empty for all states.

## `cities` (type: `array`):

Keep only facilities in these cities (case-insensitive, exact city name). Leave empty for all cities.

## `nameQuery` (type: `string`):

Keep only facilities whose name (or alternate name) contains this text (case-insensitive). E.g. "recovery", "behavioral", "VA".

## `serviceSettings` (type: `array`):

Keep only facilities offering at least one of these care settings.

## `paymentTypes` (type: `array`):

Keep only facilities that accept at least one of these payment / funding types.

## `specialPrograms` (type: `array`):

Keep only facilities offering programs for these populations.

## `ageGroups` (type: `array`):

Keep only facilities accepting these age groups.

## `facilityOperation` (type: `array`):

Keep only facilities with these ownership / operation types (the commercial signal: for-profit centers buy the most vendor services).

## `accreditations` (type: `array`):

Keep only facilities holding at least one of these accreditations / certifications.

## `matOnly` (type: `boolean`):

Keep only facilities offering medication-assisted treatment (methadone, buprenorphine, naltrexone, etc.).

## `telehealthOnly` (type: `boolean`):

Keep only facilities that offer telemedicine / telehealth services.

## `withWebsiteOnly` (type: `boolean`):

Keep only facilities that publish a website (almost all do).

## `includeContactEnrichment` (type: `boolean`):

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.

## `includeRawServices` (type: `boolean`):

Attach the full original SAMHSA services array (every category, code and value) so nothing is lost. Turn off for a slimmer record.

## `maxResults` (type: `integer`):

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.

## `sortBy` (type: `string`):

Order of the output records.

## `monitorMode` (type: `boolean`):

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.

## `monitorKey` (type: `string`):

Namespace for monitor-mode memory. Use a distinct key per saved search (e.g. "ca-rehab") so different monitors don't share state.

## `proxyConfiguration` (type: `object`):

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.

## Actor input object example

```json
{
  "facilityTypes": [
    "SA",
    "MH"
  ],
  "location": "Miami, FL",
  "maxMiles": 100,
  "states": [
    "CA",
    "TX",
    "FL"
  ],
  "cities": [
    "Phoenix",
    "Tucson"
  ],
  "nameQuery": "recovery",
  "matOnly": false,
  "telehealthOnly": false,
  "withWebsiteOnly": false,
  "includeContactEnrichment": false,
  "includeRawServices": true,
  "maxResults": 500,
  "sortBy": "leadScore",
  "monitorMode": false,
  "monitorKey": "default",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All scraped treatment-facility records in the default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "facilityTypes": [
        "SA",
        "MH"
    ],
    "maxResults": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesage/samhsa-treatment-facility-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "facilityTypes": [
        "SA",
        "MH",
    ],
    "maxResults": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapesage/samhsa-treatment-facility-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "facilityTypes": [
    "SA",
    "MH"
  ],
  "maxResults": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call scrapesage/samhsa-treatment-facility-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapesage/samhsa-treatment-facility-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
