Skip to content

Investment · Calculation

Portfolio from residential property records

Recreates the app’s property-record view including lien subtotals, current value, freshness, missing fields and equity projections. Operating expenses recorded in a profile are partial, so this view withholds returns that require a complete operating ledger.

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-portfolio-profile.

Keep the key on your server. A successful call uses 10 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-portfolio-profile";
const input = {
  "asOfDate": "2026-02-01",
  "properties": [
    {
      "recordDate": "2026-01-01",
      "is_rented": true,
      "current_estimated_value": 400000,
      "mortgage_balance": 210000,
      "second_mortgage_balance": 30000,
      "monthly_pi": 1100,
      "second_mortgage_payment": 350,
      "monthly_rent": 3000,
      "property_tax_monthly": 300,
      "insurance_monthly": 120,
      "hoa_fees": 100,
      "property_type": "2_unit"
    }
  ]
};
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-portfolio-profile' \
    --header "Authorization: Bearer $HT_PRODUCTION_KEY" \
    --header 'Content-Type: application/json' \
    --header "Idempotency-Key: $request_id" \
    --data-binary @- <<'HT_INPUT'
{
  "asOfDate": "2026-02-01",
  "properties": [
    {
      "recordDate": "2026-01-01",
      "is_rented": true,
      "current_estimated_value": 400000,
      "mortgage_balance": 210000,
      "second_mortgage_balance": 30000,
      "monthly_pi": 1100,
      "second_mortgage_payment": 350,
      "monthly_rent": 3000,
      "property_tax_monthly": 300,
      "insurance_monthly": 120,
      "hoa_fees": 100,
      "property_type": "2_unit"
    }
  ]
}
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-portfolio-profile.
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
portfolio-ledger-1.0.0
value.formulaVersion
portfolio-ledger-1.0.0
How to interpret this result
  • Recreates the app’s property-record view including lien subtotals, current value, freshness, missing fields and equity projections. Operating expenses recorded in a profile are partial, so this view withholds returns that require a complete operating ledger.
Full example response (JSON)
{
  "status": "available",
  "result": {
    "state": "available",
    "fieldErrors": {},
    "warnings": [],
    "assumptions": [
      {
        "key": "staleAfterDays",
        "value": "120",
        "unit": "days",
        "source": "default"
      },
      {
        "key": "appreciationRatePct",
        "value": "3",
        "unit": "% per year",
        "source": "default"
      }
    ],
    "provenance": [
      {
        "source": "HT Calc additional_properties record; updated_at is used as the valuation observation timestamp. Property property-1.",
        "asOf": "2026-01-01",
        "version": "portfolio-ledger-1.0.0"
      }
    ],
    "formulaVersion": "portfolio-ledger-1.0.0",
    "ruleVersions": [],
    "auditTrail": [
      "Mapped persisted property facts to integer cents before calculation.",
      "Recorded which persisted columns were blank so a blank column degrades only the figures that need it.",
      "Derived aggregate cards, table rows, projections, and export presentation from one canonical portfolio result.",
      "Withheld NOI, cap rate, DSCR, cash flow, cash-on-equity, and cash-on-cash because persisted rows do not include a complete operating-expense ledger or actual cash-invested basis."
    ],
    "value": {
      "formulaVersion": "portfolio-ledger-1.0.0",
      "status": "available",
      "totalValueCents": 40000000,
      "totalDebtCents": 24000000,
      "totalEquityCents": 16000000,
      "totalAnnualNoiCents": null,
      "totalAnnualDebtServiceCents": 1740000,
      "totalAnnualIncomeCents": 3600000,
      "totalAnnualOperatingExpensesCents": 624000,
      "totalMonthlyCashFlowCents": null,
      "averageCapRatePct": null,
      "averageCashOnCashPct": null,
      "portfolioLtvPct": 60,
      "portfolioCashOnEquityPct": null,
      "portfolioDscr": null,
      "portfolioXirr": null,
      "portfolioXirrState": "no-root",
      "stalePropertyIds": [],
      "maturityCalendar": [],
      "concentrationByMarketPct": {
        "Unspecified market": 100
      },
      "concentrationByTypePct": {
        "2_unit": 100
      },
      "drillback": [
        {
          "propertyId": "property-1",
          "valueCents": 40000000,
          "debtCents": 24000000,
          "sourceFlowIds": []
        }
      ],
      "correlationStatus": "not-provided",
      "correlationSource": null,
      "operatingExpenseCoverage": "partial",
      "cashInvestmentCoverage": "partial",
      "debtBalanceCoverage": "complete",
      "debtServiceCoverage": "complete",
      "rentCoverage": "complete",
      "appreciationRatePct": 3,
      "equityProjection": [
        {
          "year": 1,
          "projectedValueCents": 41200000,
          "projectedEquityCents": 17200000
        },
        {
          "year": 2,
          "projectedValueCents": 42436000,
          "projectedEquityCents": 18436000
        },
        {
          "year": 3,
          "projectedValueCents": 43709080,
          "projectedEquityCents": 19709080
        },
        {
          "year": 4,
          "projectedValueCents": 45020352,
          "projectedEquityCents": 21020352
        },
        {
          "year": 5,
          "projectedValueCents": 46370963,
          "projectedEquityCents": 22370963
        }
      ],
      "propertyMetrics": [
        {
          "propertyId": "property-1",
          "address": "Portfolio property property-1",
          "valueCents": 40000000,
          "debtCents": 24000000,
          "equityCents": 16000000,
          "monthlyRentCents": 300000,
          "monthlyOperatingExpensesCents": 52000,
          "monthlyDebtServiceCents": 145000,
          "operatingExpensesComplete": false,
          "monthlyCashFlowCents": null,
          "annualNoiCents": null,
          "capRatePct": null,
          "cashOnCashPct": null,
          "cashOnEquityPct": null,
          "dscr": null,
          "cashInvestedCents": null
        }
      ],
      "issues": [
        {
          "code": "operating-expenses-incomplete",
          "severity": "warning",
          "message": "NOI, cap rate, DSCR, cash flow, and cash-on-equity are withheld because stored property rows do not contain a complete operating-expense ledger."
        },
        {
          "code": "cash-invested-missing",
          "severity": "information",
          "message": "Cash-on-cash is withheld because actual cash invested was not supplied; current equity is not used as a substitute."
        }
      ]
    },
    "sourceCoverage": [
      {
        "propertyId": "property-1",
        "address": "Portfolio property property-1",
        "unrecordedFields": [],
        "invalidFields": [],
        "missingProvenance": false
      }
    ]
  },
  "formulaVersion": "portfolio-ledger-1.0.0-profile.1",
  "units": {
    "property input amounts": "USD",
    "*Cents": "integer USD cents",
    "*Pct": "percentage points",
    "dates": "YYYY-MM-DD"
  },
  "assumptions": [
    "Recreates the app’s property-record view including lien subtotals, current value, freshness, missing fields and equity projections. Operating expenses recorded in a profile are partial, so this view withholds returns that require a complete operating ledger."
  ],
  "warnings": [],
  "creditCost": 10
}

Request contract

Accepted inputs

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

FieldType, units and limits

asOfDateRequired
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
propertiesRequired
arrayMin items 1 · Max items 25
properties[].recordDateRequired
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
properties[].is_rentedRequired
boolean
properties[].current_estimated_valueRequired
number

USD, one-time amount.

Min 0 · Max 1000000000
properties[].mortgage_balanceOptional
number

USD, one-time amount.

Min 0 · Max 1000000000
properties[].monthly_piOptional
number

USD per month.

Min 0 · Max 1000000000
properties[].second_mortgage_balanceOptional
number

USD, one-time amount.

Min 0 · Max 1000000000
properties[].second_mortgage_paymentOptional
number

USD per month.

Min 0 · Max 1000000000
properties[].property_tax_monthlyOptional
number

USD per month.

Min 0 · Max 1000000000
properties[].insurance_monthlyOptional
number

USD per month.

Min 0 · Max 1000000000
properties[].hoa_feesOptional
number

USD per month.

Min 0 · Max 1000000000
properties[].monthly_rentOptional
number

USD per month.

Min 0 · Max 1000000000
properties[].property_typeOptional
stringAllowed: "single_family", "condo", "2_unit", "3_4_unit", "5_plus_unit", "manufactured", "commercial", "multi_family", "land"
properties[].mortgage_balance_as_of_dateOptional
string

Gregorian calendar date, YYYY-MM-DD.

Format: date · Min length 10 · Max length 10
properties[].marketGroupOptional
integer

Unitless positive group number. Properties in the same market share a number.

Min 1 · Max 50
Example request body (JSON)
{
  "asOfDate": "2026-02-01",
  "properties": [
    {
      "recordDate": "2026-01-01",
      "is_rented": true,
      "current_estimated_value": 400000,
      "mortgage_balance": 210000,
      "second_mortgage_balance": 30000,
      "monthly_pi": 1100,
      "second_mortgage_payment": 350,
      "monthly_rent": 3000,
      "property_tax_monthly": 300,
      "insurance_monthly": 120,
      "hoa_fees": 100,
      "property_type": "2_unit"
    }
  ]
}
Full JSON schema
{
  "type": "object",
  "properties": {
    "asOfDate": {
      "type": "string",
      "format": "date",
      "minLength": 10,
      "maxLength": 10,
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Gregorian calendar date, YYYY-MM-DD."
    },
    "properties": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "recordDate": {
            "type": "string",
            "format": "date",
            "minLength": 10,
            "maxLength": 10,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "Gregorian calendar date, YYYY-MM-DD."
          },
          "is_rented": {
            "type": "boolean"
          },
          "current_estimated_value": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD, one-time amount."
          },
          "mortgage_balance": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD, one-time amount."
          },
          "monthly_pi": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD per month."
          },
          "second_mortgage_balance": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD, one-time amount."
          },
          "second_mortgage_payment": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD per month."
          },
          "property_tax_monthly": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD per month."
          },
          "insurance_monthly": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD per month."
          },
          "hoa_fees": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD per month."
          },
          "monthly_rent": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000000,
            "description": "USD per month."
          },
          "property_type": {
            "enum": [
              "single_family",
              "condo",
              "2_unit",
              "3_4_unit",
              "5_plus_unit",
              "manufactured",
              "commercial",
              "multi_family",
              "land"
            ]
          },
          "mortgage_balance_as_of_date": {
            "type": "string",
            "format": "date",
            "minLength": 10,
            "maxLength": 10,
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "Gregorian calendar date, YYYY-MM-DD."
          },
          "marketGroup": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50,
            "description": "Unitless positive group number. Properties in the same market share a number."
          }
        },
        "required": [
          "recordDate",
          "is_rented",
          "current_estimated_value"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 25
    }
  },
  "required": [
    "asOfDate",
    "properties"
  ],
  "additionalProperties": false,
  "description": "Recreates the app’s property-record view including lien subtotals, current value, freshness, missing fields and equity projections. Operating expenses recorded in a profile are partial, so this view withholds returns that require a complete operating ledger."
}

Production endpoint: POST https://calc.hasstechapi.com/v2/calc/investor-portfolio-profile
Formula: portfolio-ledger-1.0.0-profile.1