Personal finance · Calculation
Debt balance on a chosen date
Project an entered debt from a dated balance and scheduled payment. today is the requested as-of date. The result identifies unconfirmed payments, estimated balance and projected payoff.
Visitors can explore a sample snapshot. Saved accounts, loans and properties open within the member’s own Financial Hub.
Example result · balanceToday: 13660.5 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-balance-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-balance-as-of";
const input = {
"debt": {
"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"
}
}
},
"today": "2026-10-15"
};
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-balance-as-of' \
--header "Authorization: Bearer $HT_PRODUCTION_KEY" \
--header 'Content-Type: application/json' \
--header "Idempotency-Key: $request_id" \
--data-binary @- <<'HT_INPUT'
{
"debt": {
"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"
}
}
},
"today": "2026-10-15"
}
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-balance-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.
balanceToday- 13660.5 USD
balanceKind- estimated
anchorOn- 2026-09-24
Full example response (JSON)
{
"status": "available",
"result": {
"balanceToday": 13660.5,
"balanceKind": "estimated",
"anchorOn": "2026-09-24",
"nextDueOn": "2026-11-15",
"pendingDueDates": [
"2026-10-15"
],
"monthlyInterestNow": 78.55,
"payoffOn": "2029-11-15",
"monthsToPayoff": 37,
"remainingInterest": 1506.51,
"percentPaid": 2.43,
"notPayingDown": null,
"promoEnding": null,
"zeroApr": false,
"paidOff": false,
"mortgage": null
},
"formulaVersion": "debt-balance-as-of-htcalc-719df2c0e105",
"units": {
"balanceToday": "USD",
"monthlyInterestNow": "USD/month",
"monthsToPayoff": "months",
"remainingInterest": "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
debtRequireddebt.current_balanceRequiredOutstanding balance at the anchor date. In USD.
Min 0 · Max 10000000debt.debt_typeRequiredEntered debt type.
Allowed: "auto", "student", "personal", "credit_card", "other"debt.descriptionOptionalShort caller-selected display label.
Min length 1 · Max length 80debt.detailsRequireddebt.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 10debt.details.trackingRequireddebt.details.tracking.balance_sourceOptionalOrigin of the balance observation.
Allowed: "entered", "statement", "check_in"debt.details.tracking.closed_onOptionalOptional payoff or closure date. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10debt.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 10debt.details.tracking.due_dayRequiredDay of month the payment falls due. Short months clamp to their final day.
Min 1 · Max 31debt.details.tracking.liveRequiredActivate the explicit-date manual projection.
Must equal truedebt.details.tracking.minimum_paymentOptionalKnown minimum for the optional comparison with the chosen monthly payment. In USD per month.
Min 0.01 · Max 1000000debt.details.tracking.promo_aprConditionalAnnual promotional rate while in force. In percentage points (6.5 means 6.5%).
Min 0 · Max 100debt.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 10debt.details.tracking.start_balanceRequiredBalance when tracking started. In USD.
Min 0 · Max 10000000debt.details.tracking.started_onRequiredDate tracking started. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10debt.idRequiredCaller-chosen opaque debt identifier.
Min length 1 · Max length 64debt.interest_rateRequiredRegular annual loan or card rate. In percentage points (6.5 means 6.5%).
Min 0 · Max 100debt.monthly_paymentRequiredScheduled monthly payment. In USD per month.
Min 0.01 · Max 1000000todayRequiredAs-of date for manual projection. UTC calendar date, YYYY-MM-DD (1900-2199).
Format: date · Min length 10 · Max length 10Example request body (JSON)
{
"debt": {
"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"
}
}
},
"today": "2026-10-15"
} Full JSON schema
{
"additionalProperties": false,
"properties": {
"debt": {
"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"
},
"today": {
"description": "As-of date for manual projection. 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": [
"debt",
"today"
],
"type": "object"
}Production endpoint: POST https://calc.hasstechapi.com/v2/calc/debt-balance-as-of
Formula: debt-balance-as-of-htcalc-719df2c0e105