# NYC Housing Lottery Tracker (`saffo/nyc-housing-lottery-tracker`) Actor

New York City affordable housing lotteries from HPD's Housing Connect open data, one row per lottery with deadline, unit mix, income bands, preferences and buildings.

- **URL**: https://apify.com/saffo/nyc-housing-lottery-tracker.md
- **Developed by:** [Saffo](https://apify.com/saffo) (community)
- **Categories:** Real estate
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 housing lotteries

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

## NYC Housing Lottery Tracker: deadlines, unit mix and income bands

New York City affordable housing lotteries from HPD's Housing Connect open data, one row per lottery with deadline, unit mix, income bands, preferences and buildings.

### What it does

This NYC housing lottery tracker lists the affordable housing lotteries advertised on NYC Housing Connect, as the NYC Department of Housing Preservation and Development (HPD) publishes them on [NYC Open Data](https://data.cityofnewyork.us/) in the datasets [vy5i-a666](https://data.cityofnewyork.us/resource/vy5i-a666.json) (lotteries) and [nibs-na6y](https://data.cityofnewyork.us/resource/nibs-na6y.json) (buildings). Each result is one lottery with its status, application period, whether it is still open, the days left before the deadline, the units per bedroom count and per income band (share of area median income, AMI), the preference set-asides, its buildings and a link to the lottery's Housing Connect page, where people apply.

The actor reads only the open data API; it never opens Housing Connect, never logs in and never applies. Status, borough and dates are normalised by the actor (for example `Tenant Selection` becomes `tenant-selection`, `BK` becomes `Brooklyn`). HPD refreshes the datasets about once a month. This actor is not affiliated with or endorsed by the City of New York or HPD.

### Who it is for

- Housing counselors and nonprofits who keep clients up to date on which NYC housing lotteries are open and when they close.
- Renter apps, newsletters and journalists who publish the current lotteries by borough, deadline and income band.
- Researchers and affordable-housing developers who compare past lotteries: unit mix, income bands and preferences by neighborhood.

### How to use it

1. Open the actor on [Apify Store](https://apify.com/saffo/nyc-housing-lottery-tracker) and go to its Input tab.
2. Change the fields you need; every field has a default (see Input below).
3. Click **Start**. The run ends at the limits below, or earlier at the "Maximum cost per run" you set.
4. When the run ends, open the Output tab: view the results as a table, or export them as JSON, CSV or Excel.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `statuses` | array | `["active"]` | Lottery statuses to return, any of active, tenant-selection, all-units-filled, closed. Default active (open for applications). Empty returns every status. |
| `developmentType` | string | `"all"` | Development type filter, one of all, rental, owner (homeownership). |
| `boroughs` | array | `[]` | Boroughs to keep, any of manhattan, bronx, brooklyn, queens, staten-island. Empty keeps all five. |
| `postcodes` | array | `[]` | Five-digit ZIP codes to keep. Empty keeps all. |
| `lotteryIds` | array | `[]` | Housing Connect lottery ids to fetch directly (integers), for example \[7718, 7728]. When given, the status, type, borough and date filters are ignored. |
| `startedAfter` | string |  | Only lotteries whose application period started on or after this date (YYYY-MM-DD). Empty means any date. |
| `minUnits` | integer | `1` | Only lotteries with at least this many units. |
| `includeBuildings` | boolean | `true` | Add the buildings array (address, BIN, BBL, districts, construction type) to every lottery. |
| `maxItems` | integer | `200` | Stop after this many lotteries (1 to 5000). |

Example input:

```json
{
  "statuses": [
    "active"
  ],
  "maxItems": 5
}
```

Active rental lotteries in Brooklyn and the Bronx whose application period started on or after 1 October 2026:

```json
{
  "statuses": ["active"],
  "developmentType": "rental",
  "boroughs": ["brooklyn", "bronx"],
  "startedAfter": "2026-10-01"
}
```

### Output

Each result is one dataset item:

| Field | Type | Description |
|---|---|---|
| `url` | string | Web address of the item: its own page, or the page it was read from. |
| `title` | string | Title of the item as shown on the page. |
| `lotteryId` | integer | Housing Connect lottery id. |
| `housingConnectUrl` | string | Public Housing Connect page of the lottery where people apply (built from lotteryId, not fetched). |
| `status` | string | Lottery status, one of active, tenant-selection, all-units-filled, closed. |
| `isOpen` | boolean | True when status is active and the end date is today or later in New York time. |
| `developmentType` | string | rental for rental lotteries, owner for homeownership lotteries. |
| `startDate` | string or null | First day of the application period (YYYY-MM-DD). |
| `endDate` | string or null | Application deadline (YYYY-MM-DD). |
| `daysLeft` | integer or null | Days from the run date (New York time) to endDate, 0 on the last day; null when the deadline has passed. |
| `borough` | string or null | Borough name (Manhattan, Bronx, Brooklyn, Queens, Staten Island); filled from the community board or the buildings when the lottery row has none. |
| `postcode` | string or null | ZIP code of the lottery as published. |
| `communityBoard` | string or null | Community board code, borough digit followed by the board number. |
| `latitude` | number or null | Latitude of the lottery location (WGS 84). |
| `longitude` | number or null | Longitude of the lottery location (WGS 84). |
| `unitCount` | integer | Total units offered in the lottery. |
| `buildingCount` | integer | Number of buildings in the lottery. |
| `unitsByBedroom` | object | Units offered per bedroom count; 0 when the source leaves a size empty. |
| `unitsByIncomeBand` | object | Units offered per HPD area-median-income (AMI) band; 0 when the source leaves a band empty. |
| `preferences` | object | Share of units set aside for each lottery preference group, in percent; null when not published. |
| `buildings` | array | Buildings of the lottery from dataset nibs-na6y; empty when includeBuildings is false. |
| `fetchedAt` | string | When the page was read (ISO 8601, UTC). |

Example output (real items from a test run):

```json
[
  {
    "url": "https://data.cityofnewyork.us/resource/vy5i-a666.json?lottery_id=7718",
    "title": "Kingsland Commons Building 2",
    "lotteryId": 7718,
    "housingConnectUrl": "https://housingconnect.nyc.gov/PublicWeb/details/7718",
    "status": "active",
    "isOpen": true,
    "developmentType": "rental",
    "startDate": "2026-10-30",
    "endDate": "2026-11-25",
    "daysLeft": 7,
    "borough": "Brooklyn",
    "postcode": "11211",
    "communityBoard": "301",
    "latitude": 40.7160891,
    "longitude": -73.9389733,
    "unitCount": 217,
    "buildingCount": 1,
    "unitsByBedroom": {
      "studio": 2,
      "oneBedroom": 98,
      "twoBedroom": 77,
      "threeBedroom": 40,
      "fourPlusBedroom": 0
    },
    "unitsByIncomeBand": {
      "extremelyLow": 16,
      "veryLow": 61,
      "low": 140,
      "moderate": 0,
      "middle": 0,
      "aboveMiddle": 0
    },
    "preferences": {
      "mobilityPercent": 5,
      "visionHearingPercent": 2,
      "communityBoardPercent": 20,
      "municipalEmployeePercent": 10,
      "nychaPercent": null,
      "seniorPercent": null
    },
    "buildings": [
      {
        "streetAddress": "89 Maspeth Ave",
        "postcode": "11211",
        "borough": "Brooklyn",
        "constructionType": "new-construction",
        "unitCount": 217,
        "bin": null,
        "bbl": null,
        "councilDistrict": "34",
        "censusTract2020": "44901",
        "nta2020": "BK0104",
        "hpdBuildingId": null,
        "latitude": 40.715966,
        "longitude": -73.93944
      }
    ],
    "fetchedAt": "2026-11-18T10:20:40.682Z"
  },
  {
    "url": "https://data.cityofnewyork.us/resource/vy5i-a666.json?lottery_id=7728",
    "title": "1506 Southern Boulevard",
    "lotteryId": 7728,
    "housingConnectUrl": "https://housingconnect.nyc.gov/PublicWeb/details/7728",
    "status": "active",
    "isOpen": true,
    "developmentType": "rental",
    "startDate": "2026-10-29",
    "endDate": "2026-11-23",
    "daysLeft": 5,
    "borough": "Bronx",
    "postcode": "10460",
    "communityBoard": "203",
    "latitude": 40.833558,
    "longitude": -73.889638,
    "unitCount": 6,
    "buildingCount": 1,
    "unitsByBedroom": {
      "studio": 1,
      "oneBedroom": 3,
      "twoBedroom": 2,
      "threeBedroom": 0,
      "fourPlusBedroom": 0
    },
    "unitsByIncomeBand": {
      "extremelyLow": 0,
      "veryLow": 0,
      "low": 6,
      "moderate": 0,
      "middle": 0,
      "aboveMiddle": 0
    },
    "preferences": {
      "mobilityPercent": null,
      "visionHearingPercent": null,
      "communityBoardPercent": null,
      "municipalEmployeePercent": null,
      "nychaPercent": null,
      "seniorPercent": null
    },
    "buildings": [
      {
        "streetAddress": "1506 SOUTHERN BOULEVARD",
        "postcode": "10460",
        "borough": "Bronx",
        "constructionType": "new-construction",
        "unitCount": 6,
        "bin": null,
        "bbl": "2029810019",
        "councilDistrict": "17",
        "censusTract2020": "157",
        "nta2020": "BX0303",
        "hpdBuildingId": null,
        "latitude": 40.833566,
        "longitude": -73.89001
      }
    ],
    "fetchedAt": "2026-11-18T10:20:40.682Z"
  }
]
```

Download the dataset as JSON, CSV or Excel, or read it through the Apify API.

### Pricing

Pay per event: a small fee per run plus a fee per result saved. Platform usage is included in these prices.

| Event | When it is charged | Free plan | Bronze plan | Silver plan | Gold plan | Platinum plan | Diamond plan |
|---|---|---|---|---|---|---|---|
| Run started (`run-started`) | Flat fee once per run; covers starting the run and the API queries. | $0.025 | $0.02 | $0.018 | $0.016 | $0.016 | $0.016 |
| Housing lottery (`lottery`) | One housing lottery with its unit mix, income bands, preferences and buildings saved to the dataset. | $0.0063 | $0.005 | $0.0045 | $0.004 | $0.004 | $0.004 |

Example (lowest plan price): a run that saves 100 results costs $0.016 + 100 × $0.004 = **$0.416**. That is $4.00 per 1,000 results plus $0.016 per run. You pay only for results saved to the dataset; set "Maximum cost per run" in the run options and the actor stops there.

On 18 November 2026 the open data listed 47 lotteries with status active; a run that saves all of them costs $0.02 + 47 × $0.005 = $0.255.

### Limits

- One run saves at most 5,000 results and loads at most 25 pages. Larger jobs: split the start URLs over several runs.

- Default memory 256 MB; no proxy.

- When a limit is reached, the run ends normally and keeps every result saved so far; the status message says which limit it was.

- HPD updates the open data about once a month, so a lottery that just opened on Housing Connect can appear here some weeks later.

- The open data has no rents, income limits per household size or application requirements; read those on the lottery's Housing Connect page (`housingConnectUrl`).

- Some lotteries keep the status `Active` in the source after their deadline; use `isOpen` and `daysLeft`, which compare the deadline with the run date in New York time.

- Lotteries spread over several buildings can carry `Multiple` as their published ZIP code or community board, and no coordinates; their buildings carry their own.

### Use with AI agents

AI agents can call this actor as a tool through the Apify MCP server. Add it to an MCP client (Claude Desktop, Cursor, VS Code and others):

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?tools=saffo/nyc-housing-lottery-tracker"
    }
  }
}
```

An agent can then answer questions such as "which housing lotteries in Queens close this week" by running it with `"boroughs": ["queens"]` and reading `daysLeft`.

Or call it over HTTP and get the results in the response:

```sh
curl -X POST "https://api.apify.com/v2/acts/saffo~nyc-housing-lottery-tracker/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"statuses":["active"],"maxItems":5}'
```

### FAQ

#### How much does it cost?

You pay per event: from $0.004 per housing lottery plus $0.016 per run. The Pricing section lists the price on every Apify plan. Platform usage is included, and the run stops at the maximum cost per run you set.

#### Can I use it from an AI agent or my own code?

Yes. Add it to any MCP client through the Apify MCP server, or call the Apify API; the examples under Use with AI agents show both. Results come back as JSON.

#### How many results can one run return?

Up to 5,000 results from at most 25 pages. For more, split the input over several runs.

#### Does it collect personal data?

No. It saves only the fields listed under Output and leaves out names, e-mail addresses, phone numbers and profiles of private persons.

#### How do I apply for a lottery?

Open the lottery's `housingConnectUrl` and apply on NYC Housing Connect. The actor only reads the published open data; it never applies, logs in or contacts anyone.

#### Why is a lottery I saw on Housing Connect missing?

HPD refreshes the open data about once a month, so the newest lotteries reach the datasets some weeks after they open. Check the status and date filters too: by default the actor returns only lotteries with status active.

### Support

Open an issue on the actor's Issues tab.

### Changelog

#### 0.1 (2026-11-18)

- First release: NYC housing lotteries from HPD open data with filters by status, development type, borough, ZIP code, lottery id, start date and unit count; buildings joined to each lottery; open flag, days left before the deadline and the Housing Connect link.

# Changelog

This Actor's version history is a separate document: https://apify.com/saffo/nyc-housing-lottery-tracker/changelog.md

# Actor input Schema

## `statuses` (type: `array`):

Lottery statuses to return, any of active, tenant-selection, all-units-filled, closed. Default active (open for applications). Empty returns every status.

## `developmentType` (type: `string`):

Development type filter, one of all, rental, owner (homeownership).

## `boroughs` (type: `array`):

Boroughs to keep, any of manhattan, bronx, brooklyn, queens, staten-island. Empty keeps all five.

## `postcodes` (type: `array`):

Five-digit ZIP codes to keep. Empty keeps all.

## `lotteryIds` (type: `array`):

Housing Connect lottery ids to fetch directly (integers), for example \[7718, 7728]. When given, the status, type, borough and date filters are ignored.

## `startedAfter` (type: `string`):

Only lotteries whose application period started on or after this date (YYYY-MM-DD). Empty means any date.

## `minUnits` (type: `integer`):

Only lotteries with at least this many units.

## `includeBuildings` (type: `boolean`):

Add the buildings array (address, BIN, BBL, districts, construction type) to every lottery.

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

Stop after this many lotteries (1 to 5000).

## Actor input object example

```json
{
  "statuses": [
    "active"
  ],
  "developmentType": "all",
  "boroughs": [],
  "postcodes": [],
  "lotteryIds": [],
  "minUnits": 1,
  "includeBuildings": true,
  "maxItems": 200
}
```

# Actor output Schema

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

No description

# 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 = {
    "statuses": [
        "active"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("saffo/nyc-housing-lottery-tracker").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 = { "statuses": ["active"] }

# Run the Actor and wait for it to finish
run = client.actor("saffo/nyc-housing-lottery-tracker").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 '{
  "statuses": [
    "active"
  ]
}' |
apify call saffo/nyc-housing-lottery-tracker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,saffo/nyc-housing-lottery-tracker"
        }
    }
}
```

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/2VNiFsTkv7JsmltJZ/builds/D9Ek9Je6cEWbKGRdB/openapi.json
