Mortgage · Calculation
Mortgage effective borrowing rate
Model effective borrowing cost across a selected holding period and full term with entered note payment, insurance, fees, points and credits. The program setting selects conventional, FHA, VA or USDA cash flows. FHA uses original LTV and term for insurance duration. USDA models annual guarantee fees, and VA accepts funding-fee use or an exemption. Choose how to treat a supplied upfront fee.
This HT Calc screen includes a Pro sample for visitors.
Example result · loanProgram: conventional 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 mortgage-true-rate.
Keep the key on your server. A successful call uses 2 calculation credits.
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/mortgage-true-rate";
const input = {
"loanProgram": "conventional",
"loanPurpose": "purchase",
"homeValue": 300000,
"loanAmount": 240000,
"piPayment": 1438.92,
"pmiPayment": 0,
"remainingTermYears": 30,
"currentRate": 6,
"upfrontCosts": 1000,
"discountPoints": 1,
"lenderCredits": 400,
"programFee": 0,
"pmiCancellationMode": "auto78",
"insuranceDurationMode": "auto",
"pmiBasisValue": 300000,
"fhaOriginalLtv": 80,
"fhaOriginalTermYears": 30,
"vaFundingFeeUse": "manual",
"vaDownPaymentPercent": 20,
"usdaAnnualFeeRate": 0.35,
"programFeeTreatment": "paidUpfront",
"holdingPeriodYears": 5
};
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 -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/mortgage-true-rate' \
--header "Authorization: Bearer $HT_PRODUCTION_KEY" \
--header 'Content-Type: application/json' \
--header "Idempotency-Key: $request_id" \
--data-binary @- <<'HT_INPUT'
{
"loanProgram": "conventional",
"loanPurpose": "purchase",
"homeValue": 300000,
"loanAmount": 240000,
"piPayment": 1438.92,
"pmiPayment": 0,
"remainingTermYears": 30,
"currentRate": 6,
"upfrontCosts": 1000,
"discountPoints": 1,
"lenderCredits": 400,
"programFee": 0,
"pmiCancellationMode": "auto78",
"insuranceDurationMode": "auto",
"pmiBasisValue": 300000,
"fhaOriginalLtv": 80,
"fhaOriginalTermYears": 30,
"vaFundingFeeUse": "manual",
"vaDownPaymentPercent": 20,
"usdaAnnualFeeRate": 0.35,
"programFeeTreatment": "paidUpfront",
"holdingPeriodYears": 5
}
HT_INPUT
) If your request fails
400 INVALID_INPUT-
Read
error.detailswhen present. Node prints each issue. cURL returns the JSON body. Eachpathpoints 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.
401or403- Check that the server has the bearer key for the endpoint’s environment and that the key includes
mortgage-true-rate. 429- Read the service error code, check your allowance, and wait for the
Retry-Afterinterval when supplied before trying again. - Lost response,
409or503 - 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_IDto 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.
loanProgram- conventional
loanPurpose- purchase
noteRate- 6 percent
How to interpret this result
- HT Calc policy snapshot 719df2c, November 2026. Program comparisons are planning estimates. A lender determines underwriting and eligibility.
Full example response (JSON)
{
"status": "available",
"result": {
"loanProgram": "conventional",
"loanPurpose": "purchase",
"noteRate": 6,
"effectiveRate": 6.1177107389084995,
"fullTermEffectiveRate": 6.1177107389084995,
"ratePremium": 0.11771073890849948,
"fullTermRatePremium": 0.11771073890849948,
"ltv": 80,
"hasPMI": false,
"equityToDropPMI": 0,
"valueToDropPMI": 300000,
"monthsUntilPMIDrops": 0,
"totalPMICost": 0,
"fullTermPMICost": 0,
"monthlyTotal": 1438.92,
"netUpfrontCosts": 3000,
"pointsCost": 2400,
"programFee": 0,
"programFeeRate": 0,
"programFeeTreatment": "paidUpfront",
"programFeeCashCost": 0,
"financedProgramFee": 0,
"rateLoanAmount": 240000,
"effectiveProceeds": 237000,
"holdingPeriodYears": 5,
"holdingPeriodMonths": 60,
"holdingPeriodCost": 72665.74431058348,
"holdingPeriodInterest": 69665.74431058348,
"holdingPeriodInsuranceCost": 0,
"pmiBasisValue": 300000,
"pmiBasisLtv": 80,
"fhaOriginalLtv": 80,
"vaFundingFeeUse": "manual",
"vaDownPaymentPercent": 20,
"usdaAnnualFeeRate": 0.35,
"termMonths": 360,
"pmiCancellationMode": "auto78",
"insuranceDurationMode": "auto",
"insuranceLabel": "Mortgage Insurance",
"insuranceCostLabel": "PMI Cost Until Drop",
"insuranceTimingLabel": "Estimated PMI drop",
"fullTermRiskLabel": "Full-Term PMI Risk",
"programFeeLabel": "Program Fee",
"noInsuranceLabel": "No monthly mortgage insurance entered.",
"narrative": "With the entered upfront costs and credits, your cost-adjusted rate is about 6.118%.",
"warnings": [],
"usingProvidedRate": true,
"isValid": true
},
"formulaVersion": "mortgage-true-rate-htcalc-719df2c0e105",
"units": {
"noteRate": "percent",
"effectiveRate": "percent",
"fullTermEffectiveRate": "percent",
"netUpfrontCosts": "USD",
"effectiveProceeds": "USD",
"holdingPeriodMonths": "months",
"monthlyTotal": "USD/month"
},
"assumptions": [
"HT Calc policy snapshot 719df2c, November 2026. Program comparisons are planning estimates. A lender determines underwriting and eligibility."
],
"warnings": [],
"creditCost": 2
}Request contract
Accepted inputs
Fields for this example. Expand the schema for all supported combinations and limits.
FieldType, units and limits
loanProgramRequiredloanPurposeRequiredhomeValueRequiredPositive US dollars
Min 0.01 · Max 1000000000loanAmountRequiredPositive US dollars
Min 0.01 · Max 1000000000piPaymentRequiredScheduled principal and interest in US dollars per month
Min 0.01 · Max 100000000pmiPaymentRequiredUS dollars per month
Min 0 · Max 100000000remainingTermYearsRequiredYears remaining, including fractional years
Min 0.08333333333333333 · Max 50currentRateOptionalAnnual note rate in percent; 6 means 6%
Min 0 · Max 50upfrontCostsOptionalUS dollars
Min 0 · Max 1000000000discountPointsOptionalDiscount points as a percent of the loan
Min 0 · Max 25lenderCreditsOptionalUS dollars
Min 0 · Max 1000000000programFeeOptionalUS dollars
Min 0 · Max 1000000000pmiCancellationModeOptionalinsuranceDurationModeOptionalpmiBasisValueOptionalPositive US dollars
Min 0.01 · Max 1000000000fhaOriginalLtvOptionalOriginal loan-to-value in percent
Min 0.01 · Max 250fhaOriginalTermYearsOptionalWhole years
Min 1 · Max 50vaFundingFeeUseOptionalvaDownPaymentPercentOptionalPercent; 5 means 5%
Min 0 · Max 100usdaAnnualFeeRateOptionalPercent; 5 means 5%
Min 0 · Max 100programFeeTreatmentOptionalholdingPeriodYearsOptionalHolding period, in years
Min 0.08333333333333333 · Max 50Example request body (JSON)
{
"loanProgram": "conventional",
"loanPurpose": "purchase",
"homeValue": 300000,
"loanAmount": 240000,
"piPayment": 1438.92,
"pmiPayment": 0,
"remainingTermYears": 30,
"currentRate": 6,
"upfrontCosts": 1000,
"discountPoints": 1,
"lenderCredits": 400,
"programFee": 0,
"pmiCancellationMode": "auto78",
"insuranceDurationMode": "auto",
"pmiBasisValue": 300000,
"fhaOriginalLtv": 80,
"fhaOriginalTermYears": 30,
"vaFundingFeeUse": "manual",
"vaDownPaymentPercent": 20,
"usdaAnnualFeeRate": 0.35,
"programFeeTreatment": "paidUpfront",
"holdingPeriodYears": 5
} Full JSON schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"loanProgram": {
"type": "string",
"enum": [
"conventional",
"fha",
"va",
"usda"
]
},
"loanPurpose": {
"type": "string",
"enum": [
"purchase",
"rateTermRefinance",
"cashOutRefinance",
"streamlineRefinance"
]
},
"homeValue": {
"type": "number",
"minimum": 0.01,
"maximum": 1000000000,
"description": "Positive US dollars"
},
"loanAmount": {
"type": "number",
"minimum": 0.01,
"maximum": 1000000000,
"description": "Positive US dollars"
},
"piPayment": {
"type": "number",
"minimum": 0.01,
"maximum": 100000000,
"description": "Scheduled principal and interest in US dollars per month"
},
"pmiPayment": {
"type": "number",
"minimum": 0,
"maximum": 100000000,
"description": "US dollars per month"
},
"remainingTermYears": {
"type": "number",
"minimum": 0.08333333333333333,
"maximum": 50,
"description": "Years remaining, including fractional years"
},
"currentRate": {
"type": "number",
"minimum": 0,
"maximum": 50,
"description": "Annual note rate in percent; 6 means 6%"
},
"upfrontCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "US dollars"
},
"discountPoints": {
"type": "number",
"minimum": 0,
"maximum": 25,
"description": "Discount points as a percent of the loan"
},
"lenderCredits": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "US dollars"
},
"programFee": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "US dollars"
},
"pmiCancellationMode": {
"type": "string",
"enum": [
"auto78",
"request80",
"fullTerm"
]
},
"insuranceDurationMode": {
"type": "string",
"enum": [
"auto",
"elevenYears",
"fullTerm"
]
},
"pmiBasisValue": {
"type": "number",
"minimum": 0.01,
"maximum": 1000000000,
"description": "Positive US dollars"
},
"fhaOriginalLtv": {
"type": "number",
"minimum": 0.01,
"maximum": 250,
"description": "Original loan-to-value in percent"
},
"fhaOriginalTermYears": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"description": "Whole years"
},
"vaFundingFeeUse": {
"type": "string",
"enum": [
"first",
"subsequent",
"irrrl",
"exempt",
"manual"
]
},
"vaDownPaymentPercent": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Percent; 5 means 5%"
},
"usdaAnnualFeeRate": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Percent; 5 means 5%"
},
"programFeeTreatment": {
"type": "string",
"enum": [
"financed",
"paidUpfront",
"includedInBalance"
]
},
"holdingPeriodYears": {
"type": "number",
"minimum": 0.08333333333333333,
"maximum": 50,
"description": "Holding period, in years"
}
},
"required": [
"loanProgram",
"loanPurpose",
"homeValue",
"loanAmount",
"piPayment",
"pmiPayment",
"remainingTermYears"
]
}Production endpoint: POST https://calc.hasstechapi.com/v2/calc/mortgage-true-rate
Formula: mortgage-true-rate-htcalc-719df2c0e105
Method and sources
Model an entered quote and its holding-period cost; optional note rate can be inferred. Accept rounded P&I. Effective net proceeds must be positive. Four program modes share one contract.
Reviewed .