# Ny Sonyma Mortgage Loans Scraper (`real-estate-api/ny-sonyma-mortgage-loans-scraper`) Actor

NY SONYMA Mortgage Loans Scraper is a Python tool to extract loan program rates, income limits, purchase price ceilings, down payment assistance terms, and target area census tracts from NY Housing and Community Renewal portals. It exports structured homeownership datasets into CSV or JSON formats.

- **URL**: https://apify.com/real-estate-api/ny-sonyma-mortgage-loans-scraper.md
- **Developed by:** [real-estate-api](https://apify.com/real-estate-api) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### NY SONYMA Mortgage Loans Scraper — New York Housing and Mortgage Records

![NY SONYMA Mortgage Loans Scraper cover](https://images.bigibyte.com/cdn-cgi/image/width=1260,height=540,fit=cover,format=webp/apify-actors-covers/ny-sonyma-mortgage-loans-scraper-cover.png)

Collect publicly available mortgage loan purchase records from New York State's SONYMA dataset. Search by keyword, apply custom filters, or retrieve the newest loan purchases first. Export structured results in JSON, CSV, Excel, and other supported Apify dataset formats.

### Overview

The NY SONYMA Mortgage Loans Scraper collects records from the SONYMA Mortgage Loans Purchased dataset on New York State Open Data.

Retrieve bond series, original loan amounts, purchase dates, loan-to-value ratios, counties, property types, and other housing details in one organized dataset. The actor supports keyword search, custom filtering, and newest-first sorting.

### Features

- **Multiple collection modes:** Search, filter, or retrieve the latest mortgage loan records.
- **Keyword search:** Find records using terms such as county names.
- **Custom filtering:** Narrow results by purchase year, county, or other available fields.
- **Newest-first sorting:** Retrieve recent purchases using loan purchase date ordering.
- **Structured output:** Collect mortgage and property details in organized records.
- **Flexible exports:** Download results in JSON, CSV, Excel, and other supported formats.

### Collection Modes

| Mode | Description |
|---|---|
| `search` | Searches records using the supplied text across searchable text fields. Leave `searchText` empty to retrieve records without a keyword filter. |
| `filter` | Applies a custom filter condition to retrieve matching records. |
| `latest` | Sorts records by `loan_purchase_date DESC` so the newest purchases come first. |

### Input Parameters

| Parameter | Description |
|---|---|
| `mode` | Collection mode: `search`, `filter`, or `latest`. |
| `searchText` | Keyword or phrase used in search mode. |
| `where` | Filter condition used in filter mode. |
| `maxItems` | Maximum number of records to collect. |
| `requestDelayMs` | Delay between requests in milliseconds. |

### Example Input

**Search by county**

```json
{
  "mode": "search",
  "searchText": "Erie",
  "maxItems": 50,
  "requestDelayMs": 1000
}
```

**Filter by purchase year**

```json
{
  "mode": "filter",
  "where": "purchase_year = '2016'",
  "maxItems": 25,
  "requestDelayMs": 1000
}
```

**Latest mortgage purchases**

```json
{
  "mode": "latest",
  "maxItems": 50,
  "requestDelayMs": 1000
}
```

### What Data Does This Actor Extract?

Each mortgage loan record can include the following fields:

| Field | Description |
|---|---|
| `bond_series` | Mortgage bond series. |
| `original_loan_amount` | Original mortgage loan amount. |
| `loan_purchase_date` | Date the loan was purchased. |
| `purchase_year` | Year of the loan purchase. |
| `original_ltv` | Original loan-to-value ratio. |
| `loan_type` | Mortgage loan type. |
| `sonyma_dpal_ccal_amount` | Recorded SONYMA assistance amount. |
| `original_term` | Original loan term. |
| `county` | County associated with the property. |
| `fips_code` | County FIPS code. |
| `of_units` | Number or type of housing units. |
| `property_type` | Property classification. |
| `housing_type` | Housing status or classification. |
| `household_size` | Recorded household size. |
| `scrapedAt` | Date and time the record was collected. |

### Example Output

```json
{
  "bond_series": "HMB Warehouse",
  "original_loan_amount": "120280",
  "loan_purchase_date": "2016-06-30T00:00:00.000",
  "purchase_year": "2016",
  "original_ltv": "97.00",
  "loan_type": "Conventional",
  "sonyma_dpal_ccal_amount": "3720",
  "original_term": "360",
  "county": "Erie",
  "fips_code": "36029",
  "of_units": "1 Family",
  "property_type": "Detached",
  "housing_type": "Existing",
  "household_size": "4",
  "scrapedAt": "2026-10-26T00:00:00+00:00"
}
```

### Use Cases

- **Housing Market Research:** Analyze mortgage purchase activity across New York counties.
- **Real Estate Analysis:** Explore loan amounts, property types, and housing classifications.
- **Mortgage Research:** Examine loan types, original terms, and loan-to-value ratios.
- **County-Level Analysis:** Compare mortgage records using county names and FIPS codes.
- **Housing Policy Research:** Study publicly available mortgage purchase and assistance information.
- **Business Intelligence:** Build datasets for spreadsheets, dashboards, and reporting.

### Working with Your Dataset

After the actor completes a run, your collected mortgage records are available in the Apify dataset.

You can:

- Export records as JSON, CSV, or Excel.
- Filter and sort records by county, purchase year, or loan type.
- Compare loan amounts and property classifications.
- Use the collected data in spreadsheets, dashboards, and reporting workflows.

### FAQ

**Who is this actor for?**

It is useful for housing researchers, real estate professionals, mortgage analysts, developers, and data analysts who need SONYMA mortgage loan purchase records.

**What export formats are supported?**

You can export the dataset in JSON, CSV, Excel, and other formats supported by Apify.

**Can I run the actor on a schedule?**

Yes. You can configure an Apify schedule to collect records automatically.

**How can I search for mortgage records in a specific county?**

Choose `search` mode and provide the county name through `searchText`, such as `Erie`.

**How do I retrieve the newest purchases?**

Choose `latest` mode. Records are sorted by loan purchase date in descending order.

**Can I filter records by purchase year?**

Yes. Choose `filter` mode and provide a condition such as `purchase_year = '2016'`.

### Disclaimer

This actor is an independent tool and is not affiliated with, endorsed by, sponsored by, or officially associated with New York State or SONYMA. The collected information comes from publicly available records. Users are responsible for using the data appropriately and respecting applicable terms and requirements.

### Is Web Scraping Legal?

Collecting information that is already public is generally legal. There is no single law that bans all forms of web scraping. The limits are the usual ones: do not break into accounts, do not take private or confidential data, and be careful with personal data and copyrighted works. A site's terms can also restrict how you access it. Facts such as a public name, price, or rating are not the same thing as republishing someone's article or photo.

This actor collects information from public pages. It does not log in and it does not bypass access controls.

For a longer explanation, see Apify's article [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/).

# Actor input Schema

## `mode` (type: `string`):

What to fetch. Search uses full-text $q, filter uses SoQL $where, latest orders by loan purchase date descending.

## `searchText` (type: `string`):

Full-text query sent as $q (search mode).

## `where` (type: `string`):

Raw SoQL $where clause, e.g. purchase_year = '2016' (filter mode).

## `orderBy` (type: `string`):

SoQL $order override, e.g. loan_purchase_date DESC. Latest mode defaults to loan_purchase_date DESC.

## `maxItems` (type: `integer`):

Stop after this many successful rows. Hard max is 1000.

## `requestDelayMs` (type: `integer`):

Polite pacing in milliseconds. Raise if you see HTTP 429.

## `userAgent` (type: `string`):

User-Agent header sent with each request.

## `timeoutSecs` (type: `integer`):

Overall run budget in seconds.

## `requestTimeoutSecs` (type: `integer`):

Per-request timeout in seconds.

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

Optional proxy. Leave off unless you need it.

## Actor input object example

```json
{
  "mode": "search",
  "searchText": "Erie",
  "where": "purchase_year = '2016'",
  "orderBy": "",
  "maxItems": 100,
  "requestDelayMs": 1000,
  "userAgent": "ActorResearch/1.0",
  "timeoutSecs": 300,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Dataset rows in the overview table.

## `dataset` (type: `string`):

Full dataset for this run.

## `items` (type: `string`):

Dataset items as JSON.

# 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 = {
    "searchText": "Erie"
};

// Run the Actor and wait for it to finish
const run = await client.actor("real-estate-api/ny-sonyma-mortgage-loans-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 = { "searchText": "Erie" }

# Run the Actor and wait for it to finish
run = client.actor("real-estate-api/ny-sonyma-mortgage-loans-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "searchText": "Erie"
}' |
apify call real-estate-api/ny-sonyma-mortgage-loans-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,real-estate-api/ny-sonyma-mortgage-loans-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/hWhvcgWkb6DXnQWnp/builds/M5kVd5eB4KGNxfCYX/openapi.json
