Skip to content

Investment · Calculation

Hold, sell, refinance or exchange

Compare four paths at a shared horizon with modeled debt paydown, net sale and refinance proceeds, exchange financing, cash flow and reinvestment. Supply an annual post-refinance cash flow or let the app replace the old debt payment with the new payment.

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-exit-strategy.

Keep the key on your server. A successful call uses 20 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/investor-exit-strategy";
const input = {
  "currentValue": 500000,
  "currentDebt": 260000,
  "currentDebtRatePct": 5,
  "currentAnnualDebtService": 24000,
  "adjustedBasis": 350000,
  "annualCashFlow": 12000,
  "annualCashFlowGrowthPct": 2,
  "annualAppreciationPct": 3,
  "sellingCostPct": 6,
  "capitalGainsTaxPct": 20,
  "refiLtvPct": 70,
  "refiRatePct": 6,
  "refiTermYears": 30,
  "refiClosingCostPct": 2,
  "exchangeDownPaymentPct": 30,
  "holdYears": 5,
  "reinvestmentRatePct": 4
};
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/investor-exit-strategy' \
    --header "Authorization: Bearer $HT_PRODUCTION_KEY" \
    --header 'Content-Type: application/json' \
    --header "Idempotency-Key: $request_id" \
    --data-binary @- <<'HT_INPUT'
{
  "currentValue": 500000,
  "currentDebt": 260000,
  "currentDebtRatePct": 5,
  "currentAnnualDebtService": 24000,
  "adjustedBasis": 350000,
  "annualCashFlow": 12000,
  "annualCashFlowGrowthPct": 2,
  "annualAppreciationPct": 3,
  "sellingCostPct": 6,
  "capitalGainsTaxPct": 20,
  "refiLtvPct": 70,
  "refiRatePct": 6,
  "refiTermYears": 30,
  "refiClosingCostPct": 2,
  "exchangeDownPaymentPct": 30,
  "holdYears": 5,
  "reinvestmentRatePct": 4
}
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 investor-exit-strategy.
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.

state
available
formulaVersion
exit-strategy-3.0.0
value.comparisonHorizonYears
5

Result warnings

  • The model does not determine 1031 eligibility, boot, recapture, or state tax. Obtain CPA or attorney review.
How to interpret this result
  • Compare four paths at a shared horizon with modeled debt paydown, net sale and refinance proceeds, exchange financing, cash flow and reinvestment. Supply an annual post-refinance cash flow or let the app replace the old debt payment with the new payment.
Full example response (JSON)
{
  "status": "available",
  "result": {
    "state": "available",
    "fieldErrors": {},
    "warnings": [
      {
        "code": "tax-review-required",
        "severity": "critical",
        "message": "The model does not determine 1031 eligibility, boot, recapture, or state tax. Obtain CPA or attorney review."
      }
    ],
    "assumptions": [],
    "provenance": [
      {
        "source": "Declared common-horizon terminal-wealth model",
        "asOf": "2026-08-13"
      }
    ],
    "formulaVersion": "exit-strategy-3.0.0",
    "ruleVersions": [
      "common-horizon-v1",
      "taxable-gain-after-selling-costs-v1",
      "loans-amortized-to-horizon-v1"
    ],
    "auditTrail": [
      "Compared all paths at year 5.",
      "Cash released today compounds to the horizon at the entered reinvestment rate.",
      "Retained properties are liquidated at the horizon under one selling-cost and tax convention.",
      "Each retained loan is amortized to year 5: the current loan at its entered P&I, the refinance and 1031 replacement loans at their own rate and term.",
      "The 1031 replacement loan of 490000.00 costs 2937.80 a month in P&I, charged against the scaled NOI."
    ],
    "value": {
      "comparisonHorizonYears": 5,
      "comparisonBasis": "After-tax terminal wealth at year 5, with every retained property liquidated at the horizon",
      "projectedPropertyValue": "579637.04",
      "sellNetProceedsToday": "186000",
      "refinanceCashOutToday": "83000",
      "exchangeBuyingPower": "700000",
      "exchangeLoanAmount": "490000",
      "exchangeMonthlyPayment": "2937.8",
      "exchangeFirstYearCashFlow": "15146.43",
      "refinanceFeasible": true,
      "refinanceShortfall": null,
      "strategies": [
        {
          "id": "hold",
          "terminalWealth": "375571.43",
          "proceedsReleasedToday": "0",
          "cumulativeCashFlow": "67345.45",
          "liquidationEquity": "308225.98",
          "loanBalanceAtHorizon": "197661.07"
        },
        {
          "id": "sell",
          "terminalWealth": "226297.44",
          "proceedsReleasedToday": "186000",
          "cumulativeCashFlow": "0",
          "liquidationEquity": "0",
          "loanBalanceAtHorizon": "0"
        },
        {
          "id": "refinance",
          "terminalWealth": "342618.87",
          "proceedsReleasedToday": "83000",
          "cumulativeCashFlow": "61439.84",
          "liquidationEquity": "180196.84",
          "loanBalanceAtHorizon": "325690.21"
        },
        {
          "id": "1031-exchange",
          "terminalWealth": "350291.32",
          "proceedsReleasedToday": "0",
          "cumulativeCashFlow": "86015.77",
          "liquidationEquity": "264275.55",
          "loanBalanceAtHorizon": "455966.32"
        }
      ],
      "ranking": [
        "hold",
        "1031-exchange",
        "refinance",
        "sell"
      ],
      "bestStrategy": "hold",
      "highestWealthStrategies": [
        "hold"
      ]
    }
  },
  "formulaVersion": "exit-strategy-3.0.0",
  "units": {
    "money": "USD",
    "months": "whole months",
    "years": "whole years",
    "percentage": "percent points (6 = 6%)",
    "dscr": "income divided by debt service, unitless"
  },
  "assumptions": [
    "Compare four paths at a shared horizon with modeled debt paydown, net sale and refinance proceeds, exchange financing, cash flow and reinvestment. Supply an annual post-refinance cash flow or let the app replace the old debt payment with the new payment."
  ],
  "warnings": [
    "The model does not determine 1031 eligibility, boot, recapture, or state tax. Obtain CPA or attorney review."
  ],
  "creditCost": 20
}

Request contract

Accepted inputs

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

FieldType, units and limits

currentValueRequired
number

Current modeled property value in USD.

Min 0.01 · Max 1000000000
currentDebtRequired
number

Current mortgage principal outstanding in USD.

Min 0 · Max 1000000000
currentDebtRatePctRequired
number

Annual interest rate in percent on the existing mortgage.

Min 0 · Max 100
currentAnnualDebtServiceRequired
number

USD per year in principal and interest on the current loan.

Min 0 · Max 1000000000
adjustedBasisRequired
number

Current adjusted property tax basis in USD for the sale and exchange assumptions.

Min 0 · Max 1000000000
annualCashFlowRequired
number

Signed USD per year in current property cash flow after paying current debt service.

Min -1000000000 · Max 1000000000
refiAnnualCashFlowOptional
number

Signed USD per year in post-refinance property cash flow after new debt service. Omitting it derives cash flow by replacing current P&I with new P&I.

Min -1000000000 · Max 1000000000
annualCashFlowGrowthPctRequired
number

Signed percent change per year in operating income before financing. Each path then deducts its own debt payments.

Min -100 · Max 20
annualAppreciationPctRequired
number

Signed annual percent change in property value (3 means a 3% annual increase).

Min -100 · Max 20
sellingCostPctRequired
number

Selling expenses as a percent of the modeled gross sale price.

Min 0 · Max 100
capitalGainsTaxPctRequired
number

Assumed tax as a percent of positive taxable capital gain.

Min 0 · Max 100
refiLtvPctRequired
number

Refinance principal as a percent of current property value.

Min 0 · Max 100
refiRatePctRequired
number

Annual interest rate in percent on the modeled refinance loan.

Min 0 · Max 100
refiTermYearsRequired
integer

Whole years in the refinance loan amortization term.

Min 1 · Max 50
refiClosingCostPctRequired
number

Refinance costs as a percent of the modeled refinance principal.

Min 0 · Max 100
exchangeDownPaymentPctRequired
number

Equity down payment as a percent of replacement property purchase price.

Min 0.01 · Max 100
exchangeLoanRatePctOptional
number

Annual interest rate in percent on the replacement property loan. It defaults to the refinance rate.

Min 0 · Max 100
exchangeLoanTermYearsOptional
integer

Whole years in the replacement loan amortization term. It defaults to the refinance term.

Min 1 · Max 50
holdYearsRequired
integer

Whole years until all strategies are evaluated together at the common comparison horizon.

Min 1 · Max 50
reinvestmentRatePctRequired
number

Signed annual reinvestment return in percent on cash released today (4 means 4% per year).

Min -99 · Max 30
Example request body (JSON)
{
  "currentValue": 500000,
  "currentDebt": 260000,
  "currentDebtRatePct": 5,
  "currentAnnualDebtService": 24000,
  "adjustedBasis": 350000,
  "annualCashFlow": 12000,
  "annualCashFlowGrowthPct": 2,
  "annualAppreciationPct": 3,
  "sellingCostPct": 6,
  "capitalGainsTaxPct": 20,
  "refiLtvPct": 70,
  "refiRatePct": 6,
  "refiTermYears": 30,
  "refiClosingCostPct": 2,
  "exchangeDownPaymentPct": 30,
  "holdYears": 5,
  "reinvestmentRatePct": 4
}
Full JSON schema
{
  "type": "object",
  "properties": {
    "currentValue": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 1000000000,
      "description": "Current modeled property value in USD."
    },
    "currentDebt": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Current mortgage principal outstanding in USD."
    },
    "currentDebtRatePct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Annual interest rate in percent on the existing mortgage."
    },
    "currentAnnualDebtService": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "USD per year in principal and interest on the current loan."
    },
    "adjustedBasis": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000000000,
      "description": "Current adjusted property tax basis in USD for the sale and exchange assumptions."
    },
    "annualCashFlow": {
      "type": "number",
      "minimum": -1000000000,
      "maximum": 1000000000,
      "description": "Signed USD per year in current property cash flow after paying current debt service."
    },
    "refiAnnualCashFlow": {
      "type": "number",
      "minimum": -1000000000,
      "maximum": 1000000000,
      "description": "Signed USD per year in post-refinance property cash flow after new debt service. Omitting it derives cash flow by replacing current P&I with new P&I."
    },
    "annualCashFlowGrowthPct": {
      "type": "number",
      "minimum": -100,
      "maximum": 20,
      "description": "Signed percent change per year in operating income before financing. Each path then deducts its own debt payments."
    },
    "annualAppreciationPct": {
      "type": "number",
      "minimum": -100,
      "maximum": 20,
      "description": "Signed annual percent change in property value (3 means a 3% annual increase)."
    },
    "sellingCostPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Selling expenses as a percent of the modeled gross sale price."
    },
    "capitalGainsTaxPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Assumed tax as a percent of positive taxable capital gain."
    },
    "refiLtvPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Refinance principal as a percent of current property value."
    },
    "refiRatePct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Annual interest rate in percent on the modeled refinance loan."
    },
    "refiTermYears": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50,
      "description": "Whole years in the refinance loan amortization term."
    },
    "refiClosingCostPct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Refinance costs as a percent of the modeled refinance principal."
    },
    "exchangeDownPaymentPct": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 100,
      "description": "Equity down payment as a percent of replacement property purchase price."
    },
    "exchangeLoanRatePct": {
      "type": "number",
      "minimum": 0,
      "maximum": 100,
      "description": "Annual interest rate in percent on the replacement property loan. It defaults to the refinance rate."
    },
    "exchangeLoanTermYears": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50,
      "description": "Whole years in the replacement loan amortization term. It defaults to the refinance term."
    },
    "holdYears": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50,
      "description": "Whole years until all strategies are evaluated together at the common comparison horizon."
    },
    "reinvestmentRatePct": {
      "type": "number",
      "minimum": -99,
      "maximum": 30,
      "description": "Signed annual reinvestment return in percent on cash released today (4 means 4% per year)."
    }
  },
  "required": [
    "currentValue",
    "currentDebt",
    "currentDebtRatePct",
    "currentAnnualDebtService",
    "adjustedBasis",
    "annualCashFlow",
    "annualCashFlowGrowthPct",
    "annualAppreciationPct",
    "sellingCostPct",
    "capitalGainsTaxPct",
    "refiLtvPct",
    "refiRatePct",
    "refiTermYears",
    "refiClosingCostPct",
    "exchangeDownPaymentPct",
    "holdYears",
    "reinvestmentRatePct"
  ],
  "additionalProperties": false,
  "description": "Compare four paths at a shared horizon with modeled debt paydown, net sale and refinance proceeds, exchange financing, cash flow and reinvestment. Supply an annual post-refinance cash flow or let the app replace the old debt payment with the new payment."
}

Production endpoint: POST https://calc.hasstechapi.com/v2/calc/investor-exit-strategy
Formula: exit-strategy-3.0.0

Related PDF reports