Personal finance · Calculation
Debt portfolio on a chosen date
Combine entered active debts at an explicit as-of date, with consolidated payments, balances and a projected debt-free date.
Visitors can explore a sample snapshot. Saved accounts, loans and properties open within the member’s own Financial Hub.
Example result · totalBalance: 17100 USD See output
- Cost per success
- 2 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 debt-portfolio-as-of.
Keep the key on your server. A successful call uses 2 calculation credits.
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/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 = 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 -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/debt-portfolio-as-of' \
--header "Authorization: Bearer $HT_PRODUCTION_KEY" \
--header 'Content-Type: application/json' \
--header "Idempotency-Key: $request_id" \
--data-binary @- <<'HT_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"
}
HT_INPUT
) If your request fails
400 INVALID_INPUT-
Read
error.detailswhen present. Node prints each issue. cURL returns the JSON body. Eachpathpoints 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.
401or403- Check that the server has the bearer key for the endpoint’s environment and that the key includes
debt-portfolio-as-of. 429- Read the service error code, check your allowance, and wait for the
Retry-Afterinterval when supplied before trying again. - Lost response,
409or503 - 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_IDto 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.
totalBalance- 17100 USD
totalMonthlyPayments- 515 USD/month
debtFreeOn- 2031-05-01
Full example response (JSON)
{
"status": "available",
"result": {
"totalBalance": 17100,
"totalMonthlyPayments": 515,
"debtFreeOn": "2031-05-01",
"interestSavedVsMinimum": null,
"anyEstimated": true
},
"formulaVersion": "debt-portfolio-as-of-htcalc-719df2c0e105",
"units": {
"totalBalance": "USD",
"totalMonthlyPayments": "USD/month",
"interestSavedVsMinimum": "USD"
},
"assumptions": [],
"warnings": [],
"creditCost": 2
}Request contract
Accepted inputs
Fields for this example. Expand the schema for all supported combinations and limits.
FieldType, units and limits
debtsRequiredUp to four dated manual debt records; use distinct debt identifiers.
Min items 1 · Max items 4debts[].current_balanceRequiredOutstanding balance at the anchor date. In USD.
Min 0 · Max 10000000debts[].debt_typeRequiredEntered debt type.
Allowed: "auto", "student", "personal", "credit_card", "other"debts[].descriptionOptionalShort caller-selected display label.
Min length 1 · Max length 80debts[].detailsRequireddebts[].details.statement_dateOptionalBalance anchor date. Omit to use tracking.started_on. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10debts[].details.trackingRequireddebts[].details.tracking.balance_sourceOptionalOrigin of the balance observation.
Allowed: "entered", "statement", "check_in"debts[].details.tracking.closed_onOptionalOptional payoff or closure date. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10debts[].details.tracking.confirmed_throughOptionalMost recent confirmed payment due date; omit if none. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10debts[].details.tracking.due_dayRequiredDay of month the payment falls due. Short months clamp to their final day.
Min 1 · Max 31debts[].details.tracking.liveRequiredActivate the explicit-date manual projection.
Must equal truedebts[].details.tracking.minimum_paymentOptionalKnown minimum for the optional comparison with the chosen monthly payment. In USD per month.
Min 0.01 · Max 1000000debts[].details.tracking.promo_aprConditionalAnnual promotional rate while in force. In percentage points (6.5 means 6.5%).
Min 0 · Max 100debts[].details.tracking.promo_ends_onConditionalDate on which the regular rate begins. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10debts[].details.tracking.start_balanceRequiredBalance when tracking started. In USD.
Min 0 · Max 10000000debts[].details.tracking.started_onRequiredDate tracking started. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10debts[].idRequiredCaller-chosen opaque debt identifier.
Min length 1 · Max length 64debts[].interest_rateRequiredRegular annual loan or card rate. In percentage points (6.5 means 6.5%).
Min 0 · Max 100debts[].monthly_paymentRequiredScheduled monthly payment. In USD per month.
Min 0.01 · Max 1000000todayRequiredShared as-of date for all entered debts. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10Example request body (JSON)
{
"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://calc.hasstechapi.com/v2/calc/debt-portfolio-as-of
Formula: debt-portfolio-as-of-htcalc-719df2c0e105