Investment · Calculation
Cash-on-cash return projection
Uses the down payment and closing costs as initial cash. Deducts vacancy, operating costs, capital reserve and either calculated or supplied annual debt service. Returns first-year cash flow and a multiyear projection.
Example result · state: available See output
- Cost per success
- 10 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 investor-cash-on-cash-model.
Keep the key on your server. A successful call uses 10 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/investor-cash-on-cash-model";
const input = {
"purchasePrice": 200000,
"downPaymentPct": 25,
"closingCosts": 10000,
"annualRentalIncome": 30000,
"vacancyRate": 0,
"capExReservePct": 0,
"annualOperatingExpenses": 6000,
"annualMortgagePayment": 12000,
"interestRate": 6,
"loanTermYears": 30,
"useAutoMortgage": false,
"rentGrowthRate": 2,
"expenseGrowthRate": 3,
"projectionYears": 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/investor-cash-on-cash-model' \
--header "Authorization: Bearer $HT_PRODUCTION_KEY" \
--header 'Content-Type: application/json' \
--header "Idempotency-Key: $request_id" \
--data-binary @- <<'HT_INPUT'
{
"purchasePrice": 200000,
"downPaymentPct": 25,
"closingCosts": 10000,
"annualRentalIncome": 30000,
"vacancyRate": 0,
"capExReservePct": 0,
"annualOperatingExpenses": 6000,
"annualMortgagePayment": 12000,
"interestRate": 6,
"loanTermYears": 30,
"useAutoMortgage": false,
"rentGrowthRate": 2,
"expenseGrowthRate": 3,
"projectionYears": 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
investor-cash-on-cash-model. 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.
state- available
formulaVersion- cash-on-cash-2.0.0
value.downPayment- 50000
How to interpret this result
- Uses the down payment and closing costs as initial cash. Deducts vacancy, operating costs, capital reserve and either calculated or supplied annual debt service. Returns first-year cash flow and a multiyear projection.
Full example response (JSON)
{
"status": "available",
"result": {
"state": "available",
"fieldErrors": {},
"warnings": [],
"assumptions": [],
"provenance": [
{
"source": "Annual cash flow divided by total acquisition cash",
"asOf": "2026-08-13"
}
],
"formulaVersion": "cash-on-cash-2.0.0",
"ruleVersions": [
"effective-rent-after-vacancy",
"capital-reserve-on-effective-rent"
],
"auditTrail": [
"Total cash invested equals down payment plus closing costs.",
"Zero cash flow is a real 0% result; only a zero cash-invested denominator is not-applicable.",
"Projected 5 year(s) with user-supplied rent and expense growth."
],
"value": {
"downPayment": "50000",
"totalCashInvested": "60000",
"effectiveRent": "30000",
"capitalReserve": "0",
"annualCashFlow": "12000",
"monthlyCashFlow": "1000",
"cashOnCashPct": "20",
"projection": [
{
"year": 1,
"effectiveRent": "30000",
"operatingExpenses": "6000",
"capitalReserve": "0",
"annualCashFlow": "12000",
"cashOnCashPct": "20"
},
{
"year": 2,
"effectiveRent": "30600",
"operatingExpenses": "6180",
"capitalReserve": "0",
"annualCashFlow": "12420",
"cashOnCashPct": "20.7"
},
{
"year": 3,
"effectiveRent": "31212",
"operatingExpenses": "6365.4",
"capitalReserve": "0",
"annualCashFlow": "12846.6",
"cashOnCashPct": "21.411"
},
{
"year": 4,
"effectiveRent": "31836.24",
"operatingExpenses": "6556.36",
"capitalReserve": "0",
"annualCashFlow": "13279.88",
"cashOnCashPct": "22.13313"
},
{
"year": 5,
"effectiveRent": "32472.96",
"operatingExpenses": "6753.05",
"capitalReserve": "0",
"annualCashFlow": "13719.91",
"cashOnCashPct": "22.8665199"
}
]
}
},
"formulaVersion": "cash-on-cash-2.0.0",
"units": {
"purchasePrice": "USD",
"closingCosts": "USD",
"annualRentalIncome": "USD per year",
"annualMortgagePayment": "USD per year",
"annualOperatingExpenses": "USD per year",
"interestRate": "annual percent",
"vacancyRate": "percent of scheduled income",
"capExReservePct": "percent of vacancy-adjusted income",
"growthRates": "percent per year",
"cashOnCashPct": "annual percent"
},
"assumptions": [
"Uses the down payment and closing costs as initial cash. Deducts vacancy, operating costs, capital reserve and either calculated or supplied annual debt service. Returns first-year cash flow and a multiyear projection."
],
"warnings": [],
"creditCost": 10
}Request contract
Accepted inputs
Fields for this example. Expand the schema for all supported combinations and limits.
FieldType, units and limits
purchasePriceRequiredAcquisition price, in USD.
Min 0.01 · Max 1000000000downPaymentPctRequiredDown payment as a percentage of the purchase price (25 means 25%).
Min 0 · Max 100closingCostsRequiredCash acquisition closing costs, in USD.
Min 0 · Max 1000000000annualRentalIncomeRequiredGross scheduled rental income before vacancy, in USD per year.
Min 0 · Max 1000000000vacancyRateRequiredUncollected share of scheduled rent, in percent (5 means 5%).
Min 0 · Max 100capExReservePctRequiredCapital reserve allowance as a percentage of vacancy-adjusted rental income.
Min 0 · Max 100annualOperatingExpensesRequiredOperating expenses before debt service and the separate capital reserve, in USD per year.
Min 0 · Max 1000000000annualMortgagePaymentRequiredSupplied debt service in USD per year, applied when automatic mortgage calculation is disabled.
Min 0 · Max 1000000000interestRateRequiredNominal annual interest rate on the purchase loan, in percent (6 means 6%).
Min 0 · Max 100loanTermYearsRequiredAmortization term of the automatic mortgage calculation, in whole years.
Min 1 · Max 50useAutoMortgageRequiredrentGrowthRateRequiredAnnual change in scheduled gross rent, in percent (2 means a 2% increase).
Min -100 · Max 100expenseGrowthRateRequiredAnnual change in operating expenses, in percent (3 means a 3% increase).
Min -100 · Max 100projectionYearsRequiredNumber of annual cash-flow rows to compute, in whole years.
Min 1 · Max 50Example request body (JSON)
{
"purchasePrice": 200000,
"downPaymentPct": 25,
"closingCosts": 10000,
"annualRentalIncome": 30000,
"vacancyRate": 0,
"capExReservePct": 0,
"annualOperatingExpenses": 6000,
"annualMortgagePayment": 12000,
"interestRate": 6,
"loanTermYears": 30,
"useAutoMortgage": false,
"rentGrowthRate": 2,
"expenseGrowthRate": 3,
"projectionYears": 5
} Full JSON schema
{
"type": "object",
"properties": {
"purchasePrice": {
"type": "number",
"minimum": 0.01,
"maximum": 1000000000,
"description": "Acquisition price, in USD."
},
"downPaymentPct": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Down payment as a percentage of the purchase price (25 means 25%)."
},
"closingCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Cash acquisition closing costs, in USD."
},
"annualRentalIncome": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Gross scheduled rental income before vacancy, in USD per year."
},
"vacancyRate": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Uncollected share of scheduled rent, in percent (5 means 5%)."
},
"capExReservePct": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Capital reserve allowance as a percentage of vacancy-adjusted rental income."
},
"annualOperatingExpenses": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Operating expenses before debt service and the separate capital reserve, in USD per year."
},
"annualMortgagePayment": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Supplied debt service in USD per year, applied when automatic mortgage calculation is disabled."
},
"interestRate": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Nominal annual interest rate on the purchase loan, in percent (6 means 6%)."
},
"loanTermYears": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"description": "Amortization term of the automatic mortgage calculation, in whole years."
},
"useAutoMortgage": {
"type": "boolean"
},
"rentGrowthRate": {
"type": "number",
"minimum": -100,
"maximum": 100,
"description": "Annual change in scheduled gross rent, in percent (2 means a 2% increase)."
},
"expenseGrowthRate": {
"type": "number",
"minimum": -100,
"maximum": 100,
"description": "Annual change in operating expenses, in percent (3 means a 3% increase)."
},
"projectionYears": {
"type": "integer",
"minimum": 1,
"maximum": 50,
"description": "Number of annual cash-flow rows to compute, in whole years."
}
},
"required": [
"purchasePrice",
"downPaymentPct",
"closingCosts",
"annualRentalIncome",
"vacancyRate",
"capExReservePct",
"annualOperatingExpenses",
"annualMortgagePayment",
"interestRate",
"loanTermYears",
"useAutoMortgage",
"rentGrowthRate",
"expenseGrowthRate",
"projectionYears"
],
"additionalProperties": false,
"description": "Uses the down payment and closing costs as initial cash. Deducts vacancy, operating costs, capital reserve and either calculated or supplied annual debt service. Returns first-year cash flow and a multiyear projection."
}Production endpoint: POST https://calc.hasstechapi.com/v2/calc/investor-cash-on-cash-model
Formula: cash-on-cash-2.0.0