Personal finance · Calculation
Business loan cash flow and coverage
Calculate payment, financed origination fees and the loan size supported at the model's 1.25x cash-flow coverage target. hasSbaGuaranteeFee is fixed to false. The qualifies field means the model meets that target.
Example result · monthlyPayment: 3161.6350663 USD/month 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 business-loan-cash-flow.
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/business-loan-cash-flow";
const input = {
"loanAmount": 250000,
"annualRate": 8.5,
"termYears": 10,
"originationFeePercent": 2,
"hasSbaGuaranteeFee": false,
"monthlyRevenue": 80000,
"monthlyExpenses": 55000,
"existingMonthlyDebtService": 2000
};
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/business-loan-cash-flow' \
--header "Authorization: Bearer $HT_PRODUCTION_KEY" \
--header 'Content-Type: application/json' \
--header "Idempotency-Key: $request_id" \
--data-binary @- <<'HT_INPUT'
{
"loanAmount": 250000,
"annualRate": 8.5,
"termYears": 10,
"originationFeePercent": 2,
"hasSbaGuaranteeFee": false,
"monthlyRevenue": 80000,
"monthlyExpenses": 55000,
"existingMonthlyDebtService": 2000
}
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
business-loan-cash-flow. 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.
monthlyPayment- 3161.6350663 USD/month
totalInterest- 124396.207956
totalCost- 379396.207956 USD
Full example response (JSON)
{
"status": "available",
"result": {
"monthlyPayment": 3161.6350663,
"totalInterest": 124396.207956,
"totalCost": 379396.207956,
"totalFinanced": 255000,
"totalFees": 5000,
"origFee": 5000,
"sbaFee": 0,
"noi": 25000,
"dscr": 4.843426487708028,
"dscrStatus": "available",
"qualifies": true,
"maxLoanAtDSCR": 1423314.1730889939,
"maxPaymentAtDSCR": 18000,
"totalDebtService": 5161.635066299999,
"schedule": [
{
"month": 1,
"payment": 3162,
"principal": 1355,
"interest": 1806,
"balance": 253645
},
{
"month": 2,
"payment": 3162,
"principal": 1365,
"interest": 1797,
"balance": 252280
},
{
"month": 3,
"payment": 3162,
"principal": 1375,
"interest": 1787,
"balance": 250905
},
{
"month": 4,
"payment": 3162,
"principal": 1384,
"interest": 1777,
"balance": 249521
},
{
"month": 5,
"payment": 3162,
"principal": 1394,
"interest": 1767,
"balance": 248126
},
{
"month": 6,
"payment": 3162,
"principal": 1404,
"interest": 1758,
"balance": 246722
},
{
"month": 7,
"payment": 3162,
"principal": 1414,
"interest": 1748,
"balance": 245308
},
{
"month": 8,
"payment": 3162,
"principal": 1424,
"interest": 1738,
"balance": 243884
},
{
"month": 9,
"payment": 3162,
"principal": 1434,
"interest": 1728,
"balance": 242450
},
{
"month": 10,
"payment": 3162,
"principal": 1444,
"interest": 1717,
"balance": 241006
},
{
"month": 11,
"payment": 3162,
"principal": 1455,
"interest": 1707,
"balance": 239551
},
{
"month": 12,
"payment": 3162,
"principal": 1465,
"interest": 1697,
"balance": 238087
}
],
"termMonths": 120,
"loanAprPct": 8.961110817544261
},
"formulaVersion": "business-loan-cash-flow-htcalc-719df2c0e105",
"units": {
"monthlyPayment": "USD/month",
"totalCost": "USD",
"totalFinanced": "USD",
"dscr": "ratio",
"maxLoanAtDSCR": "USD"
},
"assumptions": [],
"warnings": [],
"creditCost": 2
}Request contract
Accepted inputs
Fields for this example. Expand the schema for all supported combinations and limits.
FieldType, units and limits
annualRateRequiredAnnual note rate. In percentage points (6.5 means 6.5%).
Min 0 · Max 100existingMonthlyDebtServiceRequiredExisting debt payments before the proposed loan. In USD per month.
Min 0 · Max 100000000hasSbaGuaranteeFeeRequiredManual cash-flow scenarios always disable the SBA fee schedule.
Must equal falseloanAmountRequiredBusiness loan principal before the financed origination fee. In USD.
Min 1 · Max 100000000monthlyExpensesRequiredBusiness expenses before loan payments. In USD per month.
Min 0 · Max 1000000000monthlyRevenueRequiredBusiness revenue. In USD per month.
Min 0 · Max 1000000000originationFeePercentRequiredFinanced origination fee as a share of principal. In percentage points (6.5 means 6.5%).
Min 0 · Max 100termYearsRequiredRepayment term in years. Fractional years are rounded to the nearest whole month.
Min 0.08333333333333333 · Max 100Example request body (JSON)
{
"loanAmount": 250000,
"annualRate": 8.5,
"termYears": 10,
"originationFeePercent": 2,
"hasSbaGuaranteeFee": false,
"monthlyRevenue": 80000,
"monthlyExpenses": 55000,
"existingMonthlyDebtService": 2000
} Full JSON schema
{
"additionalProperties": false,
"properties": {
"annualRate": {
"anyOf": [
{
"const": 0
},
{
"minimum": 0.000001
}
],
"description": "Annual note rate. In percentage points (6.5 means 6.5%).",
"maximum": 100,
"minimum": 0,
"type": "number"
},
"existingMonthlyDebtService": {
"description": "Existing debt payments before the proposed loan. In USD per month.",
"maximum": 100000000,
"minimum": 0,
"type": "number"
},
"hasSbaGuaranteeFee": {
"const": false,
"description": "Manual cash-flow scenarios always disable the SBA fee schedule.",
"type": "boolean"
},
"loanAmount": {
"description": "Business loan principal before the financed origination fee. In USD.",
"maximum": 100000000,
"minimum": 1,
"type": "number"
},
"monthlyExpenses": {
"description": "Business expenses before loan payments. In USD per month.",
"maximum": 1000000000,
"minimum": 0,
"type": "number"
},
"monthlyRevenue": {
"description": "Business revenue. In USD per month.",
"maximum": 1000000000,
"minimum": 0,
"type": "number"
},
"originationFeePercent": {
"description": "Financed origination fee as a share of principal. In percentage points (6.5 means 6.5%).",
"maximum": 100,
"minimum": 0,
"type": "number"
},
"termYears": {
"description": "Repayment term in years. Fractional years are rounded to the nearest whole month.",
"maximum": 100,
"minimum": 0.08333333333333333,
"type": "number"
}
},
"required": [
"loanAmount",
"annualRate",
"termYears",
"originationFeePercent",
"hasSbaGuaranteeFee",
"monthlyRevenue",
"monthlyExpenses",
"existingMonthlyDebtService"
],
"type": "object"
}Production endpoint: POST https://calc.hasstechapi.com/v2/calc/business-loan-cash-flow
Formula: business-loan-cash-flow-htcalc-719df2c0e105