Loan & Mortgage Calculator

Loan & Mortgage Calculator API

Finance

Calculate loan and mortgage payments, total interest and payoff date, with bi-weekly and accelerated payments, extra payments, Canadian semi-annual compounding and a full schedule.

Authentication

Send your API key as a Bearer token in the Authorization header (Authorization: Bearer YOUR_API_KEY), or in an X-API-Key header.

Rate Limit

120 requests per minute

Endpoints

1 endpoint available

Overview

Works out the regular payment, total interest, total paid and payoff date for a loan or mortgage, with an optional extra payment each period and a year-by-year or payment-by-payment schedule.

Interest and payments

  • compounding: "standard" compounds once per payment (rate divided by payments per year). "canadian" compounds semi-annually, as the Interest Act requires for fixed-rate mortgages in Canada.
  • accelerated-bi-weekly and accelerated-weekly pay the monthly payment divided by 2 or 4, every 2 weeks or every week. That adds up to one extra monthly payment a year, so the loan finishes early.
  • The schedule works in whole cents, like a lender's: the payment and each period's interest are rounded to the cent and the last payment clears what is left.
  • extraPayment is paid with every payment and goes straight to principal. When it is above 0, withoutExtraPayment shows the same loan without it, with interestSaved and paymentsSaved.
  • The term can be 1 to 600 months. A rate of 0 works.

Dates

  • Dates are YYYY-MM-DD and are handled in UTC, so they do not shift. Monthly payment dates keep the day of the month and clamp to month end (January 31 is followed by February 28 or 29).
  • If firstPaymentDate is left out, it is the first day of the month after referenceDate. If referenceDate is also left out, that is today's date in UTC on the server. Send firstPaymentDate for results that do not change from day to day. The date used comes back as firstPaymentDate.

Schedule

  • schedule: "yearly" (default) returns yearly, one row per year.
  • schedule: "payments" returns payments, one row per payment, in pages. Use scheduleOffset and scheduleLimit (up to 1,000 per request). paymentsTotal and paymentsHasMore tell you when to stop.
  • schedule: "none" returns the summary only.

Amounts are numbers in dollars, to the cent.

Endpoints

POST
https://opentools.ca/api/v1/tools/loan-calculator
Calculate loan or mortgage payments with an amortization schedule

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
principal
number
Required
Loan amount, 1 or more.
annualRate
number
Required
Annual interest rate as a percentage, 0 to 50.
term
number
Required
Length of the loan, in termUnit. Works out to 1 to 600 months.
termUnit
string
Enum: years, months
OptionalUnit for term.Default: years
frequency
string
Enum: monthly, bi-weekly, weekly, accelerated-bi-weekly, accelerated-weekly
OptionalHow often payments are made.Default: monthly
compounding
string
Enum: standard, canadian
OptionalInterest convention.Default: standard
extraPayment
number
OptionalExtra amount paid with every payment, straight to principal.Default: 0
firstPaymentDate
string
OptionalDate of the first payment, YYYY-MM-DD, in years 1900 to 2400. Defaults to the first day of the month after referenceDate.
referenceDate
string
OptionalUsed only when firstPaymentDate is missing. Defaults to today's date in UTC on the server.Default: today (UTC)
schedule
string
Enum: none, yearly, payments
OptionalWhich schedule to return.Default: yearly
scheduleOffset
number
Optionalpayments schedule only. Number of payments to skip.Default: 0
scheduleLimit
number
Optionalpayments schedule only. Payments to return, 1 to 1,000.Default: 360

Response Example

{
  "success": true,
  "principal": 25000,
  "annualRate": 6,
  "termMonths": 24,
  "frequency": "monthly",
  "compounding": "standard",
  "extraPayment": 0,
  "firstPaymentDate": "2027-01-01",
  "paymentsPerYear": 12,
  "payment": 1108.02,
  "periodicRate": 0.005,
  "effectiveAnnualRate": 6.167781,
  "scheduledPaymentCount": 24,
  "paymentCount": 24,
  "totalInterest": 1592.37,
  "totalPaid": 26592.37,
  "payoffDate": "2028-12-01",
  "withoutExtraPayment": null,
  "yearly": [
    {
      "year": 1,
      "payments": 12,
      "principal": 12126.11,
      "interest": 1170.13,
      "extra": 0,
      "endBalance": 12873.89,
      "endDate": "2027-12-01"
    },
    {
      "year": 2,
      "payments": 12,
      "principal": 12873.89,
      "interest": 422.24,
      "extra": 0,
      "endBalance": 0,
      "endDate": "2028-12-01"
    }
  ]
}

Error Codes

400
Bad Request - A field is invalid, the term is outside 1 to 600 months, or firstPaymentDate is outside 1900 to 2400
401
Unauthorized - Missing or invalid API key
403
Forbidden - The API key is inactive or expired, or the request IP is not allowed
405
Method Not Allowed - This endpoint accepts POST only
429
Too Many Requests - Rate limit exceeded (120 requests per minute per API key)
500
Internal Server Error

Code Examples

# Two-year loan, summary and yearly schedule
curl -X POST https://opentools.ca/api/v1/tools/loan-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "principal": 25000,
  "annualRate": 6,
  "term": 2,
  "frequency": "monthly",
  "firstPaymentDate": "2027-01-01",
  "schedule": "yearly"
}'

# Canadian mortgage with an extra payment, first three payments
curl -X POST https://opentools.ca/api/v1/tools/loan-calculator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "principal": 400000,
  "annualRate": 5,
  "term": 25,
  "compounding": "canadian",
  "extraPayment": 200,
  "referenceDate": "2026-11-25",
  "schedule": "payments",
  "scheduleLimit": 3
}'

Ready to get started?

Create an API key to start using the Loan & Mortgage Calculator API.

Rather use it in your browser? Open the Loan & Mortgage Calculator