openapi: 3.0.0
info:
  title: HouseBuildCalc Data API
  description: |
    Static JSON data endpoints for U.S. residential construction costs.
    All endpoints are GET-only, no authentication required.
    Data from the HouseBuildCalc Permit Cost Index (876,000+ building permits, 1,700+ ZIP codes), U.S. Census Bureau, BLS, and NAHB.
  version: "2026.1"
  contact:
    email: contact@housebuildcalc.com
    url: https://housebuildcalc.com/contact/
  license:
    name: Creative Commons Attribution 4.0
    url: https://creativecommons.org/licenses/by/4.0/
servers:
  - url: https://housebuildcalc.com
    description: Production

paths:
  /data/index.json:
    get:
      summary: Data endpoint index
      description: Lists all available data endpoints with field definitions and example queries.
      operationId: getDataIndex
      responses:
        "200":
          description: Data index
          content:
            application/json:
              schema:
                type: object

  /data/costs.json:
    get:
      summary: National average construction costs
      description: |
        National average construction cost per square foot by quality tier (basic/mid/premium),
        style multipliers for 6 architectural styles, line-item breakdown percentages for
        10 construction phases, and mortgage rate reference.
      operationId: getNationalCosts
      responses:
        "200":
          description: National cost data
          content:
            application/json:
              schema:
                type: object
                properties:
                  nationalAverages:
                    type: object
                    properties:
                      tiers:
                        type: object
                        properties:
                          basic:
                            type: object
                            properties:
                              perSqft:
                                type: number
                                example: 139
                                description: Builder-grade cost per sq ft, national average 2026
                          mid:
                            type: object
                            properties:
                              perSqft:
                                type: number
                                example: 188
                                description: Mid-range cost per sq ft, national average 2026
                          premium:
                            type: object
                            properties:
                              perSqft:
                                type: number
                                example: 256
                                description: Premium cost per sq ft, national average 2026
                  styleMultipliers:
                    type: object
                    description: Cost multipliers for each architectural style
                  lineItemBreakdown:
                    type: object
                    description: Percentage of total cost for each construction phase, by quality tier

  /data/states.json:
    get:
      summary: State-level construction cost data
      description: |
        Construction cost data for all 50 U.S. states plus D.C.
        Includes cost per sq ft by tier, cost multiplier, labor index,
        material index, permit costs, climate, region, and building notes.
      operationId: getStateCosts
      responses:
        "200":
          description: State cost data array
          content:
            application/json:
              schema:
                type: object
                properties:
                  states:
                    type: array
                    items:
                      type: object
                      properties:
                        code:
                          type: string
                          example: TX
                          description: 2-letter state code
                        name:
                          type: string
                          example: Texas
                        slug:
                          type: string
                          example: texas
                          description: URL slug for housebuildcalc.com/state/{slug}/
                        multiplier:
                          type: number
                          example: 0.92
                          description: Cost multiplier vs national average (1.00)
                        laborIndex:
                          type: number
                          example: 0.90
                        materialIndex:
                          type: number
                          example: 0.94
                        avgPermitCost:
                          type: number
                          example: 2400
                          description: Typical building permit cost in USD
                        costPerSqft:
                          type: object
                          properties:
                            basic:
                              type: number
                              example: 128
                            mid:
                              type: number
                              example: 173
                            premium:
                              type: number
                              example: 235
                        region:
                          type: string
                          example: South Central
                        climate:
                          type: string
                          example: Humid subtropical/Semi-arid
                        notes:
                          type: array
                          items:
                            type: string

  /data/materials.json:
    get:
      summary: Construction material prices 2022–2026
      description: |
        National average prices for 40+ residential construction materials
        with annual price history from 2022 to 2026.
        Covers framing, concrete, roofing, insulation, drywall, flooring,
        windows, electrical, plumbing, HVAC, and exterior siding.
      operationId: getMaterialCosts
      responses:
        "200":
          description: Material cost data array
          content:
            application/json:
              schema:
                type: object
                properties:
                  materials:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          example: Framing Lumber (2x4x8)
                        unit:
                          type: string
                          example: board
                        category:
                          type: string
                          enum: [framing, concrete, roofing, insulation, drywall, flooring, windows, electrical, plumbing, hvac, exterior]
                        price2022:
                          type: number
                        price2023:
                          type: number
                        price2024:
                          type: number
                        price2025:
                          type: number
                        price2026:
                          type: number
                        changeFrom2022Pct:
                          type: number
                          description: Percentage change from 2022 to 2026
                        yoyChangePct:
                          type: number
                          description: Year-over-year change 2025 to 2026
                        note:
                          type: string

  /data/ppi.json:
    get:
      summary: Official BLS Producer Price Index series for construction materials
      description: |
        Annual averages (2020–2026 YTD) of 8 BLS Producer Price Index commodity series
        covering lumber, softwood lumber, concrete products, steel mill products,
        gypsum, copper/brass, plastic construction products, and asphalt.
        Fetched from the BLS Public Data API; series IDs documented in the meta block.
        Index values (1982=100 base for most series), not retail prices.
      operationId: getPpiSeries
      responses:
        "200":
          description: PPI series with annual averages and change vs 2020
          content:
            application/json:
              schema:
                type: object

  /data/labor-wages.json:
    get:
      summary: Measured construction-trades wages by state (BLS OEWS, May 2025)
      description: |
        Median hourly wage for construction & extraction occupations (SOC 47-0000)
        for all 50 states + D.C., a derived wage index (state ÷ national median),
        plus carpenter, electrician, and plumber medians per state.
      operationId: getLaborWages
      responses:
        "200":
          description: State wage records keyed by 2-letter state code
          content:
            application/json:
              schema:
                type: object

  /data/zhvi-cities.json:
    get:
      summary: Median existing single-family home values for 193 U.S. cities
      description: |
        Zillow Home Value Index (single-family, mid-tier, smoothed & seasonally
        adjusted) for the 193 cities covered on housebuildcalc.com.
        Data provided by Zillow (zillow.com/research/data/); month in meta block.
      operationId: getZhviCities
      responses:
        "200":
          description: City home-value records keyed by stateCode|citySlug
          content:
            application/json:
              schema:
                type: object

  /data/land-prices.json:
    get:
      summary: Reference residential land values by state (FHFA)
      description: |
        Average residential land value per acre and land share of property value
        for all 50 states + D.C., from FHFA Working Paper 19-01 land price data.
        2015 base year — reference estimates, not current market prices.
      operationId: getLandPrices
      responses:
        "200":
          description: State land-value records keyed by 2-letter state code
          content:
            application/json:
              schema:
                type: object

  /data/permit-activity.json:
    get:
      summary: Recent building-permit activity for 6 major cities
      description: |
        12-month permit counts (and new-residential counts / median declared
        valuations where reliably available) for Austin, Chicago, New York,
        San Francisco, Seattle, and Los Angeles, pulled from municipal
        open-data portals. Exact dataset IDs and filters documented per city.
      operationId: getPermitActivity
      responses:
        "200":
          description: City permit-activity records keyed by stateCode|citySlug
          content:
            application/json:
              schema:
                type: object

  # BEGIN generated-endpoints

  /data/city-permits.json:
    get:
      summary: "City-level permit counts & valuations"
      description: |
        Place-level single-family building-permit counts and valuations for 181 U.S. cities (match rate 181/193 against the city list tracked on housebuildcalc.com), 2025 annual file, U.S. Census Bureau Building Permits Survey. Valuations are builder-declared at filing.
      operationId: getCityPermits
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/construction-indicators.json:
    get:
      summary: "Monthly U.S. construction indicators"
      description: |
        Monthly U.S. residential construction indicators through 2026-10-01: single-family housing starts and permits, private residential construction spending, construction employment and average hourly earnings, the construction materials producer price index, the median sale price of new houses, and the two BLS net-inputs-to-residential-construction indexes. Each of the 9 series carries its latest observation, year-over-year and five-year change, and a 60-month history. Collected from FRED, which republishes U.S. Census Bureau and BLS series. Also includes an escalation block restating the Census 2025 contract-price benchmark in 2026 terms (6.5-6.6% input cost increase).
      operationId: getConstructionIndicators
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/county-profiles.json:
    get:
      summary: "County permits since 2000 + home values"
      description: |
        Per-county profile for the 1,112 U.S. counties that permitted at least 100 single-family homes in 2025: single-family units permitted every year 2000-2025 (Census Building Permits Survey county annual files, total including imputation), the pre-2008 peak and its year, average declared permit valuation, and the Zillow Home Value Index for typical existing single-family home value with year-over-year change. Joined on 5-digit FIPS. Deliberately contains no county-level construction cost, because no public dataset measures one.
      operationId: getCountyProfiles
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/degree-days.json:
    get:
      summary: "Heating & cooling degree days by state"
      description: |
        Annual heating degree days (HDD) and cooling degree days (CDD), base 65°F, averaged over 2016-2025, for 48 states, from NOAA's Climate at a Glance statewide time series. Degree days are the standard measure of annual heating and cooling demand and are what HVAC equipment is sized from, so they explain part of why mechanical costs differ between states. Coverage is the contiguous United States only — AK, HI, DC have no statewide series in this NOAA dataset and are omitted rather than estimated.
      operationId: getDegreeDays
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/energy-codes.json:
    get:
      summary: "State residential energy code adoption status"
      description: |
        Residential building energy code adoption status for all 51 states + D.C., from the U.S. Department of Energy Building Energy Codes Program (retrieved 2026-08-23). Home-rule states without a single statewide residential energy code are flagged individually rather than assigned one.
      operationId: getEnergyCodes
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/loan-limits.json:
    get:
      summary: "Conforming loan limits by county"
      description: |
        Conforming loan limits for 3,235 U.S. counties for 2026, from the Federal Housing Finance Agency, with a per-state summary of the baseline, the highest limit and which counties are designated high-cost. The 2026 baseline one-unit limit is $832,750 and the national ceiling is $1,299,500. A loan above its county's limit is a jumbo, underwritten outside Fannie Mae and Freddie Mac.
      operationId: getLoanLimits
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/metro-permits.json:
    get:
      summary: "Metro-level (CBSA) permit history"
      description: |
        Single-family building-permit counts and valuations for 931 U.S. metro/micro areas (CBSAs), 2025 annual file, U.S. Census Bureau Building Permits Survey. Covers approximately 95.8% of national single-family permit volume for 2025 (cross-checked against permit-history.json's national total). Standalone dataset, not currently wired into any page.
      operationId: getMetroPermits
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/metro-wages.json:
    get:
      summary: "Construction-trades wages by metro area (BLS OEWS)"
      description: |
        Median construction & extraction trades hourly wage (SOC 47-0000) for 182 U.S. metro areas, BLS OEWS May 2025. National median: $28.63/hr.
      operationId: getMetroWages
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/mortgage-rate.json:
    get:
      summary: "30-year fixed mortgage rate (weekly)"
      description: |
        Weekly average 30-year fixed mortgage rate (U.S. average), Freddie Mac Primary Mortgage Market Survey via FRED series MORTGAGE30US. Latest: 7.28% as of 2026-11-19; includes a 52-week trailing history.
      operationId: getMortgageRate
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/new-home-characteristics.json:
    get:
      summary: "New single-family home characteristics"
      description: |
        Characteristics of new single-family houses completed in 2025, from the U.S. Census Bureau Survey of Construction, broken out by the 4 Census regions (Northeast/Midwest/South/West). Covers 11 characteristic tables: medianSquareFeet, averageSquareFeet, foundationType, bedrooms, bathrooms, heatingSystem, airConditioning, exteriorWallMaterial, stories, contractPricePerSqFt, salePrice.
      operationId: getNewHomeCharacteristics
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/new-home-size-lot.json:
    get:
      summary: "New-home size distribution & lot size by region"
      description: |
        Distribution of new single-family houses completed by floor-area bracket (2025) and median/average lot size (2025), both broken out by the four U.S. Census regions plus a national total, from the Census Bureau Survey of Construction. Answers how common a given house size actually is in a region rather than only whether it is above or below the median. Lot sizes are given in square feet and acres and exclude condominiums.
      operationId: getNewHomeSizeLot
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/permit-history.json:
    get:
      summary: "County-level permit history, 1990–2025"
      description: |
        County-level single-family (1-unit) building-permit counts and valuations, U.S. Census Bureau Building Permits Survey annual county files, 1990–2025. Covers all 50 states + D.C. (no Puerto Rico rows). Includes a national annual time series (36 years) and a per-state annual time series for each of the 51 states. Valuations are builder-declared at filing.
      operationId: getPermitHistory
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/permit-seasonality.json:
    get:
      summary: "Monthly permit seasonality, national & by state"
      description: |
        Month-by-month share of annual single-family permit activity, U.S. Census Bureau Building Permits Survey monthly state files, 2021–2025. Includes the 12-month national average share (peak: March, trough: December) plus per-state and national monthly time series (60 national month-rows across all 51 states).
      operationId: getPermitSeasonality
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/soc-duration.json:
    get:
      summary: "How long a build takes (Census microdata)"
      description: |
        How long a single-family house actually takes to build, computed from the start and completion month of each house in the U.S. Census Bureau Survey of Construction 2023–2025 public use microdata — not from a published average. Reports survey-weighted median, quartiles and 90th percentile for contractor-built houses overall, by census division, by house size, by construction method, by start season, and separately for built-for-sale (spec) houses. Principal findings: a contractor-built house runs a median of 9 months with a quarter taking over 13; spec houses complete in 5; duration rises with size from 7 months under 1,800 sq ft to 13 months above 4,000; modular houses finish in a median of 4 months against 9 site-built, inside every size band; and the season construction starts makes little difference. Each house is counted once, in the year it was completed. Records with a missing or zero start date, completion before start, or a duration over 48 months. No imputation flag exists for these two fields, so imputed dates cannot be excluded.
      operationId: getSocDuration
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/soc-features.json:
    get:
      summary: "Foundation & garage cost effects, real contract price distribution (Census microdata)"
      description: |
        What a house's foundation and garage do to its contract price, measured from 3,639 contractor-built detached homes in the U.S. Census Bureau Survey of Construction 2023-2025 public use microdata, plus the distribution of contract price per square foot by census division. Survey-weighted regression of log contract price on log floor area, division, year, the features and controls (bathrooms, bedrooms, fireplaces, deck, porch, patio, central air, wall material, heating, framing, construction method). Findings: a basement costs 8.2% and a crawl space 9.4% more than a slab; a 3+ car garage 9.3% more than a 2-car garage and no garage -9.4%. Each level carries a 95% interval, its t statistic and whether it is used (|t| >= 2). divisionMix gives each division's share of each level, which the calculator uses to price a choice relative to what is typical there. Prices restated to current dollars with BLS residential construction input PPIs. Census-changed (capped or imputed) records excluded.
      operationId: getSocFeatures
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/soc-microdata.json:
    get:
      summary: "Cost per sq ft by house size (Census microdata)"
      description: |
        Analysis of 3,701 individual contractor-built single-family house records from the U.S. Census Bureau Survey of Construction 2023–2025 public use microdata — the per-house records behind Census's published tables, not the tables themselves. Each house is counted once, in the year it was completed, and contract prices are restated to current dollars. Reports weighted contract price per square foot (land excluded) by house-size bracket, by census division, by construction method, and the spread both market-wide and for a like-for-like build. Principal finding: From 1,400 to 3,999 sq ft, contract price per square foot stays within 3% of the overall median, so a flat rate is a fair model there. The smallest homes (under 1,000 sq ft) cost 24% more per square foot than the median, so a flat rate understates them. The largest (4,000 sq ft or more) cost 6% less. The sizeAdjustment block holds the fitted size curve the site's estimates apply (flat from 1600 to 3000 sq ft). Survey weights applied; Census-imputed records excluded; cells under 25 records suppressed.
      operationId: getSocMicrodata
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/zhvi-states.json:
    get:
      summary: "Existing home value by state (Zillow ZHVI)"
      description: |
        Typical existing single-family home value for all 50 states + D.C., Zillow Home Value Index (mid-tier, smoothed, seasonally adjusted), month 2026-10-31, with year-over-year change. ZHVI is an index of typical value, not a median sale price. Used as the "buy" side of the build-vs-buy comparisons.
      operationId: getZhviStates
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/zip-lookup.json:
    get:
      summary: "ZIP to county, with local permits and values"
      description: |
        ZIP-code-to-county lookup for 32,759 ZIP codes across 2,998 counties, built from the Census 2020 ZCTA-to-county relationship file, with each county's latest single-family permit count and typical home value attached. Powers the by-ZIP lookup tool. Contains no per-ZIP construction cost: no public dataset measures construction cost at ZIP level, and permit valuations are builder-declared rather than finished costs.
      operationId: getZipLookup
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  /data/zip_costs.json:
    get:
      summary: "ZIP-level cost calibration data (internal)"
      description: |
        Internal ZIP-level construction-cost calibration dataset behind the HouseBuildCalc Permit Cost Index: 1772 ZIP codes, each with city/state, low/mid/high cost-per-square-foot calibration, and the underlying permit sample size. This is the granular data the site's national/state/materials figures are calibrated from. It predates a formal meta block and is not tied to a single external publication vintage.
      operationId: getZipCosts
      responses:
        "200":
          description: "Dataset response"
          content:
            application/json:
              schema:
                type: object

  # END generated-endpoints
