Skip to content

Mortgage · Calculation

Bank-statement affordability worksheet

Model a 12- or 24-month business-deposit or personal-distribution scenario using entered exclusions, ownership, costs, DTI, LTV and reserve assumptions.

Open Mortgage Affordability in HT Calc

Open Bank statements in the affordability calculator.

Example result · recentEligible: 120000 See output

Cost per success
2 calculation credits
Production plans
Standard, Business, Scale, Enterprise
Plan allowances
Free sandbox
Not available

Integration example

Make a request

Use a production key scoped to bank-statement-affordability.

Keep the key on your server. A successful call uses 2 calculation credits.

Production request

Set HT_PRODUCTION_KEY on your server. Save as example.mjs and run node example.mjs with Node.js 18 or later.

import { randomUUID } from "node:crypto";

const key = process.env.HT_PRODUCTION_KEY;
if (!key) throw new Error("Set HT_PRODUCTION_KEY on your server.");
const endpoint = "https://calc.hasstechapi.com/v2/calc/bank-statement-affordability";
const input = {
  "version": 1,
  "months": 24,
  "completeHistory": true,
  "treatment": "business",
  "recentDeposits": 132000,
  "recentExcluded": 12000,
  "priorDeposits": 156000,
  "priorExcluded": 12000,
  "expensePercent": 40,
  "ownershipPercent": 80,
  "useLowerRecent": true,
  "otherMonthlyIncome": 1200,
  "monthlyDebts": 500,
  "downPaymentCash": 30000,
  "interestRate": 6.25,
  "rateEdited": true,
  "loanTerm": 30,
  "targetDti": 40,
  "maxLtv": 80,
  "loanLimit": 300000,
  "propertyTaxRate": 1,
  "insuranceRate": 0.4,
  "monthlyHoa": 50,
  "otherMonthlyHousing": 30,
  "reserveMonths": 6,
  "postClosingReserves": 7000
};
const requestId = process.env.HT_REQUEST_ID || Date.now() + "." + randomUUID();
// Keep this ID to look up usage if the connection is interrupted.
console.error("Usage lookup ID:", requestId);

const response = await fetch(endpoint, {
  method: "POST",
  redirect: "error",
  headers: {
    "Authorization": "Bearer " + key,
    "Content-Type": "application/json",
    "Idempotency-Key": requestId
  },
  body: JSON.stringify(input)
});
if (!response.ok) {
  const problem = await response.json().catch(() => null);
  const code = problem?.error?.code || response.statusText;
  const delay = response.headers.get("retry-after");
  if (delay) console.error("Retry-After (seconds):", delay);
  console.error("HTTP " + response.status + " " + code + ". Usage lookup ID: " + requestId);
  if (Array.isArray(problem?.error?.details)) {
    for (const issue of problem.error.details) console.error("Input issue:", JSON.stringify(issue));
  }
  process.exitCode = 1;
} else {
  console.log(JSON.stringify(await response.json(), null, 2));
}
cURL (shell)

Set HT_PRODUCTION_KEY on your server. Run in a POSIX shell with cURL 7.76+ and Python 3.7+ to create a request ID.

(
  set -eu
  : "${HT_PRODUCTION_KEY:?Set HT_PRODUCTION_KEY on your server}"
  request_id="${HT_REQUEST_ID:-}"
  if [ -z "$request_id" ]; then
    request_id=$(python3 -c 'import time, uuid; print(str(time.time_ns() // 1000000) + "." + str(uuid.uuid4()))')
  fi
  printf 'Usage lookup ID: %s\n' "$request_id" >&2
  # On INVALID_INPUT, read error.details in the JSON response body.
  curl --disable --silent --show-error --fail-with-body --include \
    --request POST 'https://calc.hasstechapi.com/v2/calc/bank-statement-affordability' \
    --header "Authorization: Bearer $HT_PRODUCTION_KEY" \
    --header 'Content-Type: application/json' \
    --header "Idempotency-Key: $request_id" \
    --data-binary @- <<'HT_INPUT'
{
  "version": 1,
  "months": 24,
  "completeHistory": true,
  "treatment": "business",
  "recentDeposits": 132000,
  "recentExcluded": 12000,
  "priorDeposits": 156000,
  "priorExcluded": 12000,
  "expensePercent": 40,
  "ownershipPercent": 80,
  "useLowerRecent": true,
  "otherMonthlyIncome": 1200,
  "monthlyDebts": 500,
  "downPaymentCash": 30000,
  "interestRate": 6.25,
  "rateEdited": true,
  "loanTerm": 30,
  "targetDti": 40,
  "maxLtv": 80,
  "loanLimit": 300000,
  "propertyTaxRate": 1,
  "insuranceRate": 0.4,
  "monthlyHoa": 50,
  "otherMonthlyHousing": 30,
  "reserveMonths": 6,
  "postClosingReserves": 7000
}
HT_INPUT
)
If your request fails
400 INVALID_INPUT

Read error.details when present. Node prints each issue. cURL returns the JSON body. Each path points into your request. An empty path refers to the whole body.

Check the accepted inputs for required fields, units and ranges. Send the corrected JSON as a new request.

401 or 403
Check that the server has the bearer key for the endpoint’s environment and that the key includes bank-statement-affordability.
429
Read the service error code, check your allowance, and wait for the Retry-After interval when supplied before trying again.
Lost response, 409 or 503
Open Request lookup, select the same environment and enter the printed usage lookup ID. A settled ID has already consumed credits. To retry the same calculation, set HT_REQUEST_ID to the original ID and reuse the same inputs. A settled request does not return its result again. Unset the variable for a new request, which can consume credits.

The usage lookup ID is the Idempotency-Key your server sends. The response’s x-request-id identifies the HTTP exchange for support.

Output

Example result

These values come from running this operation on the example inputs.

recentEligible
120000
priorEligible
144000
averageMonthlyDeposits
11000
How to interpret this result
  • A caller-supplied bank-statement scenario. No lender matrix, credit decision, or automatic rate lookup.
Full example response (JSON)
{
  "status": "available",
  "result": {
    "valid": true,
    "errors": [],
    "recentEligible": 120000,
    "priorEligible": 144000,
    "averageMonthlyDeposits": 11000,
    "selectedMonthlyDeposits": 10000,
    "declining": true,
    "bankMonthlyIncome": 4800,
    "totalMonthlyIncome": 6000,
    "housingBudget": 1900,
    "homePrice": 150000,
    "loanAmount": 120000,
    "downPaymentUsed": 30000,
    "monthlyPi": 738.8606405116698,
    "monthlyTax": 125,
    "monthlyInsurance": 50,
    "monthlyHousing": 993.8606405116698,
    "actualDti": 24.897677341861165,
    "actualLtv": 80,
    "requiredReserves": 5963.163843070019,
    "reserveShortfall": 0,
    "limitingFactor": "down-payment"
  },
  "formulaVersion": "bank-statement-affordability-htcalc-719df2c0e105",
  "units": {
    "bankMonthlyIncome": "USD/month",
    "selectedMonthlyDeposits": "USD/month",
    "totalMonthlyIncome": "USD/month",
    "housingBudget": "USD/month",
    "homePrice": "USD",
    "loanAmount": "USD",
    "requiredReserves": "USD",
    "actualDti": "percent",
    "actualLtv": "percent"
  },
  "assumptions": [
    "A caller-supplied bank-statement scenario. No lender matrix, credit decision, or automatic rate lookup."
  ],
  "warnings": [],
  "creditCost": 2
}

Request contract

Accepted inputs

Fields for this example. Expand the schema for all supported combinations and limits.

FieldType, units and limits

versionRequired
numberMust equal 1
monthsRequired
numberAllowed: 12, 24
completeHistoryRequired
boolean
treatmentRequired
stringAllowed: "business", "personal-distributions"
recentDepositsRequired
number

US dollars

Min 0 · Max 1000000000
recentExcludedRequired
number

US dollars

Min 0 · Max 1000000000
priorDepositsRequired
number

US dollars

Min 0 · Max 1000000000
priorExcludedRequired
number

US dollars

Min 0 · Max 1000000000
expensePercentRequired
number

Percentage points (5 means 5%)

Min 0 · Max 100
ownershipPercentRequired
number

Percentage points (5 means 5%)

Min 0 · Max 100
useLowerRecentRequired
boolean
otherMonthlyIncomeRequired
number

US dollars per month

Min 0 · Max 1000000000
monthlyDebtsRequired
number

US dollars per month

Min 0 · Max 1000000000
downPaymentCashRequired
number

US dollars

Min 0 · Max 1000000000
interestRateRequired
number

Annual interest in percent (5 means 5%)

Min 0 · Max 50
rateEditedRequired
boolean
loanTermRequired
integer

Whole years

Min 1 · Max 50
targetDtiRequired
number

DTI in percent

Min 1 · Max 100
maxLtvRequired
number

Maximum loan-to-value in percent

Min 1 · Max 99.9
loanLimitRequired
number

US dollars

Min 0 · Max 1000000000
propertyTaxRateRequired
number

Percentage points (5 means 5%)

Min 0 · Max 100
insuranceRateRequired
number

Percentage points (5 means 5%)

Min 0 · Max 100
monthlyHoaRequired
number

US dollars per month

Min 0 · Max 1000000000
otherMonthlyHousingRequired
number

US dollars per month

Min 0 · Max 1000000000
reserveMonthsRequired
integer

Months

Min 0 · Max 60
postClosingReservesRequired
number

US dollars

Min 0 · Max 1000000000
Example request body (JSON)
{
  "version": 1,
  "months": 24,
  "completeHistory": true,
  "treatment": "business",
  "recentDeposits": 132000,
  "recentExcluded": 12000,
  "priorDeposits": 156000,
  "priorExcluded": 12000,
  "expensePercent": 40,
  "ownershipPercent": 80,
  "useLowerRecent": true,
  "otherMonthlyIncome": 1200,
  "monthlyDebts": 500,
  "downPaymentCash": 30000,
  "interestRate": 6.25,
  "rateEdited": true,
  "loanTerm": 30,
  "targetDti": 40,
  "maxLtv": 80,
  "loanLimit": 300000,
  "propertyTaxRate": 1,
  "insuranceRate": 0.4,
  "monthlyHoa": 50,
  "otherMonthlyHousing": 30,
  "reserveMonths": 6,
  "postClosingReserves": 7000
}
Full JSON schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "version": {
      "const": 1
    },
    "months": {
      "type": "number",
      "enum": [
        12,
        24
      ]
    },
    "completeHistory": {
      "type": "boolean"
    },
    "treatment": {
      "type": "string",
      "enum": [
        "business",
        "personal-distributions"
      ]
    },
    "recentDeposits": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars"
    },
    "recentExcluded": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars"
    },
    "priorDeposits": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars"
    },
    "priorExcluded": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars"
    },
    "expensePercent": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Percentage points (5 means 5%)"
    },
    "ownershipPercent": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Percentage points (5 means 5%)"
    },
    "useLowerRecent": {
      "type": "boolean"
    },
    "otherMonthlyIncome": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars per month"
    },
    "monthlyDebts": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars per month"
    },
    "downPaymentCash": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars"
    },
    "interestRate": {
      "type": "number",
      "minimum": 0,
      "maximum": 50,
      "description": "Annual interest in percent (5 means 5%)"
    },
    "rateEdited": {
      "type": "boolean"
    },
    "loanTerm": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50,
      "description": "Whole years"
    },
    "targetDti": {
      "type": "number",
      "minimum": 1,
      "maximum": 100,
      "description": "DTI in percent"
    },
    "maxLtv": {
      "type": "number",
      "minimum": 1,
      "maximum": 99.9,
      "description": "Maximum loan-to-value in percent"
    },
    "loanLimit": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars"
    },
    "propertyTaxRate": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Percentage points (5 means 5%)"
    },
    "insuranceRate": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Percentage points (5 means 5%)"
    },
    "monthlyHoa": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars per month"
    },
    "otherMonthlyHousing": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars per month"
    },
    "reserveMonths": {
      "type": "integer",
      "minimum": 0,
      "maximum": 60,
      "description": "Months"
    },
    "postClosingReserves": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "US dollars"
    }
  },
  "required": [
    "version",
    "months",
    "completeHistory",
    "treatment",
    "recentDeposits",
    "recentExcluded",
    "priorDeposits",
    "priorExcluded",
    "expensePercent",
    "ownershipPercent",
    "useLowerRecent",
    "otherMonthlyIncome",
    "monthlyDebts",
    "downPaymentCash",
    "interestRate",
    "rateEdited",
    "loanTerm",
    "targetDti",
    "maxLtv",
    "loanLimit",
    "propertyTaxRate",
    "insuranceRate",
    "monthlyHoa",
    "otherMonthlyHousing",
    "reserveMonths",
    "postClosingReserves"
  ]
}

Production endpoint: POST https://calc.hasstechapi.com/v2/calc/bank-statement-affordability
Formula: bank-statement-affordability-htcalc-719df2c0e105