# HUD Fair Market Rents (FMR) & Section 8 SAFMR Enricher (`groundplanes/hud-fmr-safmr-section8-rent-enricher`) Actor

Extracts official HUD Fair Market Rents (FMR), ZIP-level Small Area FMRs (SAFMR), YoY 3-bedroom rent growth rates, and Section 8 income limits from the HUD USER REST API.

- **URL**: https://apify.com/groundplanes/hud-fmr-safmr-section8-rent-enricher.md
- **Developed by:** [Groundplane Labs](https://apify.com/groundplanes) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.10 / 1,000 rent records

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

## HUD Fair Market Rents (FMR) & Section 8 SAFMR Enricher

Extract official HUD Fair Market Rents (FMR), ZIP-Code Small Area FMRs (SAFMR), Year-over-Year rent growth rates, and Section 8 income limits directly from the official U.S. Department of Housing and Urban Development (HUD USER) API.

***

### Features

- **Granular Rental Standards:** Extracts HUD Fair Market Rents across all standard unit sizes: Efficiency (Studio), 1-Bedroom, 2-Bedroom, 3-Bedroom, and 4-Bedroom.
- **ZIP-Level Small Area FMR (SAFMR):** Automatically un-nests ZIP-level payment standards in designated metropolitan areas where SAFMRs are mandatory or voluntarily adopted for the Housing Choice Voucher (Section 8) program.
- **Automated YoY Rent Growth:** Calculates Year-over-Year (YoY) rent growth percentages for 3-bedroom units by pulling prior-year baseline schedules for the same geographic entity.
- **Boundary Drift Detection:** Identifies geographic entity definition changes (`areaDefinitionChanged: true`) between fiscal years to alert real estate analysts of redistricted metropolitan statistical areas.
- **Section 8 Income Limits:** Enriches rent data with Area Median Family Income (AMI), Very Low Income (50% AMI, 4-person), and Extremely Low Income (30% AMI, 4-person) thresholds.
- **Compliance Rate Limiting:** Enforces strict ~1,100ms request delays to comply with the HUD USER API 60 req/min rate limit, with per-state checkpointing.

***

### Typical Use Cases

- **Section 8 & Affordable Housing Underwriting:** Determine maximum voucher payment standards by ZIP code to evaluate cash flow on potential rental acquisitions.
- **Real Estate Investment & SFR Portfolios:** Screen high-yield ZIP codes where Small Area FMR payment standards exceed median market rents.
- **Housing Authority (PHA) & Policy Research:** Track multi-year rent growth trajectories and income qualification thresholds across federal housing programs.

***

### Prerequisites: Free HUD USER API Token

This actor uses the **buyer-supplied key model**:

1. Register for a free account at [HUD USER Portal](https://www.huduser.gov/portal/dataset/fmr-api.html).
2. Generate your personal API access token.
3. Paste the token into the `hudUserApiToken` input field.

*Note: Your token is treated as an encrypted secret (`isSecret: true`). It is never logged, stored in actor settings, or shared across buyers.*

***

### Input Parameters

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `hudUserApiToken` | String (Secret) | **Yes** | none (required) | Personal API token from huduser.gov. |
| `states` | Array of strings | No | `["TX", "FL", "OH", "GA", "MI"]` | Two-letter US state postal abbreviations. |
| `fiscalYear` | String | No | `"2027"` | HUD Fiscal Year to retrieve (e.g. `'2026'`, `'2027'`). Must be a year HUD has published; an unpublished year fails loudly, it is never filled with prior-year data. |
| `includeZipLevelSmallAreaFmrs` | Boolean | No | `true` | When true, un-nests ZIP-level SAFMR schedules in designated MSAs. |
| `filterZipCodes` | Array of strings | No | `[]` | Optional list of 5-digit ZIP codes to filter (e.g. `["78701", "78702"]`). |
| `includeIncomeLimits` | Boolean | No | `true` | When true, merges Section 8 income limits into the dataset. |
| `maxItems` | Integer | No | `1000` | Maximum number of records to retrieve. |

***

### Output Format

Each dataset row represents an FMR schedule for a county or ZIP code:

```json
{
  "fiscalYear": "2027",
  "stateCode": "TX",
  "countyOrMetroName": "Austin-Round Rock, TX MSA",
  "fipsEntityId": "4845399999",
  "zipCode": "78701",
  "isSmallAreaFmrMandatory": true,
  "fmrEfficiency0BrUsd": 2100,
  "fmr1BedroomUsd": 2350,
  "fmr2BedroomUsd": 2750,
  "fmr3BedroomUsd": 3600,
  "fmr4BedroomUsd": 4300,
  "yoy3BedroomRentIncreasePct": 5.88,
  "areaDefinitionChanged": false,
  "medianFamilyIncomeUsd": 122300,
  "veryLowIncome50Pct4PersonUsd": 61150,
  "extremelyLowIncome30Pct4PersonUsd": 36700
}
```

#### Which fields can be null, and when

The sample row above shows a fully populated ZIP-level row. These fields can be null in real output:

- `zipCode`: null on county and MSA baseline rows (rows that are not ZIP-level Small Area FMR rows).
- `fmrEfficiency0BrUsd`, `fmr1BedroomUsd`, `fmr4BedroomUsd`: null when that bedroom value in the source payload could not be parsed as a number. When this happens the run ends PARTIAL and the status states how many field values failed to parse. A row whose `fmr2BedroomUsd` or `fmr3BedroomUsd` value cannot be parsed is not shipped at all: it is dropped, counted, and reported in the same PARTIAL status, so shipped rows always carry both values.
- `medianFamilyIncomeUsd`, `veryLowIncome50Pct4PersonUsd`, `extremelyLowIncome30Pct4PersonUsd`: null when `includeIncomeLimits` is false, and null on the affected rows when the HUD income-limits request for that entity fails after retries (any HTTP status or network error). In the failure case the run ends PARTIAL naming the affected entities and these three fields.
- `yoy3BedroomRentIncreasePct`: null when the prior fiscal year returns no data for the entity.

***

### Integrity & Quality Guarantees

- **Preflight Authentication:** The actor validates your HUD token on startup against `/fmr/listStates`. If the token is missing or expired, it halts immediately with clear setup instructions.
- **Strict Data Validation:** Core bedroom field keys (`Efficiency`, `One-Bedroom`, `Two-Bedroom`, `Three-Bedroom`, `Four-Bedroom`) are checked for presence on the first `basicdata` entry of every entity payload; a missing key fails the run loudly, naming the field. Separately, the values of all five bedroom fields are parsed for every emitted row in both the ZIP-level and county branches: every value that cannot be parsed is counted, ships null for that field (or drops the row when it is the 2-bedroom or 3-bedroom value), and any counted parse failure or dropped row makes the run end PARTIAL with the counts stated. If more than 20% of matched rows are skipped, the run fails outright as a source or schema problem.
- **Reconciliation:** In the ZIP-level (Small Area FMR) branch only, and only when no ZIP filter is active and the run is not capped, emitted rows are reconciled against the raw `basicdata` array length, with rows dropped for counted parse failures treated as explained; any unexplained mismatch ends the run PARTIAL, naming the entity. The county branch has no array to reconcile against; there, dropped rows and parse failures are surfaced through the counted PARTIAL status described above.

***

### Canary Input

Labeled canary (one small state, current published year):

```json
{
  "hudUserApiToken": "<your HUD USER token>",
  "states": ["RI"],
  "fiscalYear": "2027",
  "includeZipLevelSmallAreaFmrs": true,
  "filterZipCodes": [],
  "includeIncomeLimits": true,
  "maxItems": 1000
}
```

### Source and Cadence

Data comes from the official HUD USER REST API (FMR and income-limit routes). HUD publishes Fair Market Rents and income limits once a year; FY2027 is the latest published year, effective October 1, 2026. This is annual federal data, not real-time data. The actor validates the requested fiscalYear against the latest published year before fetching and fails loudly for an unpublished year rather than returning prior-year data under the requested label.

### Troubleshooting

- **Missing or rejected token:** the run fails immediately with setup instructions. Register for a free token at the HUD USER portal and paste it into the `hudUserApiToken` secret input.
- **Unpublished fiscal year:** the run fails before fetching. Use FY2027 or an earlier published year.
- **Zero matches:** check the state codes and `filterZipCodes`. A filter that matches no ZIP code in the selected states returns a Complete run with 0 rows. A `filterZipCodes` entry that is not a 5-digit ZIP code is an input error and the run fails as invalid input instead.
- **Null income-limit fields:** if the income-limits request for an entity fails after retries, that entity's rows still ship with `medianFamilyIncomeUsd`, `veryLowIncome50Pct4PersonUsd`, and `extremelyLowIncome30Pct4PersonUsd` null, and the run ends PARTIAL naming the affected entities and fields. Null individual FMR fields are reported the same way, with the parse-failure count in the status.
- **Caps:** a run stopped by `maxItems` or by the run charge limit ends PARTIAL naming the cap, with the rows already pushed kept. HUD USER allows 60 requests per minute; the actor waits about 1,100 ms between requests, retries 429 and 5xx responses 6 times with backoff and Retry-After honored, and ends PARTIAL if rate limiting is sustained. Progress is checkpointed per state, so completed states stay in the dataset.
- **Stale data:** HUD data changes once a year at the fiscal-year boundary (October 1). Figures for a fiscal year do not change between those publications except for HUD corrections.

If this keeps happening, please open an issue on this actor's Issues tab and we'll fix it fast.

### Changelog

- **0.2.1 (2026-11-02):** Fix round from Red Team review. Every bedroom field value is now parsed and counted per row in both branches: an unparseable value ships null with a PARTIAL status stating the count instead of a silent Complete, and a dropped matched row is counted and reported the same way. Income-limit fetch failures of any kind (not only HTTP 429) now end the run PARTIAL naming the affected entities and the three null income fields. `isSmallAreaFmrMandatory` is now derived from the payload's `smallarea_status` in both branches, independent of the ZIP un-nesting toggle. Malformed `filterZipCodes` entries fail as invalid input. Status counts no longer duplicate the pushed count, label scanned entries honestly as basicdata entries processed, and report skipped rows. The Integrity section and output documentation now state the validation scope, the reconciliation scope, and field nullability accurately. The actor.json example input no longer carries an empty token string.
- **0.2 (2026-11-01):** Default fiscalYear is now 2027, the current published year. Added a published-year guard: an unpublished fiscalYear fails loudly before fetching instead of risking prior-year data under the requested label. Wired the retry standard into every HUD request (6 tries, jittered 2 to 32 s backoff, 120 s cap, Retry-After honored); sustained 429 responses end the run PARTIAL. Fixed pushed-row counts on multi-state runs (the status overstated rows after the first state). Fixed year-over-year 3-bedroom growth for non-Small-Area counties, which previously always returned null. State codes are now validated before fetching, the 1,100 ms delay now also covers county-list requests, the token input is marked required in the schema, and dead helper code was removed.
- **0.1:** Initial release.

# Actor input Schema

## `filterZipCodes` (type: `array`):

Optional list of 5-digit ZIP codes to filter results. Leave empty to include all.

## `fiscalYear` (type: `string`):

HUD Fiscal Year to retrieve (e.g. '2026', '2027').

## `hudUserApiToken` (type: `string`):

Your free personal API token from HUD USER (https://www.huduser.gov/portal/dataset/fmr-api.html). Entered as a secret. Never shared or logged.

## `includeIncomeLimits` (type: `boolean`):

When true, fetches Median Family Income and 50% / 30% Area Median Income (AMI) limits.

## `includeZipLevelSmallAreaFmrs` (type: `boolean`):

When true, un-nests ZIP-level Small Area FMR schedules in designated metropolitan areas.

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

Maximum number of FMR records/ZIP entries to push to dataset.

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

Two-letter US state postal abbreviations to query (e.g. \['TX', 'FL', 'OH']).

## Actor input object example

```json
{
  "filterZipCodes": [],
  "fiscalYear": "2027",
  "includeIncomeLimits": true,
  "includeZipLevelSmallAreaFmrs": true,
  "maxItems": 1000,
  "states": [
    "TX",
    "FL",
    "OH",
    "GA",
    "MI"
  ]
}
```

# 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 = {
    "filterZipCodes": [],
    "fiscalYear": "2027",
    "maxItems": 1000,
    "states": [
        "TX",
        "FL",
        "OH",
        "GA",
        "MI"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("groundplanes/hud-fmr-safmr-section8-rent-enricher").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 = {
    "filterZipCodes": [],
    "fiscalYear": "2027",
    "maxItems": 1000,
    "states": [
        "TX",
        "FL",
        "OH",
        "GA",
        "MI",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("groundplanes/hud-fmr-safmr-section8-rent-enricher").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 '{
  "filterZipCodes": [],
  "fiscalYear": "2027",
  "maxItems": 1000,
  "states": [
    "TX",
    "FL",
    "OH",
    "GA",
    "MI"
  ]
}' |
apify call groundplanes/hud-fmr-safmr-section8-rent-enricher --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,groundplanes/hud-fmr-safmr-section8-rent-enricher"
        }
    }
}
```

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/ZAGAfivwtbSfATNOy/builds/CZBlrlOQqlIid29nf/openapi.json
