Skip to content

Personal finance · Calculation

Auto loan early payoff plans

Compare extra monthly payments, a lump sum, payment rounding and biweekly payments against the current car loan.

Example result · payment: 450.77 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 auto-accelerated-payoff.

Keep the key on your server. A successful call uses 2 calculation credits.

Production request

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/auto-accelerated-payoff";
const input = {
  "balance": 18500,
  "aprPct": 7.9,
  "monthsLeft": 48,
  "currentPayment": 450.77,
  "extraMonthly": 50,
  "lumpSum": 1000,
  "roundTo": 50
};
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 HT_PRODUCTION_KEY on your server. Run in a POSIX shell with cURL 7.76+ and Python 3.7+ to create a request ID.

(
  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/auto-accelerated-payoff' \
    --header "Authorization: Bearer $HT_PRODUCTION_KEY" \
    --header 'Content-Type: application/json' \
    --header "Idempotency-Key: $request_id" \
    --data-binary @- <<'HT_INPUT'
{
  "balance": 18500,
  "aprPct": 7.9,
  "monthsLeft": 48,
  "currentPayment": 450.77,
  "extraMonthly": 50,
  "lumpSum": 1000,
  "roundTo": 50
}
HT_INPUT
)
If your request fails
400 INVALID_INPUT

Read error.details when present. Node prints each issue. cURL returns the JSON body. Each path points 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.

401 or 403
Check that the server has the bearer key for the endpoint’s environment and that the key includes auto-accelerated-payoff.
429
Read the service error code, check your allowance, and wait for the Retry-After interval when supplied before trying again.
Lost response, 409 or 503
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_ID to 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.

payment
450.77
workedOutPayment
450.7711726
baseline.months
48 months
Full example response (JSON)
{
  "status": "available",
  "result": {
    "valid": true,
    "problem": null,
    "payment": 450.77,
    "workedOutPayment": 450.7711726,
    "termMismatch": null,
    "baseline": {
      "months": 48,
      "interest": 3137.05,
      "totalPaid": 21637.05
    },
    "ways": {
      "extra": {
        "id": "extra",
        "amount": 50,
        "extraEachMonth": 50,
        "months": 43,
        "interest": 2767.36,
        "totalPaid": 21267.36,
        "monthsSooner": 5,
        "interestSaved": 369.69,
        "noChange": false
      },
      "lump": {
        "id": "lump",
        "amount": 1000,
        "extraEachMonth": 0,
        "months": 45,
        "interest": 2775.9,
        "totalPaid": 21275.9,
        "monthsSooner": 3,
        "interestSaved": 361.15,
        "noChange": false
      },
      "round": {
        "id": "round",
        "amount": 500,
        "extraEachMonth": 49.23,
        "months": 43,
        "interest": 2772.34,
        "totalPaid": 21272.34,
        "monthsSooner": 5,
        "interestSaved": 364.71,
        "noChange": false
      },
      "biweekly": {
        "id": "biweekly",
        "amount": 225.39,
        "extraEachMonth": 0,
        "months": 44,
        "interest": 2812.82,
        "totalPaid": 21312.82,
        "monthsSooner": 4,
        "interestSaved": 324.23,
        "noChange": false
      }
    },
    "bestId": "extra"
  },
  "formulaVersion": "auto-accelerated-payoff-htcalc-719df2c0e105",
  "units": {
    "baseline.months": "months",
    "baseline.interest": "USD",
    "ways.extra.interestSaved": "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

aprPctRequired
number

Annual car loan rate. In percentage points (6.5 means 6.5%).

Min 0 · Max 100
balanceRequired
number

Outstanding car loan balance. In USD.

Min 0.01 · Max 10000000
currentPaymentRequired
number

Current scheduled principal and interest. In USD per month.

Min 0.01 · Max 1000000
extraMonthlyRequired
number

Additional recurring principal. In USD per month.

Min 0 · Max 1000000
lumpSumRequired
number

One-time payment applied now. In USD.

Min 0 · Max 10000000
monthsLeftRequired
integer

Current remaining loan term. In whole months.

Min 1 · Max 120
roundToRequired
integer

Payment rounding increment in USD.

Allowed: 25, 50, 100
Example request body (JSON)
{
  "balance": 18500,
  "aprPct": 7.9,
  "monthsLeft": 48,
  "currentPayment": 450.77,
  "extraMonthly": 50,
  "lumpSum": 1000,
  "roundTo": 50
}
Full JSON schema
{
  "additionalProperties": false,
  "properties": {
    "aprPct": {
      "anyOf": [
        {
          "const": 0
        },
        {
          "minimum": 0.000001
        }
      ],
      "description": "Annual car loan rate. In percentage points (6.5 means 6.5%).",
      "maximum": 100,
      "minimum": 0,
      "type": "number"
    },
    "balance": {
      "description": "Outstanding car loan balance. In USD.",
      "maximum": 10000000,
      "minimum": 0.01,
      "type": "number"
    },
    "currentPayment": {
      "description": "Current scheduled principal and interest. In USD per month.",
      "maximum": 1000000,
      "minimum": 0.01,
      "type": "number"
    },
    "extraMonthly": {
      "description": "Additional recurring principal. In USD per month.",
      "maximum": 1000000,
      "minimum": 0,
      "type": "number"
    },
    "lumpSum": {
      "description": "One-time payment applied now. In USD.",
      "maximum": 10000000,
      "minimum": 0,
      "type": "number"
    },
    "monthsLeft": {
      "description": "Current remaining loan term. In whole months.",
      "maximum": 120,
      "minimum": 1,
      "type": "integer"
    },
    "roundTo": {
      "description": "Payment rounding increment in USD.",
      "enum": [
        25,
        50,
        100
      ],
      "type": "integer"
    }
  },
  "required": [
    "balance",
    "aprPct",
    "monthsLeft",
    "currentPayment",
    "extraMonthly",
    "lumpSum",
    "roundTo"
  ],
  "type": "object"
}

Production endpoint: POST https://calc.hasstechapi.com/v2/calc/auto-accelerated-payoff
Formula: auto-accelerated-payoff-htcalc-719df2c0e105

Related PDF reports