Drive the calculators by URL — parameters & JSON API
Every input on every calculator maps to a query parameter. That means every scenario has a URL: links are shareable, bookmarkable, and drivable by scripts and AI agents today — no SDK required. Parameters you omit fall back to the documented defaults (see methodology); invalid values are ignored and out-of-range values are clamped, so a partially-wrong link still renders a sensible result.
For example,
/lease-vs-buy-calculator?horizon=8&price=38000&mf=0.0018
opens the flagship comparison with an 8-year holding horizon, a negotiated price of
$38,000, and a money factor of 0.0018 (≈4.32% APR) —
every other input stays at its default.
Flagship parameters — Lease vs Buy Calculator
This table is generated from the same parameter codec the calculator itself uses, so it can never drift
from the code. Values travel in human units: percent-like parameters are percent numbers
(tax=7 means 7%), the money factor travels raw
(mf=0.0025), and money and distance are plain numbers with no symbols or
separators.
| Key | What it sets | Units / range | Default |
|---|---|---|---|
price | Negotiated vehicle price | USD · 0 – 10,000,000 | 42500 |
msrp | MSRP (residual basis) | USD · 0 – 10,000,000 | 45000 |
horizon | Holding horizon (years) | Years · 1 – 15 | 6 |
down | Down payment / cap cost reduction | USD · 0 – 10,000,000 | 2000 |
miles | Distance driven per year | miles per year · 0 – 100,000 | 12000 |
tax | Sales tax rate (%) | Percent number — 7 means 7% · 0 – 2,500 | 7 |
invest | Investment return rate (%/yr) | Percent number — 7 means 7% · 0 – 2,000 | 6 |
term | Lease term (months) | Months · 12 – 60 | 36 |
residual | Residual (% of MSRP) | Percent number — 7 means 7% · 1,000 – 9,000 | 57 |
mf | Money factor | Raw decimal — APR % = money factor × 2400 (0.00250 ≈ 6% APR) · 0 – 0.05 | 0.0025 |
allow | Mileage allowance per year | miles per year · 0 – 100,000 | 12000 |
excess | Excess mileage charge (per mile) | USD per mile · 0 – 10 | 0.25 |
acq | Acquisition fee | USD · 0 – 10,000 | 695 |
acqcap | Acquisition fee capitalized (1/0) | Flag — 1 = yes, 0 = no · 0 or 1 | 1 |
disp | Disposition fee | USD · 0 – 10,000 | 395 |
deposit | Security deposit | USD · 0 – 50,000 | 0 |
insdelta | Lease insurance delta (per month) | USD per month · -2,000 – 2,000 | 0 |
cash | Cash purchase (1/0) | Flag — 1 = yes, 0 = no · 0 or 1 | 0 |
apr | Loan APR (%) | Percent number — 7 means 7% · 0 – 3,000 | 7 |
loanterm | Loan term (months) | Months · 12 – 96 | 60 |
fees | Registration/doc fees | USD · 0 – 20,000 | 500 |
dep1 | Depreciation year 1 (%) | Percent number — 7 means 7% · 0 – 6,000 | 20 |
dep2 | Depreciation later years (%/yr) | Percent number — 7 means 7% · 0 – 4,000 | 15 |
resale | Expected resale at horizon (0 = use curve) | USD — 0 means “use the depreciation curve” · 0 – 10,000,000 | 0 |
warranty | Warranty years | Years · 0 – 10 | 3 |
maintw | Maintenance/yr under warranty | USD per year · 0 – 20,000 | 500 |
mainta | Maintenance/yr after warranty | USD per year · 0 – 20,000 | 1200 |
Parameters for the other calculators
The same conventions apply everywhere: percent-like parameters travel as percent numbers
(apr=7 means 7%), flags are 1 or
0, omitted parameters use the documented defaults, and unknown parameters are
ignored.
Auto Loan Calculator
| Key | What it sets | Units |
|---|---|---|
price | Vehicle price before tax | USD |
down | Down payment | USD |
trade | Trade-in value | USD |
tax | Sales tax rate | Percent number — 7 means 7% |
fees | Registration / doc fees | USD |
apr | Loan APR | Percent number — 7 means 7% |
term | Loan term | Months |
extra | Extra principal paid each month | USD per month |
Lease Payment Calculator
| Key | What it sets | Units |
|---|---|---|
msrp | MSRP (residual basis) | USD |
price | Negotiated price (capitalized cost) | USD |
down | Cap cost reduction | USD |
term | Lease term | Months |
residual | Residual value (% of MSRP) | Percent number — 7 means 7% |
mf | Money factor | Raw decimal — APR % = money factor × 2400 (0.00250 ≈ 6% APR) |
acq | Acquisition fee | USD |
acqcap | Acquisition fee rolled into the capitalized cost | Flag — 1 = yes, 0 = no |
tax | Sales tax rate | Percent number — 7 means 7% |
taxbasis | How the lease is taxed | “monthly” or “upfront” |
Car Affordability Calculator
| Key | What it sets | Units |
|---|---|---|
income | Annual gross income | USD per year |
debts | Existing monthly debt payments | USD per month |
down | Down payment | USD |
trade | Trade-in value | USD |
apr | Loan APR | Percent number — 7 means 7% |
term | Loan term | Months |
tax | Sales tax rate | Percent number — 7 means 7% |
fees | Registration / doc fees | USD |
pct | Target share of gross monthly income spent on the payment | Percent number — 10 means 10% |
Total Cost of Ownership Calculator
| Key | What it sets | Units |
|---|---|---|
price | Vehicle price | USD |
years | Ownership period | Years |
miles | Distance driven per year | miles per year |
mpg | Fuel economy | MPG |
fuel | Fuel price per gallon | USD |
ins | Insurance per year | USD per year |
maintw | Maintenance per year under warranty | USD per year |
mainta | Maintenance per year after warranty | USD per year |
warranty | Warranty length | Years |
tax | Sales tax rate | Percent number — 7 means 7% |
fees | Registration / doc fees | USD |
financed | Purchase is financed with a loan | Flag — 1 = yes, 0 = no |
apr | Loan APR | Percent number — 7 means 7% |
term | Loan term | Months |
down | Down payment | USD |
dep1 | Depreciation in year 1 | Percent number — 20 means 20% |
dep2 | Depreciation per later year (of remaining value) | Percent number — 15 means 15% |
Car Depreciation Calculator
| Key | What it sets | Units |
|---|---|---|
price | Vehicle price when new | USD |
years | Years to project | Years |
dep1 | Depreciation in year 1 | Percent number — 20 means 20% |
dep2 | Depreciation per later year (of remaining value) | Percent number — 15 means 15% |
JSON API
Prefer numbers over HTML? The comparison engine is exposed directly at
https://leasevsbuycar.com/api/calculate.
- GET — accepts exactly the flagship parameters documented above
(including
taxbasis), e.g.?horizon=8&price=38000. Human units, same as the calculator URLs. - POST — send a JSON body containing a partial
ComparisonInputsobject; it is merged over the documented defaults. Note the body uses engine units: rates are decimals ("salesTaxRate": 0.07means 7%), unlike GET parameters.
Both methods respond with the full ComparisonResult: the lease quote and
monthly payments, net costs and ending positions for each path, the break-even month, the verdict with its
drivers, and the month-by-month series behind the chart.
Example request
curl "https://leasevsbuycar.com/api/calculate?horizon=6" Example response (abbreviated, defaults with a 6-year horizon)
Comments and ellipses added for readability; the payment figures ($640.84 lease, $870.76 buy) match the worked example on the methodology page.
{
"verdict": "buy", // "buy" | "lease" | "even"
"savings": 7200, // net-cost gap at the horizon (rounded here)
"breakEvenMonths": 43, // null = leasing still ahead at the horizon
"leaseQuote": {
"monthlyPayment": 640.84, // tax-inclusive monthly lease payment
"dueAtSigning": 2640.84,
"aprEquivalent": 0.06 // money factor × 24, as a decimal APR
// …adjustedCapCost, residualValue, fee breakdown…
},
"buyMonthlyPayment": 870.76,
"resaleValueAtHorizon": 15086,
"lease": { … }, // net cost / net position, lease path
"buy": { … }, // net cost / net position, buy path
"series": [ … ] // one point per month, for charting
} POST body example
POST https://leasevsbuycar.com/api/calculate
Content-Type: application/json
{
"horizonYears": 8,
"salesTaxRate": 0.07,
"lease": { "moneyFactor": 0.0018 }
} CORS is open — call the API from any origin, in the browser or server-side.
For AI agents
You don't need the API to read results. Every calculator page renders its outcome in a machine-readable container — fetch a deep link and read the data attributes:
<section id="calculator-result"
data-verdict="buy"
data-savings="7200"
data-break-even-months="43"> -
A site guide for language models lives at the site root:
https://leasevsbuycar.com/llms.txt. -
Major AI crawlers are allowed in
https://leasevsbuycar.com/robots.txt. - Definitions for every term used in the parameter tables are on the glossary; the lease math itself is explained in how car lease math works.