Investment · Calculation
Fix and flip profit and risk
Cash-funded rehab with acquisition loan interest and points, sale profit and ROI, scheduled work, extension costs, seeded sale-price and delay distributions, and optional side-by-side comparison.
Example result · state: available See output
- Cost per success
- 20 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-fix-and-flip.
Keep the key on your server. A successful call uses 20 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-fix-and-flip";
const input = {
"purchasePrice": 200000,
"downPayment": 10000,
"interestRate": 9,
"loanPoints": 2,
"purchaseClosingCosts": 6000,
"rehabCosts": 30000,
"holdingPeriod": 6,
"monthlyHoldingCosts": 500,
"salePrice": 320000,
"sellingCosts": 19200,
"simulationSamples": 250
};
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-fix-and-flip' \
--header "Authorization: Bearer $HT_PRODUCTION_KEY" \
--header 'Content-Type: application/json' \
--header "Idempotency-Key: $request_id" \
--data-binary @- <<'HT_INPUT'
{
"purchasePrice": 200000,
"downPayment": 10000,
"interestRate": 9,
"loanPoints": 2,
"purchaseClosingCosts": 6000,
"rehabCosts": 30000,
"holdingPeriod": 6,
"monthlyHoldingCosts": 500,
"salePrice": 320000,
"sellingCosts": 19200,
"simulationSamples": 250
}
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-fix-and-flip. 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
screen.totalInvestment- 49800
screen.totalCost- 270550
How to interpret this result
- Cash-funded rehab with acquisition loan interest and points, sale profit and ROI, scheduled work, extension costs, seeded sale-price and delay distributions, and optional side-by-side comparison.
Full example response (JSON)
{
"status": "available",
"result": {
"state": "available",
"warnings": [],
"screen": {
"totalInvestment": 49800,
"totalCost": 270550,
"grossProfit": 90000,
"netProfit": 49450,
"roi": 99.29718875502009,
"annualizedRoi": 198.59437751004018
},
"ledger": {
"state": "available",
"fieldErrors": {},
"warnings": [],
"assumptions": [
{
"key": "rehabSchedule",
"value": "one aggregate item",
"source": "default"
},
{
"key": "rehabFunding",
"value": "cash (the loan covers the purchase only)",
"source": "default"
},
{
"key": "loanPoints",
"value": "2",
"unit": "%",
"source": "user"
},
{
"key": "extensionStartsMonth",
"value": "7",
"unit": "month",
"source": "user"
},
{
"key": "monthlyExtensionFee",
"value": "0",
"unit": "USD/month",
"source": "default"
},
{
"key": "annualDefaultRatePct",
"value": "9",
"unit": "%",
"source": "default"
},
{
"key": "salePriceDistribution",
"value": "-10% / base / +10%",
"source": "default"
},
{
"key": "delayDistributionMonths",
"value": "0 / 1 / 3",
"source": "default"
},
{
"key": "simulationSeed",
"value": "20260813",
"source": "default"
},
{
"key": "simulationSamples",
"value": "250",
"source": "user"
}
],
"provenance": [],
"formulaVersion": "fix-flip-distribution-1.1.0",
"ruleVersions": [],
"auditTrail": [
"Dependency-aware completion month is 6; base hold is 6 months.",
"250 deterministic triangular scenarios generated from seed 20260813.",
"Compatibility adapter: the entered rehab dependency schedule, extension terms, and deterministic sale/delay distributions are passed to the canonical project ledger; legacy aggregate values are used only when those fields are absent."
],
"value": {
"completionMonth": 6,
"baseHoldMonths": 6,
"rehabTotal": "30000",
"progressiveInterest": "8550",
"holdingCost": "3000",
"extensionAndDefaultCost": "0",
"baseProfit": "49450",
"balancingEquityAfterSale": "-49450",
"totalSources": "460550",
"totalUses": "460550",
"sourcesUsesDifference": "0",
"distribution": {
"p10": "30395.89",
"p50": "46518.26",
"p90": "62903.15",
"expected": "46878.29",
"seed": 20260813,
"samples": 250
},
"drawLedger": [
{
"month": 1,
"openingBalance": "190000",
"drawn": "0",
"interest": "1425",
"closingBalance": "190000"
},
{
"month": 2,
"openingBalance": "190000",
"drawn": "0",
"interest": "1425",
"closingBalance": "190000"
},
{
"month": 3,
"openingBalance": "190000",
"drawn": "0",
"interest": "1425",
"closingBalance": "190000"
},
{
"month": 4,
"openingBalance": "190000",
"drawn": "0",
"interest": "1425",
"closingBalance": "190000"
},
{
"month": 5,
"openingBalance": "190000",
"drawn": "0",
"interest": "1425",
"closingBalance": "190000"
},
{
"month": 6,
"openingBalance": "190000",
"drawn": "0",
"interest": "1425",
"closingBalance": "190000"
}
]
}
},
"secondScenario": null,
"comparison": null
},
"formulaVersion": "investor-fix-and-flip-1.0.0",
"units": {
"monetaryAmounts": "USD",
"calendarDates": "YYYY-MM-DD",
"interestRate": "annual percent",
"holdingPeriod": "months",
"monthlyHoldingCosts": "USD/month before interest",
"sellingCosts": "USD",
"loanPoints": "percent of acquisition loan",
"simulationSamples": "trials",
"delayDistributionMonths": "months"
},
"assumptions": [
"Cash-funded rehab with acquisition loan interest and points, sale profit and ROI, scheduled work, extension costs, seeded sale-price and delay distributions, and optional side-by-side comparison."
],
"warnings": [],
"creditCost": 20
}Request contract
Accepted inputs
Fields for this example. Expand the schema for all supported combinations and limits.
FieldType, units and limits
purchasePriceRequiredAcquisition price, USD.
Min 0.01 · Max 1000000000downPaymentRequiredCash down payment, USD.
Min 0 · Max 1000000000purchaseClosingCostsRequiredUpfront closing costs, USD.
Min 0 · Max 1000000000rehabCostsRequiredCash-funded aggregate rehab budget when work rows are absent, USD.
Min 0 · Max 1000000000interestRateRequiredAnnual nominal loan rate, in percentage points (6.5 = 6.5%).
Min 0 · Max 100holdingPeriodRequiredPlanned holding period, whole months.
Min 1 · Max 120monthlyHoldingCostsRequiredNoninterest carrying expense, USD/month.
Min 0 · Max 1000000000salePriceRequiredPlanned gross sale price, USD.
Min 0 · Max 1000000000sellingCostsRequiredSelling expenses at the planned sale price, USD.
Min 0 · Max 1000000000loanPointsOptionalUpfront fees, percent of the acquisition loan.
Min 0 · Max 100rehabItemsOptionalrehabItems[].amountRequiredCash cost of this work item, USD.
Min 0 · Max 1000000000rehabItems[].startMonthRequiredOne-based first month of work.
Min 1 · Max 120rehabItems[].durationMonthsRequiredLength of work, whole months.
Min 1 · Max 120rehabItems[].dependsOnOptionalextensionStartsMonthOptionalOne-based month when extension fees begin.
Min 1 · Max 120monthlyExtensionFeeOptionalExtension fee, USD/month.
Min 0 · Max 1000000000annualDefaultRatePctOptionalNominal annual rate during extension, percentage points.
Min 0 · Max 100salePriceDistributionOptionalsalePriceDistribution.minRequiredMinimum gross sale price, USD.
Min 0 · Max 1000000000salePriceDistribution.modeRequiredMost likely gross sale price, USD.
Min 0 · Max 1000000000salePriceDistribution.maxRequiredMaximum gross sale price, USD.
Min 0 · Max 1000000000delayDistributionMonthsOptionaldelayDistributionMonths.minRequiredMinimum delay, months.
Min 0 · Max 120delayDistributionMonths.modeRequiredMost likely delay, months.
Min 0 · Max 120delayDistributionMonths.maxRequiredMaximum delay, months. Sampled delays round to whole months.
Min 0 · Max 120simulationSeedOptionalUnsigned integer pseudorandom seed.
Min 0 · Max 4294967295simulationSamplesOptionalWhole number of deterministic simulation trials.
Min 100 · Max 5000compareWithOptionalcompareWith.purchasePriceRequiredAcquisition price, USD.
Min 0.01 · Max 1000000000compareWith.downPaymentRequiredCash down payment, USD.
Min 0 · Max 1000000000compareWith.purchaseClosingCostsRequiredUpfront closing costs, USD.
Min 0 · Max 1000000000compareWith.rehabCostsRequiredCash-funded aggregate rehab budget when work rows are absent, USD.
Min 0 · Max 1000000000compareWith.interestRateRequiredAnnual nominal loan rate, in percentage points (6.5 = 6.5%).
Min 0 · Max 100compareWith.holdingPeriodRequiredPlanned holding period, whole months.
Min 1 · Max 120compareWith.monthlyHoldingCostsRequiredNoninterest carrying expense, USD/month.
Min 0 · Max 1000000000compareWith.salePriceRequiredPlanned gross sale price, USD.
Min 0 · Max 1000000000compareWith.sellingCostsRequiredSelling expenses at the planned sale price, USD.
Min 0 · Max 1000000000compareWith.loanPointsOptionalUpfront fees, percent of the acquisition loan.
Min 0 · Max 100compareWith.rehabItemsOptionalcompareWith.rehabItems[].amountRequiredCash cost of this work item, USD.
Min 0 · Max 1000000000compareWith.rehabItems[].startMonthRequiredOne-based first month of work.
Min 1 · Max 120compareWith.rehabItems[].durationMonthsRequiredLength of work, whole months.
Min 1 · Max 120compareWith.rehabItems[].dependsOnOptionalcompareWith.extensionStartsMonthOptionalOne-based month when extension fees begin.
Min 1 · Max 120compareWith.monthlyExtensionFeeOptionalExtension fee, USD/month.
Min 0 · Max 1000000000compareWith.annualDefaultRatePctOptionalNominal annual rate during extension, percentage points.
Min 0 · Max 100compareWith.salePriceDistributionOptionalcompareWith.salePriceDistribution.minRequiredMinimum gross sale price, USD.
Min 0 · Max 1000000000compareWith.salePriceDistribution.modeRequiredMost likely gross sale price, USD.
Min 0 · Max 1000000000compareWith.salePriceDistribution.maxRequiredMaximum gross sale price, USD.
Min 0 · Max 1000000000compareWith.delayDistributionMonthsOptionalcompareWith.delayDistributionMonths.minRequiredMinimum delay, months.
Min 0 · Max 120compareWith.delayDistributionMonths.modeRequiredMost likely delay, months.
Min 0 · Max 120compareWith.delayDistributionMonths.maxRequiredMaximum delay, months. Sampled delays round to whole months.
Min 0 · Max 120compareWith.simulationSeedOptionalUnsigned integer pseudorandom seed.
Min 0 · Max 4294967295compareWith.simulationSamplesOptionalWhole number of deterministic simulation trials.
Min 100 · Max 5000Example request body (JSON)
{
"purchasePrice": 200000,
"downPayment": 10000,
"interestRate": 9,
"loanPoints": 2,
"purchaseClosingCosts": 6000,
"rehabCosts": 30000,
"holdingPeriod": 6,
"monthlyHoldingCosts": 500,
"salePrice": 320000,
"sellingCosts": 19200,
"simulationSamples": 250
} Full JSON schema
{
"type": "object",
"properties": {
"purchasePrice": {
"type": "number",
"minimum": 0.01,
"maximum": 1000000000,
"description": "Acquisition price, USD."
},
"downPayment": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Cash down payment, USD."
},
"purchaseClosingCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Upfront closing costs, USD."
},
"rehabCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Cash-funded aggregate rehab budget when work rows are absent, USD."
},
"interestRate": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Annual nominal loan rate, in percentage points (6.5 = 6.5%)."
},
"holdingPeriod": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "Planned holding period, whole months."
},
"monthlyHoldingCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Noninterest carrying expense, USD/month."
},
"salePrice": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Planned gross sale price, USD."
},
"sellingCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Selling expenses at the planned sale price, USD."
},
"loanPoints": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Upfront fees, percent of the acquisition loan."
},
"rehabItems": {
"type": "array",
"items": {
"type": "object",
"properties": {
"amount": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Cash cost of this work item, USD."
},
"startMonth": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "One-based first month of work."
},
"durationMonths": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "Length of work, whole months."
},
"dependsOn": {
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 80,
"description": "One-based row number of a prerequisite work item."
},
"minItems": 0,
"maxItems": 80
}
},
"required": [
"amount",
"startMonth",
"durationMonths"
],
"additionalProperties": false
},
"minItems": 1,
"maxItems": 80
},
"extensionStartsMonth": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "One-based month when extension fees begin."
},
"monthlyExtensionFee": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Extension fee, USD/month."
},
"annualDefaultRatePct": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Nominal annual rate during extension, percentage points."
},
"salePriceDistribution": {
"type": "object",
"properties": {
"min": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Minimum gross sale price, USD."
},
"mode": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Most likely gross sale price, USD."
},
"max": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Maximum gross sale price, USD."
}
},
"required": [
"min",
"mode",
"max"
],
"additionalProperties": false
},
"delayDistributionMonths": {
"type": "object",
"properties": {
"min": {
"type": "number",
"minimum": 0,
"maximum": 120,
"description": "Minimum delay, months."
},
"mode": {
"type": "number",
"minimum": 0,
"maximum": 120,
"description": "Most likely delay, months."
},
"max": {
"type": "number",
"minimum": 0,
"maximum": 120,
"description": "Maximum delay, months. Sampled delays round to whole months."
}
},
"required": [
"min",
"mode",
"max"
],
"additionalProperties": false
},
"simulationSeed": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295,
"description": "Unsigned integer pseudorandom seed."
},
"simulationSamples": {
"type": "integer",
"minimum": 100,
"maximum": 5000,
"description": "Whole number of deterministic simulation trials."
},
"compareWith": {
"type": "object",
"properties": {
"purchasePrice": {
"type": "number",
"minimum": 0.01,
"maximum": 1000000000,
"description": "Acquisition price, USD."
},
"downPayment": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Cash down payment, USD."
},
"purchaseClosingCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Upfront closing costs, USD."
},
"rehabCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Cash-funded aggregate rehab budget when work rows are absent, USD."
},
"interestRate": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Annual nominal loan rate, in percentage points (6.5 = 6.5%)."
},
"holdingPeriod": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "Planned holding period, whole months."
},
"monthlyHoldingCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Noninterest carrying expense, USD/month."
},
"salePrice": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Planned gross sale price, USD."
},
"sellingCosts": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Selling expenses at the planned sale price, USD."
},
"loanPoints": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Upfront fees, percent of the acquisition loan."
},
"rehabItems": {
"type": "array",
"items": {
"type": "object",
"properties": {
"amount": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Cash cost of this work item, USD."
},
"startMonth": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "One-based first month of work."
},
"durationMonths": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "Length of work, whole months."
},
"dependsOn": {
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 80,
"description": "One-based row number of a prerequisite work item."
},
"minItems": 0,
"maxItems": 80
}
},
"required": [
"amount",
"startMonth",
"durationMonths"
],
"additionalProperties": false
},
"minItems": 1,
"maxItems": 80
},
"extensionStartsMonth": {
"type": "integer",
"minimum": 1,
"maximum": 120,
"description": "One-based month when extension fees begin."
},
"monthlyExtensionFee": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Extension fee, USD/month."
},
"annualDefaultRatePct": {
"type": "number",
"minimum": 0,
"maximum": 100,
"description": "Nominal annual rate during extension, percentage points."
},
"salePriceDistribution": {
"type": "object",
"properties": {
"min": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Minimum gross sale price, USD."
},
"mode": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Most likely gross sale price, USD."
},
"max": {
"type": "number",
"minimum": 0,
"maximum": 1000000000,
"description": "Maximum gross sale price, USD."
}
},
"required": [
"min",
"mode",
"max"
],
"additionalProperties": false
},
"delayDistributionMonths": {
"type": "object",
"properties": {
"min": {
"type": "number",
"minimum": 0,
"maximum": 120,
"description": "Minimum delay, months."
},
"mode": {
"type": "number",
"minimum": 0,
"maximum": 120,
"description": "Most likely delay, months."
},
"max": {
"type": "number",
"minimum": 0,
"maximum": 120,
"description": "Maximum delay, months. Sampled delays round to whole months."
}
},
"required": [
"min",
"mode",
"max"
],
"additionalProperties": false
},
"simulationSeed": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295,
"description": "Unsigned integer pseudorandom seed."
},
"simulationSamples": {
"type": "integer",
"minimum": 100,
"maximum": 5000,
"description": "Whole number of deterministic simulation trials."
}
},
"required": [
"purchasePrice",
"downPayment",
"purchaseClosingCosts",
"rehabCosts",
"interestRate",
"holdingPeriod",
"monthlyHoldingCosts",
"salePrice",
"sellingCosts"
],
"additionalProperties": false
}
},
"required": [
"purchasePrice",
"downPayment",
"purchaseClosingCosts",
"rehabCosts",
"interestRate",
"holdingPeriod",
"monthlyHoldingCosts",
"salePrice",
"sellingCosts"
],
"additionalProperties": false,
"description": "Cash-funded rehab with acquisition loan interest and points, sale profit and ROI, scheduled work, extension costs, seeded sale-price and delay distributions, and optional side-by-side comparison."
}Production endpoint: POST https://calc.hasstechapi.com/v2/calc/investor-fix-and-flip
Formula: investor-fix-and-flip-1.0.0