Skip to content

PDF report

Refinance strategies using supplied quotes

Refinance strategies using supplied quotes prepared from validated scenario inputs by the original HT Calc report builder.

Open Loan Estimate Analyzer in HT Calc

This HT Calc screen includes a Pro sample for visitors.

Cost per success
2 calculation credits + 1 PDF report
Production plans
Business, Scale, Enterprise
Plan allowances
Free sandbox
Not available

Integration example

Request a PDF

Before your first report

  1. Open Widgets & reports in your paid workspace. Save your brand name, accent and at least one exact HTTPS origin, such as https://app.example.com. The origins identify sites allowed to embed your widgets.
  2. Under Report credentials, name a credential, select mortgage-refinance-strategies-quoted and choose Create report credential. Save the secret shown once in your server’s HT_REPORT_KEY.
  3. Run the example on your server against accounts.hasstechapi.com, without an Origin header. A successful request returns a PDF and uses 2 calculation credits and 1 PDF report. Running the example again starts a new paid request.
What if the PDF doesn’t arrive?

For 400 INVALID_INPUT, inspect error.details when present. Paths for template fields start with input. Fix the indicated field and send a new request. This validation error uses zero credits and zero reports.

Open the .pdf.request.json file the example saved before sending. Within 24 hours, open Request lookup in the same workspace, choose Production, and paste the file’s requestId. The response’s X-Request-Id is a separate support identifier.

A settled request shows the calculation credits and report used. The service doesn’t keep the PDF for download. Check your saved file first. A replacement with a new ID uses 2 calculation credits and 1 PDF report on success.

If the outcome is unclear, check the workspace and ID, then look it up again before requesting a replacement.

Download the production PDF

Set HT_REPORT_KEY on your server. Save as example.mjs and run node example.mjs with Node.js 18 or later.

import { randomUUID } from "node:crypto";
import { writeFile } from "node:fs/promises";

const key = process.env.HT_REPORT_KEY;
if (!key) throw new Error("Set HT_REPORT_KEY on your server.");
const endpoint = "https://accounts.hasstechapi.com/v2/reports/mortgage-refinance-strategies-quoted";
const input = {
  "quoteOwner": "Example Planning Group",
  "quoteRights": "caller-owned",
  "quoteSource": "Illustrative refinance quotes",
  "quoteDate": "2026-11-14",
  "horizonYears": 7,
  "quotedRates": {
    "lower-rate": 6.25,
    "shorter-term": 5.875,
    "pay-same": 6.25,
    "cash-out": 6.75,
    "drop-pmi": 6.375,
    "fha-to-conventional": 6.5,
    "arm-to-fixed": 6.5,
    "va-irrrl": 6,
    "fha-streamline": 6,
    "cash-out-consolidate": 6.75
  },
  "profile": {
    "current": {
      "balance": 280000,
      "rate": 7.5,
      "monthlyPI": 2150,
      "monthsRemaining": 336,
      "loanType": "conventional",
      "hasMI": true
    },
    "property": {
      "estimatedValue": 400000,
      "originalValue": 350000,
      "type": "single-family",
      "occupancy": "primary"
    },
    "borrower": {
      "creditTier": "good",
      "isVeteran": false,
      "seasonedSixMonths": true
    },
    "goals": [
      "lower-payment"
    ],
    "cashOutAmount": 25000
  }
};
const requestId = Date.now() + "." + randomUUID();
const output = "mortgage-refinance-strategies-quoted-" + requestId + ".pdf";
await writeFile(output + ".request.json", JSON.stringify({ requestId, endpoint }), {
  flag: "wx", mode: 0o600
});
console.error("Usage lookup ID:", requestId);

const response = await fetch(endpoint, {
  method: "POST",
  redirect: "error",
  headers: {
    "Authorization": "Bearer " + key,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ requestId, 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 {
  if (response.headers.get("content-type")?.split(";")[0] !== "application/pdf") {
    throw new Error("Expected a PDF. Look up request " + requestId);
  }
  await writeFile(output, new Uint8Array(await response.arrayBuffer()), { flag: "wx" });
  console.log("Saved", output);
}

Output

PDF output

A successful request returns the PDF file as application/pdf. The example writes a file named mortgage-refinance-strategies-quoted-<requestId>.pdf.

Request contract

Accepted inputs

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

FieldType, units and limits

quoteOwnerRequired
string

Owner of the quoted pricing.

Min length 1 · Max length 48
quoteRightsRequired
string

Caller declaration covering use of the pricing in this report.

Allowed: "caller-owned", "authorized-for-report-use"
quoteSourceRequired
string

Name of the supplied price sheet or quote set.

Min length 1 · Max length 48
quoteDateRequired
string

Effective calendar date of the supplied offers.

Format: date
horizonYearsRequired
integer

Years the borrower expects to keep the loan.

Min 1 · Max 50
quotedRatesRequired
object

Final annual rate in percent for each refinance path considered, including applicable cash-out pricing.

profileRequired
object
profile.currentRequired
object
profile.current.balanceRequired
number

US dollars, greater than zero.

Max 1000000000 · Greater than 0
profile.current.rateRequired
number

Percentage points (6.5 means 6.5%).

Min 0 · Max 100
profile.current.monthlyPIRequired
number

US dollars, greater than zero.

Max 1000000000 · Greater than 0
profile.current.monthsRemainingRequired
integer

Whole months of payments.

Min 1 · Max 600
profile.current.originalAmountOptional
number

US dollars, greater than zero.

Max 1000000000 · Greater than 0
profile.current.loanTypeRequired
stringAllowed: "conventional", "fha", "va", "usda", "arm"
profile.current.hasMIRequired
boolean
profile.propertyRequired
object
profile.property.estimatedValueRequired
number

US dollars, greater than zero.

Max 1000000000 · Greater than 0
profile.property.originalValueOptional
number

US dollars, greater than zero.

Max 1000000000 · Greater than 0
profile.property.typeRequired
stringAllowed: "single-family", "condo", "multi-unit"
profile.property.occupancyRequired
stringAllowed: "primary", "second-home", "investment"
profile.property.zipCodeOptional
string

Optional five-digit ZIP used for the regional closing estimate.

profile.borrowerRequired
object
profile.borrower.creditTierRequired
stringAllowed: "excellent", "good", "fair", "below"
profile.borrower.isVeteranRequired
boolean
profile.borrower.seasonedSixMonthsRequired
boolean
profile.borrower.marginalTaxRateOptional
number

Optional marginal tax fraction, e.g. 0.22.

Min 0 · Max 1
profile.goalsRequired
arrayMax items 6
profile.debtsToConsolidateOptional
arrayMax items 8
profile.debtsToConsolidate[].descriptionRequired
string

Short plain-text scenario label.

Min length 1 · Max length 64
profile.debtsToConsolidate[].balanceRequired
number

US dollars, greater than zero.

Max 1000000000 · Greater than 0
profile.debtsToConsolidate[].aprRequired
number

Percentage points (6.5 means 6.5%).

Min 0 · Max 100
profile.debtsToConsolidate[].monthlyPaymentRequired
number

US dollars, greater than zero.

Max 1000000000 · Greater than 0
profile.cashOutAmountOptional
number

US dollars; enter zero when this cost is absent.

Min 0 · Max 1000000000
profile.extraPrincipalPerMonthOptional
number

US dollars; enter zero when this cost is absent.

Min 0 · Max 1000000000
Example input (JSON)

The server example adds a fresh requestId to this input.

{
  "input": {
    "quoteOwner": "Example Planning Group",
    "quoteRights": "caller-owned",
    "quoteSource": "Illustrative refinance quotes",
    "quoteDate": "2026-11-14",
    "horizonYears": 7,
    "quotedRates": {
      "lower-rate": 6.25,
      "shorter-term": 5.875,
      "pay-same": 6.25,
      "cash-out": 6.75,
      "drop-pmi": 6.375,
      "fha-to-conventional": 6.5,
      "arm-to-fixed": 6.5,
      "va-irrrl": 6,
      "fha-streamline": 6,
      "cash-out-consolidate": 6.75
    },
    "profile": {
      "current": {
        "balance": 280000,
        "rate": 7.5,
        "monthlyPI": 2150,
        "monthsRemaining": 336,
        "loanType": "conventional",
        "hasMI": true
      },
      "property": {
        "estimatedValue": 400000,
        "originalValue": 350000,
        "type": "single-family",
        "occupancy": "primary"
      },
      "borrower": {
        "creditTier": "good",
        "isVeteran": false,
        "seasonedSixMonths": true
      },
      "goals": [
        "lower-payment"
      ],
      "cashOutAmount": 25000
    }
  }
}
Full JSON schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "quoteOwner": {
      "type": "string",
      "minLength": 1,
      "maxLength": 48,
      "pattern": "^[^<>\\p{Cc}]+$",
      "description": "Owner of the quoted pricing."
    },
    "quoteRights": {
      "type": "string",
      "enum": [
        "caller-owned",
        "authorized-for-report-use"
      ],
      "description": "Caller declaration covering use of the pricing in this report."
    },
    "quoteSource": {
      "type": "string",
      "minLength": 1,
      "maxLength": 48,
      "pattern": "^[^<>\\p{Cc}]+$",
      "description": "Name of the supplied price sheet or quote set."
    },
    "quoteDate": {
      "type": "string",
      "format": "date",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
      "description": "Effective calendar date of the supplied offers."
    },
    "horizonYears": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50,
      "description": "Years the borrower expects to keep the loan."
    },
    "quotedRates": {
      "type": "object",
      "propertyNames": {
        "type": "string",
        "enum": [
          "lower-rate",
          "shorter-term",
          "pay-same",
          "cash-out",
          "drop-pmi",
          "fha-to-conventional",
          "arm-to-fixed",
          "va-irrrl",
          "fha-streamline",
          "cash-out-consolidate"
        ]
      },
      "additionalProperties": {
        "type": "number",
        "minimum": 0,
        "maximum": 100,
        "description": "Percentage points (6.5 means 6.5%)."
      },
      "description": "Final annual rate in percent for each refinance path considered, including applicable cash-out pricing."
    },
    "profile": {
      "type": "object",
      "properties": {
        "current": {
          "type": "object",
          "properties": {
            "balance": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 1000000000,
              "description": "US dollars, greater than zero."
            },
            "rate": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "description": "Percentage points (6.5 means 6.5%)."
            },
            "monthlyPI": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 1000000000,
              "description": "US dollars, greater than zero."
            },
            "monthsRemaining": {
              "type": "integer",
              "minimum": 1,
              "maximum": 600,
              "description": "Whole months of payments."
            },
            "originalAmount": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 1000000000,
              "description": "US dollars, greater than zero."
            },
            "loanType": {
              "type": "string",
              "enum": [
                "conventional",
                "fha",
                "va",
                "usda",
                "arm"
              ]
            },
            "hasMI": {
              "type": "boolean"
            }
          },
          "required": [
            "balance",
            "rate",
            "monthlyPI",
            "monthsRemaining",
            "loanType",
            "hasMI"
          ],
          "additionalProperties": false
        },
        "property": {
          "type": "object",
          "properties": {
            "estimatedValue": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 1000000000,
              "description": "US dollars, greater than zero."
            },
            "originalValue": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 1000000000,
              "description": "US dollars, greater than zero."
            },
            "type": {
              "type": "string",
              "enum": [
                "single-family",
                "condo",
                "multi-unit"
              ]
            },
            "occupancy": {
              "type": "string",
              "enum": [
                "primary",
                "second-home",
                "investment"
              ]
            },
            "zipCode": {
              "description": "Optional five-digit ZIP used for the regional closing estimate.",
              "type": "string",
              "pattern": "^\\d{5}$"
            }
          },
          "required": [
            "estimatedValue",
            "type",
            "occupancy"
          ],
          "additionalProperties": false
        },
        "borrower": {
          "type": "object",
          "properties": {
            "creditTier": {
              "type": "string",
              "enum": [
                "excellent",
                "good",
                "fair",
                "below"
              ]
            },
            "isVeteran": {
              "type": "boolean"
            },
            "seasonedSixMonths": {
              "type": "boolean"
            },
            "marginalTaxRate": {
              "description": "Optional marginal tax fraction, e.g. 0.22.",
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          },
          "required": [
            "creditTier",
            "isVeteran",
            "seasonedSixMonths"
          ],
          "additionalProperties": false
        },
        "goals": {
          "maxItems": 6,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "lower-payment",
              "pay-off-faster",
              "cash-out",
              "drop-mi",
              "arm-to-fixed",
              "consolidate-debts"
            ]
          }
        },
        "debtsToConsolidate": {
          "maxItems": 8,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "description": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "pattern": "^[^<>\\p{Cc}]+$",
                "description": "Short plain-text scenario label."
              },
              "balance": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1000000000,
                "description": "US dollars, greater than zero."
              },
              "apr": {
                "type": "number",
                "minimum": 0,
                "maximum": 100,
                "description": "Percentage points (6.5 means 6.5%)."
              },
              "monthlyPayment": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1000000000,
                "description": "US dollars, greater than zero."
              }
            },
            "required": [
              "description",
              "balance",
              "apr",
              "monthlyPayment"
            ],
            "additionalProperties": false
          }
        },
        "cashOutAmount": {
          "type": "number",
          "minimum": 0,
          "maximum": 1000000000,
          "description": "US dollars; enter zero when this cost is absent."
        },
        "extraPrincipalPerMonth": {
          "type": "number",
          "minimum": 0,
          "maximum": 1000000000,
          "description": "US dollars; enter zero when this cost is absent."
        }
      },
      "required": [
        "current",
        "property",
        "borrower",
        "goals"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "quoteOwner",
    "quoteRights",
    "quoteSource",
    "quoteDate",
    "horizonYears",
    "quotedRates",
    "profile"
  ],
  "additionalProperties": false
}

Production endpoint: POST https://accounts.hasstechapi.com/v2/reports/mortgage-refinance-strategies-quoted
Formula: prepare-mortgage-refinance-strategies-quoted-1.0.0 · Report version: 1.0.0