Skip to content

Mortgage · Calculation

Compare purchase cash strategies at quoted rates

Compare entered fixed-rate purchase quotes by starting payment, lifetime interest, closing equity, retained cash and a designated future FHA remodel.

Open Loan Estimate Analyzer in HT Calc

This HT Calc screen includes a Pro sample for visitors.

Example result · horizonMonths: 12 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 purchase-cash-and-rate-strategies.

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/purchase-cash-and-rate-strategies";
const input = {
  "homePrice": 300000,
  "cashAvailable": 65000,
  "reserveTarget": 10000,
  "horizonMonths": 12,
  "horizonHomeValue": 300000,
  "monthlyPropertyTax": 250,
  "monthlyHomeInsurance": 100,
  "monthlyHoa": 50,
  "options": [
    {
      "downPayment": 60000,
      "quotedAnnualRate": 0,
      "termYears": 20,
      "closingCashCosts": 5000,
      "pointCost": 0,
      "lenderCredit": 0,
      "financedFees": 0,
      "monthlyMortgageInsurance": 0,
      "mortgageInsuranceMonths": 0,
      "immediateProjectCash": 0
    },
    {
      "downPayment": 30000,
      "quotedAnnualRate": 0,
      "termYears": 20,
      "closingCashCosts": 5000,
      "pointCost": 0,
      "lenderCredit": 1000,
      "financedFees": 0,
      "monthlyMortgageInsurance": 110,
      "mortgageInsuranceMonths": 84,
      "immediateProjectCash": 6000
    }
  ]
};
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/purchase-cash-and-rate-strategies' \
    --header "Authorization: Bearer $HT_PRODUCTION_KEY" \
    --header 'Content-Type: application/json' \
    --header "Idempotency-Key: $request_id" \
    --data-binary @- <<'HT_INPUT'
{
  "homePrice": 300000,
  "cashAvailable": 65000,
  "reserveTarget": 10000,
  "horizonMonths": 12,
  "horizonHomeValue": 300000,
  "monthlyPropertyTax": 250,
  "monthlyHomeInsurance": 100,
  "monthlyHoa": 50,
  "options": [
    {
      "downPayment": 60000,
      "quotedAnnualRate": 0,
      "termYears": 20,
      "closingCashCosts": 5000,
      "pointCost": 0,
      "lenderCredit": 0,
      "financedFees": 0,
      "monthlyMortgageInsurance": 0,
      "mortgageInsuranceMonths": 0,
      "immediateProjectCash": 0
    },
    {
      "downPayment": 30000,
      "quotedAnnualRate": 0,
      "termYears": 20,
      "closingCashCosts": 5000,
      "pointCost": 0,
      "lenderCredit": 1000,
      "financedFees": 0,
      "monthlyMortgageInsurance": 110,
      "mortgageInsuranceMonths": 84,
      "immediateProjectCash": 6000
    }
  ]
}
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 purchase-cash-and-rate-strategies.
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.

horizonMonths
12
goalResults.lowest-payment.value
1400 USD/month
goalResults.lowest-cost.value
0 USD
How to interpret this result
  • Supply a final lender-quoted fixed rate for each down-payment and points combination, including any applicable pricing adjustments.
  • Cash closing costs exclude separately entered points, down payment and financed fees. Apply only credits usable against the supplied cash costs and points.
  • Level monthly mortgage insurance applies for the entered period. Horizon property value and immediate cash projects are independent assumptions. Signed equity and remaining cash preserve a shortfall.
  • Compare caller-selected fixed quotes that can cover cash due at closing. Reserve targets and immediate projects are separately reported. Cash funding is a worksheet arithmetic test. The goal results do not establish loan approval or market availability.
  • Goal rankings use whole-dollar initial housing payment, lifetime interest and base-loan equity, plus exact retained cash before projects. Tied options are listed in entry order. Signed equityAtClosing includes all financed fees. goalEquityAtClosing excludes the explicitly identified financed FHA upfront MIP or VA funding fee and floors equity at zero as in the app.
  • To review a planned remodel, identify a borrower-selected primary-residence FHA quote and state the planned future budget. The planned budget is compared to cash retained at closing before projects or reserves. Use it for a future project separate from any immediate cash already entered. Optional annual appreciation estimates the 80% base-loan LTV month; that milestone is not an assurance of future refinance terms.
Full example response (JSON)
{
  "status": "available",
  "result": {
    "horizonMonths": 12,
    "options": [
      {
        "optionIndex": 0,
        "principal": 240000,
        "principalAndInterest": 1000,
        "cashToClose": 65000,
        "cashAfterClosing": 0,
        "cashAfterProjects": 0,
        "reserveShortfall": 10000,
        "horizonBalance": 228000,
        "horizonEquity": 72000,
        "horizonMortgageInsurance": 0,
        "initialMonthlyHousing": 1400,
        "equityAtClosing": 60000,
        "goalEquityAtClosing": 60000,
        "lifetimeInterest": 0
      },
      {
        "optionIndex": 1,
        "principal": 270000,
        "principalAndInterest": 1125,
        "cashToClose": 34000,
        "cashAfterClosing": 31000,
        "cashAfterProjects": 25000,
        "reserveShortfall": 0,
        "horizonBalance": 256500,
        "horizonEquity": 43500,
        "horizonMortgageInsurance": 1320,
        "initialMonthlyHousing": 1635,
        "equityAtClosing": 30000,
        "goalEquityAtClosing": 30000,
        "lifetimeInterest": 0
      }
    ],
    "goalResults": {
      "lowest-payment": {
        "value": 1400,
        "optionIndices": [
          0
        ]
      },
      "lowest-cost": {
        "value": 0,
        "optionIndices": [
          0,
          1
        ]
      },
      "max-equity": {
        "value": 60000,
        "optionIndices": [
          0
        ]
      },
      "keep-cash-liquid": {
        "value": 31000,
        "optionIndices": [
          1
        ]
      },
      "plan-future-remodel": null
    }
  },
  "formulaVersion": "purchase-cash-and-rate-strategies-htcalc-719df2c0e105",
  "units": {
    "options[].principal": "USD",
    "options[].principalAndInterest": "USD/month",
    "options[].cashToClose": "USD",
    "options[].cashAfterProjects": "USD",
    "options[].reserveShortfall": "USD",
    "options[].horizonBalance": "USD",
    "options[].horizonEquity": "USD",
    "options[].horizonMortgageInsurance": "USD",
    "options[].initialMonthlyHousing": "USD/month",
    "goalResults.keep-cash-liquid.value": "USD",
    "goalResults.lowest-cost.value": "USD",
    "goalResults.lowest-payment.value": "USD/month",
    "goalResults.max-equity.value": "USD",
    "goalResults.plan-future-remodel.budgetShortfall": "USD",
    "goalResults.plan-future-remodel.cashAfterClosing": "USD",
    "goalResults.plan-future-remodel.modeled80PctLtvMonth": "months",
    "goalResults.plan-future-remodel.plannedBudget": "USD",
    "options[].cashAfterClosing": "USD",
    "options[].equityAtClosing": "USD",
    "options[].goalEquityAtClosing": "USD",
    "options[].lifetimeInterest": "USD"
  },
  "assumptions": [
    "Supply a final lender-quoted fixed rate for each down-payment and points combination, including any applicable pricing adjustments.",
    "Cash closing costs exclude separately entered points, down payment and financed fees. Apply only credits usable against the supplied cash costs and points.",
    "Level monthly mortgage insurance applies for the entered period. Horizon property value and immediate cash projects are independent assumptions. Signed equity and remaining cash preserve a shortfall.",
    "Compare caller-selected fixed quotes that can cover cash due at closing. Reserve targets and immediate projects are separately reported. Cash funding is a worksheet arithmetic test. The goal results do not establish loan approval or market availability.",
    "Goal rankings use whole-dollar initial housing payment, lifetime interest and base-loan equity, plus exact retained cash before projects. Tied options are listed in entry order. Signed equityAtClosing includes all financed fees. goalEquityAtClosing excludes the explicitly identified financed FHA upfront MIP or VA funding fee and floors equity at zero as in the app.",
    "To review a planned remodel, identify a borrower-selected primary-residence FHA quote and state the planned future budget. The planned budget is compared to cash retained at closing before projects or reserves. Use it for a future project separate from any immediate cash already entered. Optional annual appreciation estimates the 80% base-loan LTV month; that milestone is not an assurance of future refinance terms."
  ],
  "warnings": [],
  "creditCost": 2
}

Request contract

Accepted inputs

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

FieldType, units and limits

homePriceRequired
numberMin 0.01 · Max 100000000
cashAvailableRequired
numberMin 0 · Max 100000000
reserveTargetRequired
numberMin 0 · Max 100000000
horizonMonthsRequired
integerMin 0 · Max 480
horizonHomeValueRequired
numberMin 0 · Max 100000000
monthlyPropertyTaxRequired
numberMin 0 · Max 1000000
monthlyHomeInsuranceRequired
numberMin 0 · Max 1000000
monthlyHoaRequired
numberMin 0 · Max 1000000
optionsRequired
arrayMin items 2 · Max items 5
options[].downPaymentRequired
numberMin 0 · Max 100000000
options[].quotedAnnualRateRequired
numberMin 0 · Max 100
options[].termYearsRequired
integerMin 1 · Max 40
options[].closingCashCostsRequired
numberMin 0 · Max 100000000
options[].pointCostRequired
numberMin 0 · Max 100000000
options[].lenderCreditRequired
numberMin 0 · Max 100000000
options[].financedFeesRequired
numberMin 0 · Max 100000000
options[].monthlyMortgageInsuranceRequired
numberMin 0 · Max 1000000
options[].mortgageInsuranceMonthsRequired
integerMin 0 · Max 480
options[].immediateProjectCashRequired
numberMin 0 · Max 100000000
options[].financedGovernmentFeeOptional
numberMin 0 · Max 100000000
options[].loanProgramOptional
stringAllowed: "conventional", "fha", "va", "usda", "jumbo", "other"
primaryFhaRemodelOptional
object
primaryFhaRemodel.annualAppreciationPctOptional
numberMin -50 · Max 50
primaryFhaRemodel.optionIndexRequired
integerMin 0 · Max 4
primaryFhaRemodel.plannedBudgetRequired
numberMax 100000000 · Greater than 0
Example request body (JSON)
{
  "homePrice": 300000,
  "cashAvailable": 65000,
  "reserveTarget": 10000,
  "horizonMonths": 12,
  "horizonHomeValue": 300000,
  "monthlyPropertyTax": 250,
  "monthlyHomeInsurance": 100,
  "monthlyHoa": 50,
  "options": [
    {
      "downPayment": 60000,
      "quotedAnnualRate": 0,
      "termYears": 20,
      "closingCashCosts": 5000,
      "pointCost": 0,
      "lenderCredit": 0,
      "financedFees": 0,
      "monthlyMortgageInsurance": 0,
      "mortgageInsuranceMonths": 0,
      "immediateProjectCash": 0
    },
    {
      "downPayment": 30000,
      "quotedAnnualRate": 0,
      "termYears": 20,
      "closingCashCosts": 5000,
      "pointCost": 0,
      "lenderCredit": 1000,
      "financedFees": 0,
      "monthlyMortgageInsurance": 110,
      "mortgageInsuranceMonths": 84,
      "immediateProjectCash": 6000
    }
  ]
}
Full JSON schema
{
  "type": "object",
  "properties": {
    "homePrice": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 100000000
    },
    "cashAvailable": {
      "type": "number",
      "minimum": 0,
      "maximum": 100000000
    },
    "reserveTarget": {
      "type": "number",
      "minimum": 0,
      "maximum": 100000000
    },
    "horizonMonths": {
      "type": "integer",
      "minimum": 0,
      "maximum": 480
    },
    "horizonHomeValue": {
      "type": "number",
      "minimum": 0,
      "maximum": 100000000
    },
    "monthlyPropertyTax": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000
    },
    "monthlyHomeInsurance": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000
    },
    "monthlyHoa": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000
    },
    "options": {
      "type": "array",
      "minItems": 2,
      "maxItems": 5,
      "items": {
        "type": "object",
        "properties": {
          "downPayment": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "quotedAnnualRate": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
            "anyOf": [
              {
                "const": 0
              },
              {
                "minimum": 0.001
              }
            ]
          },
          "termYears": {
            "type": "integer",
            "minimum": 1,
            "maximum": 40
          },
          "closingCashCosts": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "pointCost": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "lenderCredit": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "financedFees": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "monthlyMortgageInsurance": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000
          },
          "mortgageInsuranceMonths": {
            "type": "integer",
            "minimum": 0,
            "maximum": 480
          },
          "immediateProjectCash": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000000
          },
          "financedGovernmentFee": {
            "maximum": 100000000,
            "minimum": 0,
            "type": "number"
          },
          "loanProgram": {
            "enum": [
              "conventional",
              "fha",
              "va",
              "usda",
              "jumbo",
              "other"
            ],
            "type": "string"
          }
        },
        "required": [
          "downPayment",
          "quotedAnnualRate",
          "termYears",
          "closingCashCosts",
          "pointCost",
          "lenderCredit",
          "financedFees",
          "monthlyMortgageInsurance",
          "mortgageInsuranceMonths",
          "immediateProjectCash"
        ],
        "additionalProperties": false
      }
    },
    "primaryFhaRemodel": {
      "additionalProperties": false,
      "properties": {
        "annualAppreciationPct": {
          "maximum": 50,
          "minimum": -50,
          "type": "number"
        },
        "optionIndex": {
          "maximum": 4,
          "minimum": 0,
          "type": "integer"
        },
        "plannedBudget": {
          "exclusiveMinimum": 0,
          "maximum": 100000000,
          "type": "number"
        }
      },
      "required": [
        "optionIndex",
        "plannedBudget"
      ],
      "type": "object"
    }
  },
  "required": [
    "homePrice",
    "cashAvailable",
    "reserveTarget",
    "horizonMonths",
    "horizonHomeValue",
    "monthlyPropertyTax",
    "monthlyHomeInsurance",
    "monthlyHoa",
    "options"
  ],
  "additionalProperties": false
}

Production endpoint: POST https://calc.hasstechapi.com/v2/calc/purchase-cash-and-rate-strategies
Formula: purchase-cash-and-rate-strategies-htcalc-719df2c0e105

Related PDF reports