{
  "openapi": "3.0.1",
  "info": {
    "title": "HMDA Fair Lending Disparity Analysis — Denial & Pricing",
    "description": "Fair-lending exam analytics on CFPB HMDA data: denial-rate disparity index with two-proportion z-tests, denial reasons, higher-priced lending, LMI tract redlining screen, and lender-vs-market benchmarks by LEI, state, MSA, county or tract.",
    "version": "2.0",
    "x-build-id": "EqQ6Ur8N07Cpg5grC"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/malonestar~hmda-fair-lending-disparity-rollup/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-malonestar-hmda-fair-lending-disparity-rollup",
        "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/malonestar~hmda-fair-lending-disparity-rollup/runs": {
      "post": {
        "operationId": "runs-sync-malonestar-hmda-fair-lending-disparity-rollup",
        "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/malonestar~hmda-fair-lending-disparity-rollup/run-sync": {
      "post": {
        "operationId": "run-sync-malonestar-hmda-fair-lending-disparity-rollup",
        "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": {
          "states": {
            "title": "States",
            "type": "array",
            "description": "Two-letter US state codes to analyze (e.g. CO, TX, NY). CFPB geography classes are MUTUALLY EXCLUSIVE and the API fails silently (states + counties returns statewide data with HTTP 200), so supply only one of states / MSAs / counties. If you supply more than one, the narrowest wins and a warning is logged.",
            "items": {
              "type": "string"
            }
          },
          "msamds": {
            "title": "MSA / MD codes",
            "type": "array",
            "description": "Five-digit Metropolitan Statistical Area / Metropolitan Division codes (e.g. 19740 = Denver-Aurora-Lakewood, 35620 = New York-Newark-Jersey City). Use instead of states for CRA assessment-area work.",
            "items": {
              "type": "string"
            }
          },
          "counties": {
            "title": "County FIPS codes",
            "type": "array",
            "description": "Five-digit county FIPS codes (e.g. 08031 = Denver County, 48201 = Harris County TX). Use instead of states for county-level fair-lending screening.",
            "items": {
              "type": "string"
            }
          },
          "leis": {
            "title": "Lender LEIs (lender mode)",
            "type": "array",
            "description": "20-character Legal Entity Identifiers of the institutions to screen (e.g. 549300AG64NHILB7ZP05 = loanDepot). Supplying LEIs switches the actor into lender mode: each lender is measured against the market baseline for the same geography and year, plus the national baseline. LEIs may be combined with exactly one geography class to scope the lender to that market.",
            "items": {
              "type": "string"
            }
          },
          "peerBenchmark": {
            "title": "Peer benchmark (market baseline)",
            "type": "boolean",
            "description": "In lender mode, also fetch the all-lender market baseline and the filer roster for the same geography, so every row carries market_denial_rate_pct, lender_vs_market_index, market_rank_by_volume and peer_lender_count. Costs 2 extra API calls per geography-year.",
            "default": true
          },
          "includeNational": {
            "title": "Include national baseline",
            "type": "boolean",
            "description": "Also fetch the nationwide baseline for each group and year (one extra call per year, cached across geographies), populating national_denial_rate_pct and national_disparity_index.",
            "default": false
          },
          "years": {
            "title": "HMDA data years",
            "type": "array",
            "description": "HMDA filing years to analyze, e.g. [\"2024\"] or [\"2023\",\"2024\"]. The CFPB data browser covers 2018 through 2025 (all verified live). Request two or more consecutive years to also get the year-over-year denial-rate change per group. Years outside the covered range are dropped with a warning rather than silently returning nothing.",
            "items": {
              "type": "string"
            }
          },
          "groupBy": {
            "title": "Group by",
            "enum": [
              "race",
              "ethnicity",
              "sex",
              "loan_purpose"
            ],
            "type": "string",
            "description": "Protected class or loan dimension to break denial rates down by: \"race\" (9 HMDA derived-race groups), \"ethnicity\" (Hispanic or Latino origin, a separately protected class under ECOA/FHA and often the largest disparity in the data), \"sex\", or \"loan_purpose\". Disparity indexes and significance tests are computed against the reference group.",
            "default": "race"
          },
          "referenceGroup": {
            "title": "Reference group",
            "type": "string",
            "description": "Group whose denial rate is the disparity baseline: disparity_index = group denial rate / reference denial rate. Defaults to \"White\" for race, \"Not Hispanic or Latino\" for ethnicity and \"Male\" for sex. A value that does not exist for the chosen grouping falls back to that default AND logs a warning."
          },
          "loanPurposes": {
            "title": "Loan purposes (only with groupBy = loan_purpose)",
            "type": "array",
            "description": "Optional list of HMDA loan-purpose codes or labels to include when groupBy is \"loan_purpose\" (1 Home purchase, 2 Home improvement, 31 Refinancing, 32 Cash-out refinancing, 4 Other, 5 Not applicable). Ignored for other groupings because the CFPB API allows at most 2 filters per call.",
            "items": {
              "type": "string"
            }
          },
          "minSampleN": {
            "title": "Minimum sample size for a finding",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Groups with fewer decisioned applications than this cannot produce a finding — they are marked INSUFFICIENT_N instead. This is what stops a three-application census tract from manufacturing a 1.69x 'disparity'. Set to 0 to disable the gate.",
            "default": 30
          },
          "significanceLevel": {
            "title": "Significance level (alpha)",
            "type": "string",
            "description": "Two-sided significance threshold for the pooled two-proportion z-test comparing each group to the reference group. 0.05 = 95% confidence (default). Only disparities that clear BOTH this threshold and the minimum sample size raise a SIGNIFICANT_DISPARITY flag.",
            "default": "0.05"
          },
          "denominator": {
            "title": "Denial-rate denominator",
            "enum": [
              "narrow",
              "ffiec"
            ],
            "type": "string",
            "description": "\"narrow\" = denied / (originated + denied), the cleanest approve-deny decision rate and the v1 default. \"ffiec\" = denied / actions 1-5, which also counts approved-not-accepted, withdrawn and closed-for-incompleteness, matching how several regulator tables are built. The narrow basis runs hotter: CO 2023 Black-vs-White is 1.519 narrow but 1.457 on the FFIEC basis. Both are always emitted; this picks which one drives the headline fields.",
            "default": "narrow"
          },
          "includeDenialReasons": {
            "title": "Denial-reason mix",
            "type": "boolean",
            "description": "Break each group's denials down by HMDA primary denial reason (debt-to-income, credit history, collateral, incomplete, and five more) and index the credit-history share against the reference group. This is the first table in a fair-lending exam workpaper. Requires the loan-level engine, which streams the CFPB LAR export (one extra request per geography-year, roughly 3 seconds for a whole state).",
            "default": false
          },
          "includeRateSpread": {
            "title": "Higher-priced lending (pricing disparity)",
            "type": "boolean",
            "description": "Compute each group's share of originations at or above the 1.5 and 2.5 rate-spread thresholds, the median rate spread, HOEPA high-cost counts, and a higher-priced index vs the reference group. Pricing discrimination is the other core exam analytic alongside denials. Requires the loan-level engine.",
            "default": false
          },
          "includeTractContext": {
            "title": "CRA / LMI tract context",
            "type": "boolean",
            "description": "Add the geographic half of a fair-lending exam: each group's share of originations in low- and moderate-income tracts and in majority-minority tracts, denial rates within those tracts, and penetration indexes that drive the LMI_UNDERSERVED, MINORITY_TRACT_UNDERSERVED and REDLINING_SCREEN_POSITIVE flags. Requires the loan-level engine.",
            "default": false
          },
          "tractLevel": {
            "title": "Emit per-census-tract rows",
            "type": "boolean",
            "description": "Also emit one row per (census tract, group), each with its own disparity index, z-test and CRA income level. Warning: this multiplies result rows — Colorado 2023 alone has 1,419 active tracts. Cap it with maxResults. Requires the loan-level engine.",
            "default": false
          },
          "engine": {
            "title": "Engine",
            "enum": [
              "auto",
              "aggregate",
              "loanlevel"
            ],
            "type": "string",
            "description": "\"auto\" (default) uses the fast aggregation endpoint unless you enabled any exam analytic above, in which case it streams loan-level data. \"aggregate\" forces counts-only. \"loanlevel\" forces the LAR stream, which is a strict superset (it reproduces the aggregate denial rates exactly) but costs a larger download.",
            "default": "auto"
          },
          "maxResults": {
            "title": "Max result rows",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on emitted rows across all geographies, lenders and years (caps your cost). Rows with zero applications are never emitted and never billed. Expected rows = geographies x lenders x years x groups; the run logs this estimate before fetching anything.",
            "default": 1000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}