Skip to content

PDF report

Debt portfolio as of a date

Combined supplied debt payments, balances and projected debt-free date.

Open Financial Hub · Your numbers in HT Calc

Visitors can explore a sample snapshot. Saved accounts, loans and properties open within the member’s own Financial Hub.

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 debt-portfolio-as-of 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/debt-portfolio-as-of";
const input = {
  "debts": [
    {
      "id": "example-car",
      "debt_type": "auto",
      "description": "Car",
      "current_balance": 14000,
      "interest_rate": 6.9,
      "monthly_payment": 420,
      "details": {
        "statement_date": "2026-09-24",
        "tracking": {
          "live": true,
          "due_day": 15,
          "start_balance": 14000,
          "started_on": "2026-09-24"
        }
      }
    },
    {
      "id": "example-card",
      "debt_type": "credit_card",
      "description": "Card",
      "current_balance": 3100,
      "interest_rate": 24.99,
      "monthly_payment": 95,
      "details": {
        "statement_date": "2026-09-10",
        "tracking": {
          "live": true,
          "due_day": 1,
          "start_balance": 3100,
          "started_on": "2026-09-10"
        }
      }
    }
  ],
  "today": "2026-09-24"
};
const requestId = Date.now() + "." + randomUUID();
const output = "debt-portfolio-as-of-" + 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 debt-portfolio-as-of-<requestId>.pdf.

See the Debt portfolio on a chosen date calculation and example result.

Request contract

Accepted inputs

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

FieldType, units and limits

debtsRequired
array

Up to four dated manual debt records; use distinct debt identifiers.

Min items 1 · Max items 4
debts[].current_balanceRequired
number

Outstanding balance at the anchor date. In USD.

Min 0 · Max 10000000
debts[].debt_typeRequired
string

Entered debt type.

Allowed: "auto", "student", "personal", "credit_card", "other"
debts[].descriptionOptional
string

Short caller-selected display label.

Min length 1 · Max length 80
debts[].detailsRequired
object
debts[].details.statement_dateOptional
string

Balance anchor date. Omit to use tracking.started_on. UTC calendar date, YYYY-MM-DD (1900-2199).

Format: date · Min length 10 · Max length 10
debts[].details.trackingRequired
object
debts[].details.tracking.balance_sourceOptional
string

Origin of the balance observation.

Allowed: "entered", "statement", "check_in"
debts[].details.tracking.closed_onOptional
string

Optional payoff or closure date. UTC calendar date, YYYY-MM-DD (1900-2199).

Format: date · Min length 10 · Max length 10
debts[].details.tracking.confirmed_throughOptional
string

Most recent confirmed payment due date; omit if none. UTC calendar date, YYYY-MM-DD (1900-2199).

Format: date · Min length 10 · Max length 10
debts[].details.tracking.due_dayRequired
integer

Day of month the payment falls due. Short months clamp to their final day.

Min 1 · Max 31
debts[].details.tracking.liveRequired
boolean

Activate the explicit-date manual projection.

Must equal true
debts[].details.tracking.minimum_paymentOptional
number

Known minimum for the optional comparison with the chosen monthly payment. In USD per month.

Min 0.01 · Max 1000000
debts[].details.tracking.promo_aprConditional
number

Annual promotional rate while in force. In percentage points (6.5 means 6.5%).

Min 0 · Max 100
debts[].details.tracking.promo_ends_onConditional
string

Date on which the regular rate begins. UTC calendar date, YYYY-MM-DD (1900-2199).

Format: date · Min length 10 · Max length 10
debts[].details.tracking.start_balanceRequired
number

Balance when tracking started. In USD.

Min 0 · Max 10000000
debts[].details.tracking.started_onRequired
string

Date tracking started. UTC calendar date, YYYY-MM-DD (1900-2199).

Format: date · Min length 10 · Max length 10
debts[].idRequired
string

Caller-chosen opaque debt identifier.

Min length 1 · Max length 64
debts[].interest_rateRequired
number

Regular annual loan or card rate. In percentage points (6.5 means 6.5%).

Min 0 · Max 100
debts[].monthly_paymentRequired
number

Scheduled monthly payment. In USD per month.

Min 0.01 · Max 1000000
todayRequired
string

Shared as-of date for all entered debts. UTC calendar date, YYYY-MM-DD (1900-2199).

Format: date · Min length 10 · Max length 10
Example input (JSON)

The server example adds a fresh requestId to this input.

{
  "input": {
    "debts": [
      {
        "id": "example-car",
        "debt_type": "auto",
        "description": "Car",
        "current_balance": 14000,
        "interest_rate": 6.9,
        "monthly_payment": 420,
        "details": {
          "statement_date": "2026-09-24",
          "tracking": {
            "live": true,
            "due_day": 15,
            "start_balance": 14000,
            "started_on": "2026-09-24"
          }
        }
      },
      {
        "id": "example-card",
        "debt_type": "credit_card",
        "description": "Card",
        "current_balance": 3100,
        "interest_rate": 24.99,
        "monthly_payment": 95,
        "details": {
          "statement_date": "2026-09-10",
          "tracking": {
            "live": true,
            "due_day": 1,
            "start_balance": 3100,
            "started_on": "2026-09-10"
          }
        }
      }
    ],
    "today": "2026-09-24"
  }
}
Full JSON schema
{
  "additionalProperties": false,
  "properties": {
    "debts": {
      "description": "Up to four dated manual debt records; use distinct debt identifiers.",
      "items": {
        "additionalProperties": false,
        "properties": {
          "current_balance": {
            "description": "Outstanding balance at the anchor date. In USD.",
            "maximum": 10000000,
            "minimum": 0,
            "type": "number"
          },
          "debt_type": {
            "description": "Entered debt type.",
            "enum": [
              "auto",
              "student",
              "personal",
              "credit_card",
              "other"
            ],
            "type": "string"
          },
          "description": {
            "description": "Short caller-selected display label.",
            "maxLength": 80,
            "minLength": 1,
            "type": "string"
          },
          "details": {
            "additionalProperties": false,
            "properties": {
              "statement_date": {
                "description": "Balance anchor date. Omit to use tracking.started_on. UTC calendar date, YYYY-MM-DD (1900-2199).",
                "format": "date",
                "maxLength": 10,
                "minLength": 10,
                "pattern": "^(?:19|20|21)[0-9]{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$",
                "type": "string"
              },
              "tracking": {
                "additionalProperties": false,
                "allOf": [
                  {
                    "if": {
                      "required": [
                        "promo_apr"
                      ]
                    },
                    "then": {
                      "required": [
                        "promo_ends_on"
                      ]
                    }
                  },
                  {
                    "if": {
                      "required": [
                        "promo_ends_on"
                      ]
                    },
                    "then": {
                      "required": [
                        "promo_apr"
                      ]
                    }
                  }
                ],
                "properties": {
                  "balance_source": {
                    "description": "Origin of the balance observation.",
                    "enum": [
                      "entered",
                      "statement",
                      "check_in"
                    ],
                    "type": "string"
                  },
                  "closed_on": {
                    "description": "Optional payoff or closure date. UTC calendar date, YYYY-MM-DD (1900-2199).",
                    "format": "date",
                    "maxLength": 10,
                    "minLength": 10,
                    "pattern": "^(?:19|20|21)[0-9]{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$",
                    "type": "string"
                  },
                  "confirmed_through": {
                    "description": "Most recent confirmed payment due date; omit if none. UTC calendar date, YYYY-MM-DD (1900-2199).",
                    "format": "date",
                    "maxLength": 10,
                    "minLength": 10,
                    "pattern": "^(?:19|20|21)[0-9]{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$",
                    "type": "string"
                  },
                  "due_day": {
                    "description": "Day of month the payment falls due. Short months clamp to their final day.",
                    "maximum": 31,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "live": {
                    "const": true,
                    "description": "Activate the explicit-date manual projection.",
                    "type": "boolean"
                  },
                  "minimum_payment": {
                    "description": "Known minimum for the optional comparison with the chosen monthly payment. In USD per month.",
                    "maximum": 1000000,
                    "minimum": 0.01,
                    "type": "number"
                  },
                  "promo_apr": {
                    "anyOf": [
                      {
                        "const": 0
                      },
                      {
                        "minimum": 0.000001
                      }
                    ],
                    "description": "Annual promotional rate while in force. In percentage points (6.5 means 6.5%).",
                    "maximum": 100,
                    "minimum": 0,
                    "type": "number"
                  },
                  "promo_ends_on": {
                    "description": "Date on which the regular rate begins. UTC calendar date, YYYY-MM-DD (1900-2199).",
                    "format": "date",
                    "maxLength": 10,
                    "minLength": 10,
                    "pattern": "^(?:19|20|21)[0-9]{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$",
                    "type": "string"
                  },
                  "start_balance": {
                    "description": "Balance when tracking started. In USD.",
                    "maximum": 10000000,
                    "minimum": 0,
                    "type": "number"
                  },
                  "started_on": {
                    "description": "Date tracking started. UTC calendar date, YYYY-MM-DD (1900-2199).",
                    "format": "date",
                    "maxLength": 10,
                    "minLength": 10,
                    "pattern": "^(?:19|20|21)[0-9]{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$",
                    "type": "string"
                  }
                },
                "required": [
                  "live",
                  "due_day",
                  "start_balance",
                  "started_on"
                ],
                "type": "object"
              }
            },
            "required": [
              "tracking"
            ],
            "type": "object"
          },
          "id": {
            "description": "Caller-chosen opaque debt identifier.",
            "maxLength": 64,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9_-]+$",
            "type": "string"
          },
          "interest_rate": {
            "anyOf": [
              {
                "const": 0
              },
              {
                "minimum": 0.000001
              }
            ],
            "description": "Regular annual loan or card rate. In percentage points (6.5 means 6.5%).",
            "maximum": 100,
            "minimum": 0,
            "type": "number"
          },
          "monthly_payment": {
            "description": "Scheduled monthly payment. In USD per month.",
            "maximum": 1000000,
            "minimum": 0.01,
            "type": "number"
          }
        },
        "required": [
          "id",
          "debt_type",
          "current_balance",
          "interest_rate",
          "monthly_payment",
          "details"
        ],
        "type": "object"
      },
      "maxItems": 4,
      "minItems": 1,
      "type": "array"
    },
    "today": {
      "description": "Shared as-of date for all entered debts. UTC calendar date, YYYY-MM-DD (1900-2199).",
      "format": "date",
      "maxLength": 10,
      "minLength": 10,
      "pattern": "^(?:19|20|21)[0-9]{2}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$",
      "type": "string"
    }
  },
  "required": [
    "debts",
    "today"
  ],
  "type": "object"
}

Production endpoint: POST https://accounts.hasstechapi.com/v2/reports/debt-portfolio-as-of
Formula: debt-portfolio-as-of-htcalc-719df2c0e105 · Report version: 1.0.0