# US Public Library Leads Scraper (IMLS Directory) (`scrapesage/us-library-leads-scraper`) Actor

Scrape every US public library from the official IMLS Public Libraries Survey: ~9,000 library systems + ~17,000 branch outlets with phone, full address, population served, budget, collections, programs, computers/Wi-Fi & a lead score. Filter by state, size & type. B2B leads + new-library monitoring.

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

## Pricing

from $6.00 / 1,000 library system 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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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

## US Public Library Leads Scraper (IMLS Directory)

Extract **every public library in the United States** — city, county, district, multi-jurisdictional, tribal and non-profit library systems plus all of their physical branches — straight from the **official IMLS Public Libraries Survey (PLS)**. Each library comes with its **phone, full address, county and geo**, plus **population served, operating budget, staffing, collection size, visits, circulation, programs, public computers and Wi‑Fi**, and a derived **lead score** on every record.

No login, no cookies, no browser, **no API key** — fast extraction of the official IMLS data files.

### Why this library scraper?

Other "library" tools on the market scrape library *catalogs* (books) or a single library's website. This actor ships the **richest US public-library lead & intelligence dataset in the category** — built for sales and market research, not just a name and address:

| Data | Typical scrapers | This actor |
|---|---|---|
| Library / branch **name** | ✅ | ✅ |
| **Phone** | partial | ✅ (~99%) |
| Full address + county + geo | partial | ✅ |
| Population served + size tier | ❌ | ✅ |
| Operating **budget** (revenue & expenditures) | ❌ | ✅ |
| Staffing (FTE, MLS librarians) | ❌ | ✅ |
| Collection (books, e‑books, audio, video) | ❌ | ✅ |
| Visits, circulation, registered users | ❌ | ✅ |
| Programs & attendance | ❌ | ✅ |
| Public computers & Wi‑Fi sessions | ❌ | ✅ |
| Governance / legal basis | ❌ | ✅ |
| Branch-level outlets (address, sq ft, hours, geo) | ❌ | ✅ |
| Lead score (0–100) + lead signals | ❌ | ✅ |
| New-library monitoring | ❌ | ✅ |

There are **~9,000 public library systems and ~17,000 individual outlets** in the US — every one a buyer of books and e‑content, library software, furniture, RFID/self‑checkout, computers and Wi‑Fi, makerspace equipment, facilities services and professional development.

### Use cases

- **B2B lead generation** — public libraries are recurring, grant-funded buyers: book & e‑book publishers and platforms (OverDrive/Libby, Hoopla, cloudLibrary), integrated library systems (ILS/automation), RFID & self‑checkout, public-access computers & broadband, furniture & shelving, makerspace/STEM kits, security, HVAC/facilities, and library design firms. Score libraries by `populationServed`, `totalRevenue` and `visits` and reach the `phone` directly.
- **Territory & account planning** — pull every library system in a state, rank by budget and population, and build a clean, prioritized call list for reps.
- **Market & sizing analysis** — analyze budgets, collection mix (print vs e‑book), staffing, program volume and technology by state, county or locale (city/suburb/town/rural).
- **Grant & program targeting** — find large, high-traffic systems (or under-resourced rural ones) for partnerships, sponsorships and grant programs.
- **Site & location intelligence** — switch to **Outlets** to get every physical branch with address, latitude/longitude, square footage and open hours.
- **Monitoring** — schedule recurring runs with `monitorMode` to capture **only new libraries** as the survey refreshes.

### 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 **US Public Library Leads Scraper**, choose **states**, a **record type** (library systems / outlets / both) and filters (size, budget, governance, locale), then click **Start**.
3. Watch results stream into the dataset table.
4. **Export** as JSON, CSV, Excel, XML, or HTML — or pull results programmatically via the [Apify API](https://docs.apify.com/api/v2).

### Input

```json
{
    "recordType": "libraries",
    "states": ["TX"],
    "minPopulationServed": 10000,
    "withPhoneOnly": true,
    "sortBy": "leadScore",
    "maxResults": 500
}
````

- **recordType** *(default `libraries`)* — `libraries` (rich system-level leads), `outlets` (branch-level location records), or `both`.
- **states** — two-letter USPS codes (`TX`, `CA`, `NY`). Leave empty to sweep all states & territories (bounded by `maxResults`).
- **counties / cities / zipCodes / nameQuery** — filter by county, city, ZIP prefix, or library name text.
- **localeCategories / beaRegions / legalBasis** — filter by urbanicity (City/Suburb/Town/Rural), BEA region, or governance (municipal, county, district, tribal, non‑profit…).
- **minPopulationServed / maxPopulationServed / minTotalRevenue / minVisits / minTotalStaff / minBranches** — target by size, budget and activity.
- **outletTypes / minSquareFeet** — filter outlets by type (central/branch/bookmobile) and floor area.
- **multiOutletOnly / withPhoneOnly / excludeTemporarilyClosed / minLeadScore** — high-value segment toggles.
- **sortBy** — `leadScore` (recommended), `populationHigh`, `revenueHigh`, `visitsHigh`, `squareFeetHigh`, `name`, `state`, or `source`.
- **maxResults / maxResultsPerState / deduplicate / includeRawFields** — output controls.
- **monitorMode / monitorKey** — only emit new records across scheduled runs.

### Output

One record per library system (`recordType: "library"`):

```json
{
    "recordType": "library",
    "fscsKey": "TX0001",
    "libraryName": "Austin Public Library",
    "address": "710 W Cesar Chavez St",
    "city": "Austin",
    "state": "TX",
    "zip": "78701",
    "county": "Travis",
    "fullAddress": "710 W Cesar Chavez St, Austin, TX, 78701",
    "latitude": 30.2705,
    "longitude": -97.7501,
    "locale": "City — Large",
    "localeCategory": "City",
    "phone": "(512) 974-7400",
    "hasPhone": true,
    "legalBasis": "Municipal government",
    "interlibraryRelation": "Member of a federation or cooperative",
    "beaRegion": "Southwest",
    "populationServed": 961855,
    "populationCategory": "Very large (100k+)",
    "centralLibraries": 1,
    "branchLibraries": 20,
    "totalOutlets": 21,
    "isMultiOutlet": true,
    "totalStaff": 470.5,
    "librariansMLS": 120,
    "totalRevenue": 62000000,
    "localRevenue": 60000000,
    "totalOperatingExpenditures": 58000000,
    "collectionExpenditures": 6000000,
    "bookVolumes": 1300000,
    "ebooks": 450000,
    "totalCollections": 2100000,
    "visits": 2500000,
    "registeredUsers": 600000,
    "totalCirculation": 6000000,
    "totalPrograms": 5000,
    "totalProgramAttendance": 200000,
    "publicComputers": 400,
    "wifiSessions": 900000,
    "fiscalYear": "FY2023",
    "leadScore": 100,
    "leadSignals": ["Very large service area (500k+)", "Very high budget ($10M+)", "Very high foot traffic", "Large multi-branch system", "High program volume", "Heavy Wi-Fi usage", "Strong e-book collection", "Has phone"],
    "dataSource": "IMLS Public Libraries Survey",
    "scrapedAt": "2026-06-21T12:00:00.000Z"
}
```

Outlet records (`recordType: "outlet"`) carry the branch name & type, full address, phone, latitude/longitude, square footage, annual open hours and weeks open. Every record also carries `sourceFields` — the complete raw IMLS survey row — so no data is lost (turn off with `includeRawFields: false`).

### 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 on a schedule with `monitorMode` to capture newly-added libraries as fresh leads.
- **[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/us-library-leads-scraper').call({
    states: ['CA'],
    recordType: 'libraries',
    minPopulationServed: 10000,
    withPhoneOnly: true,
    sortBy: 'leadScore',
    maxResults: 500,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Got ${items.length} library 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 library leads straight into your CRM.
- **[Slack](https://docs.apify.com/platform/integrations/slack)** — get notified when a monitored search finds new libraries.
- **[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. You can 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 every large public library system in California with a phone number and a budget over $1M" 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 scrapers from scrapesage

Build a complete **US institutional & B2B lead-gen stack** from official open-data sources:

- **[US School Leads Scraper](https://apify.com/scrapesage/us-schools-scraper)** — public & private K‑12 schools, districts and colleges with enrollment and contacts.
- **[US Healthcare Facility Leads Scraper](https://apify.com/scrapesage/us-healthcare-facility-leads-scraper)** — hospitals, clinics and care facilities with contacts.
- **[US Law Enforcement Leads Scraper](https://apify.com/scrapesage/us-law-enforcement-leads)** — police, sheriff and public-safety agencies.
- **[US Fire Department Leads Scraper](https://apify.com/scrapesage/us-fire-department-leads-scraper)** — fire & EMS departments.
- **[Nonprofit 990 Scraper](https://apify.com/scrapesage/nonprofit-990-scraper)** — US nonprofits with financials and contacts (incl. Friends-of-the-Library groups).
- **[US Water System & Utility Leads (EPA SDWIS)](https://apify.com/scrapesage/us-water-system-scraper)** — public water utilities with admin contacts.
- **[US Property Records Scraper](https://apify.com/scrapesage/us-property-records-scraper)** — property & parcel records with owner mailing addresses.
- **[Website Contact Scraper](https://apify.com/scrapesage/website-contact-scraper)** — enrich any library website for emails, phones and socials.

### Tips

- **Best leads first**: keep `recordType` on `libraries` and `sortBy` on `leadScore` — large, well-funded, high-traffic systems with a phone rank highest.
- **Account sizing**: pull the full system record (budget, staffing, collection, programs, technology) to qualify and segment accounts before you call.
- **Site lists**: switch to `outlets` to get every physical branch address with geo, square footage and hours — ideal for field sales, mailers or mapping.
- **National sweeps**: leave `states` empty, set a `maxResults` cap, and use `maxResultsPerState` for an even spread across states.
- **Proxies**: not needed — the official IMLS data file is downloaded directly. Leave the proxy off for the fastest run.

### FAQ

**Where does the data come from?** The official US **IMLS Public Libraries Survey (PLS)** public-use data files (Administrative Entity + Outlet), published annually by the Institute of Museum and Library Services. No API key or login is required.

**How fresh is the data?** The actor auto-resolves the latest fiscal year published on the IMLS website (currently FY2023). IMLS releases a new survey each year.

**Do records include phone numbers?** Yes — ~99% of library systems and outlets carry a phone number. Fields are `null` only when IMLS doesn't publish them, never because the scraper skipped them.

**Do they include emails?** The IMLS survey publishes phone and full mailing address, not email. Pair this with the [Website Contact Scraper](https://apify.com/scrapesage/website-contact-scraper) to enrich a library's website for emails and socials.

**Can I get only large libraries?** Yes — use `minPopulationServed`, `minTotalRevenue`, `minVisits` or `minBranches`, and sort by `leadScore` or `revenueHigh`.

**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).

**How do I monitor new libraries automatically?** Turn on `monitorMode`, give each watch a `monitorKey`, and create a [Schedule](https://docs.apify.com/platform/schedules). Each run emits only records that are new since the last run.

**Is this legal?** This actor collects publicly available US government open data only. You are responsible for using the data in compliance with applicable laws and IMLS's terms.

### 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

## `recordType` (type: `string`):

<b>Library systems</b> = one rich record per public library (Administrative Entity) with full operational, financial and contact data (recommended). <b>Outlets</b> = one record per physical branch/central/bookmobile with address, phone, square footage & hours. <b>Both</b> = systems and outlets together.

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

Filter by the library's state — two-letter USPS codes, e.g. <code>TX</code>, <code>CA</code>, <code>NY</code>. Leave empty for all 50 states + territories.

## `counties` (type: `array`):

Filter by county name (case-insensitive, exact), e.g. <code>Travis</code>, <code>Cook</code>, <code>Los Angeles</code>.

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

Filter by city (case-insensitive, exact city name), e.g. <code>Austin</code>, <code>Chicago</code>.

## `zipCodes` (type: `array`):

Filter by ZIP — full ZIP (<code>78701</code>) or a prefix (<code>787</code> matches all 787xx).

## `localeCategories` (type: `array`):

Filter by NCES locale category of the library's location.

## `beaRegions` (type: `array`):

Filter by Bureau of Economic Analysis region code (library systems only).

## `legalBasis` (type: `array`):

Filter library systems by their legal/governance basis. Useful for targeting government-run vs district vs non-profit libraries.

## `outletTypes` (type: `array`):

Filter physical outlets by type. Only applies to outlet records.

## `minPopulationServed` (type: `integer`):

Only return library systems whose legal-service-area population is at least this large (e.g. <code>10000</code>). Targets bigger, higher-budget accounts.

## `maxPopulationServed` (type: `integer`):

Only return library systems serving at most this many people.

## `minTotalRevenue` (type: `integer`):

Only return library systems with at least this much total annual revenue (operating budget signal).

## `minVisits` (type: `integer`):

Only return library systems with at least this many annual in-person visits (foot-traffic signal).

## `minTotalStaff` (type: `integer`):

Only return library systems with at least this many total FTE staff.

## `minBranches` (type: `integer`):

Only return library systems with at least this many branch libraries.

## `minSquareFeet` (type: `integer`):

Only return outlets with at least this much floor area. Only applies to outlet records.

## `multiOutletOnly` (type: `boolean`):

Only return library systems that operate more than one outlet (central + branches). A signal of larger, multi-location accounts.

## `withPhoneOnly` (type: `boolean`):

Only return records that have a phone number on file (~99% of libraries do).

## `excludeTemporarilyClosed` (type: `boolean`):

Skip libraries/outlets flagged as temporarily closed in the survey year. On by default for a clean, contactable list.

## `minLeadScore` (type: `integer`):

Only return records with a derived lead score (0–100) at or above this value.

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

<b>Lead score</b> = highest-value accounts first (recommended). Population / Revenue / Visits = biggest libraries first. Square footage = biggest outlets first. Name / State = alphabetical. Source = file order (fastest).

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

Maximum number of records to return in this run. The full survey holds ~9,000 library systems and ~17,000 outlets.

## `maxResultsPerState` (type: `integer`):

Optional — cap the number of records per state for an even national spread. Leave empty for no per-state cap.

## `deduplicate` (type: `boolean`):

Remove duplicate records by unique IMLS identifier (FSCS key, plus outlet sequence for branches).

## `includeRawFields` (type: `boolean`):

Attach the complete raw IMLS survey row as <code>sourceFields</code> on every record so no data is lost. Turn off for a smaller, tidier output.

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

Remember which libraries/outlets were already returned (in a named key-value store) and emit ONLY records that are new since the last run — each tagged <code>monitorEvent: "new"</code>. IMLS refreshes the survey annually; run this on a Schedule to capture newly-added libraries as fresh leads. Works alongside Apify Schedules (the schedule starts the run; monitoring decides what's new).

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

Names the memory used by monitoring mode. Use a distinct key per saved watch (e.g. per state) so different monitors don't share state.

## `dataFileUrl` (type: `string`):

Advanced: override the IMLS PLS public-use CSV ZIP URL. Leave empty to auto-resolve the latest fiscal year from the IMLS website.

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

The actor downloads the official IMLS data file directly and needs no proxy in almost all cases — leave this off for the fastest, free download. If a direct download ever fails, the actor automatically retries through Apify Residential (US) proxy as a fallback.

## Actor input object example

```json
{
  "recordType": "libraries",
  "states": [
    "TX"
  ],
  "multiOutletOnly": false,
  "withPhoneOnly": false,
  "excludeTemporarilyClosed": true,
  "sortBy": "leadScore",
  "maxResults": 1000,
  "deduplicate": true,
  "includeRawFields": true,
  "monitorMode": false,
  "monitorKey": "default",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

All scraped library systems and outlets in the default dataset, each with name, address, phone, rich operational/financial data and a lead score.

# 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 = {
    "states": [
        "TX"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesage/us-library-leads-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 = {
    "states": ["TX"],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapesage/us-library-leads-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 '{
  "states": [
    "TX"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call scrapesage/us-library-leads-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "US Public Library Leads Scraper (IMLS Directory)",
        "description": "Scrape every US public library from the official IMLS Public Libraries Survey: ~9,000 library systems + ~17,000 branch outlets with phone, full address, population served, budget, collections, programs, computers/Wi-Fi & a lead score. Filter by state, size & type. B2B leads + new-library monitoring.",
        "version": "0.1",
        "x-build-id": "K5r5aqzsAbmCLL4bm"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapesage~us-library-leads-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapesage-us-library-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-library-leads-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapesage-us-library-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-library-leads-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapesage-us-library-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": {
                    "recordType": {
                        "title": "Record type",
                        "enum": [
                            "libraries",
                            "outlets",
                            "both"
                        ],
                        "type": "string",
                        "description": "<b>Library systems</b> = one rich record per public library (Administrative Entity) with full operational, financial and contact data (recommended). <b>Outlets</b> = one record per physical branch/central/bookmobile with address, phone, square footage & hours. <b>Both</b> = systems and outlets together.",
                        "default": "libraries"
                    },
                    "states": {
                        "title": "States",
                        "type": "array",
                        "description": "Filter by the library's state — two-letter USPS codes, e.g. <code>TX</code>, <code>CA</code>, <code>NY</code>. Leave empty for all 50 states + territories.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "counties": {
                        "title": "Counties",
                        "type": "array",
                        "description": "Filter by county name (case-insensitive, exact), e.g. <code>Travis</code>, <code>Cook</code>, <code>Los Angeles</code>.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "cities": {
                        "title": "Cities",
                        "type": "array",
                        "description": "Filter by city (case-insensitive, exact city name), e.g. <code>Austin</code>, <code>Chicago</code>.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "zipCodes": {
                        "title": "ZIP codes (prefix)",
                        "type": "array",
                        "description": "Filter by ZIP — full ZIP (<code>78701</code>) or a prefix (<code>787</code> matches all 787xx).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "localeCategories": {
                        "title": "Locale (urbanicity)",
                        "type": "array",
                        "description": "Filter by NCES locale category of the library's location.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "City",
                                "Suburb",
                                "Town",
                                "Rural"
                            ],
                            "enumTitles": [
                                "City",
                                "Suburb",
                                "Town",
                                "Rural"
                            ]
                        }
                    },
                    "beaRegions": {
                        "title": "BEA regions",
                        "type": "array",
                        "description": "Filter by Bureau of Economic Analysis region code (library systems only).",
                        "items": {
                            "type": "string",
                            "enum": [
                                "01",
                                "02",
                                "03",
                                "04",
                                "05",
                                "06",
                                "07",
                                "08",
                                "09"
                            ],
                            "enumTitles": [
                                "01 — New England",
                                "02 — Mid East",
                                "03 — Great Lakes",
                                "04 — Plains",
                                "05 — Southeast",
                                "06 — Southwest",
                                "07 — Rocky Mountains",
                                "08 — Far West",
                                "09 — Outlying Areas"
                            ]
                        }
                    },
                    "legalBasis": {
                        "title": "Governance / legal basis",
                        "type": "array",
                        "description": "Filter library systems by their legal/governance basis. Useful for targeting government-run vs district vs non-profit libraries.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "CI",
                                "CO",
                                "CC",
                                "LD",
                                "MJ",
                                "SD",
                                "NL",
                                "NP",
                                "OT"
                            ],
                            "enumTitles": [
                                "CI — Municipal government",
                                "CO — County/parish",
                                "CC — City/county",
                                "LD — Library district",
                                "MJ — Multi-jurisdictional",
                                "SD — School district",
                                "NL — Native American tribal",
                                "NP — Non-profit association",
                                "OT — Other"
                            ]
                        }
                    },
                    "outletTypes": {
                        "title": "Outlet types (for Outlets / Both)",
                        "type": "array",
                        "description": "Filter physical outlets by type. Only applies to outlet records.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "CE",
                                "BR",
                                "BS",
                                "BM"
                            ],
                            "enumTitles": [
                                "CE — Central library",
                                "BR — Branch library",
                                "BS — Bookmobile",
                                "BM — Books-by-mail only"
                            ]
                        }
                    },
                    "minPopulationServed": {
                        "title": "Min population served",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return library systems whose legal-service-area population is at least this large (e.g. <code>10000</code>). Targets bigger, higher-budget accounts."
                    },
                    "maxPopulationServed": {
                        "title": "Max population served",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return library systems serving at most this many people."
                    },
                    "minTotalRevenue": {
                        "title": "Min total revenue ($)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return library systems with at least this much total annual revenue (operating budget signal)."
                    },
                    "minVisits": {
                        "title": "Min annual visits",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return library systems with at least this many annual in-person visits (foot-traffic signal)."
                    },
                    "minTotalStaff": {
                        "title": "Min total staff (FTE)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return library systems with at least this many total FTE staff."
                    },
                    "minBranches": {
                        "title": "Min branch libraries",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return library systems with at least this many branch libraries."
                    },
                    "minSquareFeet": {
                        "title": "Min square footage (outlets)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only return outlets with at least this much floor area. Only applies to outlet records."
                    },
                    "multiOutletOnly": {
                        "title": "Multi-outlet systems only",
                        "type": "boolean",
                        "description": "Only return library systems that operate more than one outlet (central + branches). A signal of larger, multi-location accounts.",
                        "default": false
                    },
                    "withPhoneOnly": {
                        "title": "With phone number only",
                        "type": "boolean",
                        "description": "Only return records that have a phone number on file (~99% of libraries do).",
                        "default": false
                    },
                    "excludeTemporarilyClosed": {
                        "title": "Exclude temporarily-closed",
                        "type": "boolean",
                        "description": "Skip libraries/outlets flagged as temporarily closed in the survey year. On by default for a clean, contactable list.",
                        "default": true
                    },
                    "minLeadScore": {
                        "title": "Min lead score",
                        "minimum": 0,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Only return records with a derived lead score (0–100) at or above this value."
                    },
                    "sortBy": {
                        "title": "Sort order",
                        "enum": [
                            "leadScore",
                            "populationHigh",
                            "revenueHigh",
                            "visitsHigh",
                            "squareFeetHigh",
                            "name",
                            "state",
                            "source"
                        ],
                        "type": "string",
                        "description": "<b>Lead score</b> = highest-value accounts first (recommended). Population / Revenue / Visits = biggest libraries first. Square footage = biggest outlets first. Name / State = alphabetical. Source = file order (fastest).",
                        "default": "leadScore"
                    },
                    "maxResults": {
                        "title": "Max results",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of records to return in this run. The full survey holds ~9,000 library systems and ~17,000 outlets.",
                        "default": 1000
                    },
                    "maxResultsPerState": {
                        "title": "Max results per state",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Optional — cap the number of records per state for an even national spread. Leave empty for no per-state cap."
                    },
                    "deduplicate": {
                        "title": "Deduplicate",
                        "type": "boolean",
                        "description": "Remove duplicate records by unique IMLS identifier (FSCS key, plus outlet sequence for branches).",
                        "default": true
                    },
                    "includeRawFields": {
                        "title": "Include raw source fields",
                        "type": "boolean",
                        "description": "Attach the complete raw IMLS survey row as <code>sourceFields</code> on every record so no data is lost. Turn off for a smaller, tidier output.",
                        "default": true
                    },
                    "monitorMode": {
                        "title": "Monitoring mode — only new records",
                        "type": "boolean",
                        "description": "Remember which libraries/outlets were already returned (in a named key-value store) and emit ONLY records that are new since the last run — each tagged <code>monitorEvent: \"new\"</code>. IMLS refreshes the survey annually; run this on a Schedule to capture newly-added libraries as fresh leads. Works alongside Apify Schedules (the schedule starts the run; monitoring decides what's new).",
                        "default": false
                    },
                    "monitorKey": {
                        "title": "Monitor key",
                        "type": "string",
                        "description": "Names the memory used by monitoring mode. Use a distinct key per saved watch (e.g. per state) so different monitors don't share state.",
                        "default": "default"
                    },
                    "dataFileUrl": {
                        "title": "Data file URL (advanced)",
                        "type": "string",
                        "description": "Advanced: override the IMLS PLS public-use CSV ZIP URL. Leave empty to auto-resolve the latest fiscal year from the IMLS website."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "The actor downloads the official IMLS data file directly and needs no proxy in almost all cases — leave this off for the fastest, free download. If a direct download ever fails, the actor automatically retries through Apify Residential (US) proxy as a fallback.",
                        "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
