Skip to content

PDF report

Purchase strategies using supplied quotes

Purchase 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-purchase-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-purchase-strategies-quoted";
const input = {
  "quoteOwner": "Example Planning Group",
  "quoteRights": "caller-owned",
  "quoteSource": "Illustrative purchase quotes",
  "quoteDate": "2026-11-14",
  "horizonYears": 7,
  "quotedRates": {
    "max-down": 6.25,
    "one-point": 6.125,
    "no-points": 6.5,
    "minimum-down": 6.75,
    "fha-remodel": 6.25,
    "arm-prepay": 6,
    "va-zero-down": 6.25,
    "split-reserve": 6.5
  },
  "profile": {
    "property": {
      "purchasePrice": 400000,
      "type": "single-family",
      "occupancy": "primary"
    },
    "cashAvailable": 120000,
    "reservePreference": "standard",
    "borrower": {
      "creditTier": "good",
      "isVeteran": false,
      "isRural": false,
      "expectedYearsToStay": 7
    },
    "goals": [
      "lowest-cost"
    ]
  },
  "sortKey": "lowest-total-cost",
  "eligibleOnly": false
};
const requestId = Date.now() + "." + randomUUID();
const output = "mortgage-purchase-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-purchase-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 modeled option. Enter the one-point and no-points quotes separately.

profileRequired
object
profile.propertyRequired
object
profile.property.purchasePriceRequired
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.estimatedRemodelBudgetOptional
number

US dollars; enter zero when this cost is absent.

Min 0 · Max 1000000000
profile.cashAvailableRequired
number

US dollars; enter zero when this cost is absent.

Min 0 · Max 1000000000
profile.reservePreferenceRequired
stringAllowed: "minimal", "standard", "generous"
profile.borrowerRequired
object
profile.borrower.creditTierRequired
stringAllowed: "excellent", "good", "fair", "below"
profile.borrower.isVeteranRequired
boolean
profile.borrower.isRuralRequired
boolean
profile.borrower.expectedYearsToStayRequired
integer

Whole years of payments.

Min 1 · Max 50
profile.goalsRequired
arrayMax items 5
sortKeyRequired
stringAllowed: "lowest-monthly", "lowest-total-cost", "lowest-cash-used", "most-equity-at-closing"
eligibleOnlyRequired
boolean
Example input (JSON)

The server example adds a fresh requestId to this input.

{
  "input": {
    "quoteOwner": "Example Planning Group",
    "quoteRights": "caller-owned",
    "quoteSource": "Illustrative purchase quotes",
    "quoteDate": "2026-11-14",
    "horizonYears": 7,
    "quotedRates": {
      "max-down": 6.25,
      "one-point": 6.125,
      "no-points": 6.5,
      "minimum-down": 6.75,
      "fha-remodel": 6.25,
      "arm-prepay": 6,
      "va-zero-down": 6.25,
      "split-reserve": 6.5
    },
    "profile": {
      "property": {
        "purchasePrice": 400000,
        "type": "single-family",
        "occupancy": "primary"
      },
      "cashAvailable": 120000,
      "reservePreference": "standard",
      "borrower": {
        "creditTier": "good",
        "isVeteran": false,
        "isRural": false,
        "expectedYearsToStay": 7
      },
      "goals": [
        "lowest-cost"
      ]
    },
    "sortKey": "lowest-total-cost",
    "eligibleOnly": false
  }
}
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": [
          "max-down",
          "one-point",
          "no-points",
          "minimum-down",
          "fha-remodel",
          "arm-prepay",
          "va-zero-down",
          "split-reserve"
        ]
      },
      "additionalProperties": {
        "type": "number",
        "minimum": 0,
        "maximum": 100,
        "description": "Percentage points (6.5 means 6.5%)."
      },
      "description": "Final annual rate in percent for each modeled option. Enter the one-point and no-points quotes separately."
    },
    "profile": {
      "type": "object",
      "properties": {
        "property": {
          "type": "object",
          "properties": {
            "purchasePrice": {
              "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"
              ]
            },
            "estimatedRemodelBudget": {
              "type": "number",
              "minimum": 0,
              "maximum": 1000000000,
              "description": "US dollars; enter zero when this cost is absent."
            }
          },
          "required": [
            "purchasePrice",
            "type",
            "occupancy"
          ],
          "additionalProperties": false
        },
        "cashAvailable": {
          "type": "number",
          "minimum": 0,
          "maximum": 1000000000,
          "description": "US dollars; enter zero when this cost is absent."
        },
        "reservePreference": {
          "type": "string",
          "enum": [
            "minimal",
            "standard",
            "generous"
          ]
        },
        "borrower": {
          "type": "object",
          "properties": {
            "creditTier": {
              "type": "string",
              "enum": [
                "excellent",
                "good",
                "fair",
                "below"
              ]
            },
            "isVeteran": {
              "type": "boolean"
            },
            "isRural": {
              "type": "boolean"
            },
            "expectedYearsToStay": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "description": "Whole years of payments."
            }
          },
          "required": [
            "creditTier",
            "isVeteran",
            "isRural",
            "expectedYearsToStay"
          ],
          "additionalProperties": false
        },
        "goals": {
          "maxItems": 5,
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "lowest-payment",
              "lowest-cost",
              "max-equity",
              "keep-cash-liquid",
              "plan-future-remodel"
            ]
          }
        }
      },
      "required": [
        "property",
        "cashAvailable",
        "reservePreference",
        "borrower",
        "goals"
      ],
      "additionalProperties": false
    },
    "sortKey": {
      "type": "string",
      "enum": [
        "lowest-monthly",
        "lowest-total-cost",
        "lowest-cash-used",
        "most-equity-at-closing"
      ]
    },
    "eligibleOnly": {
      "type": "boolean"
    }
  },
  "required": [
    "quoteOwner",
    "quoteRights",
    "quoteSource",
    "quoteDate",
    "horizonYears",
    "quotedRates",
    "profile",
    "sortKey",
    "eligibleOnly"
  ],
  "additionalProperties": false
}

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