Mortgage Calculator
Calculate monthly mortgage payments and generate a full amortization schedule for any fixed-rate loan. Returns the monthly payment, total cost, total interest, and a month-by-month breakdown.
Overview
Use Cases
- Mortgage calculators for real estate platforms
- Loan comparison tools
- Personal finance dashboards
- Amortization schedule exports for borrowers
- Financial planning and budgeting apps
Features
Standard fixed-rate amortization formula
Full month-by-month schedule (principal, interest, balance per payment)
Summary fields β monthly payment, total payment, total interest
Supports loan terms from 1 to 50 years
Any principal and annual interest rate
API Endpoints
Calculate Mortgage
Returns the monthly payment, total cost, and full amortization schedule for a fixed-rate mortgage.
GET
https://api.requiems.xyz/v1/finance/mortgage
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| principal | number |
Required | Loan amount in your chosen currency (e.g. 300000 for $300,000) |
| rate | number |
Required | Annual interest rate as a percentage (e.g. 6.5 for 6.5%). Must be greater than 0. |
| years | integer |
Required | Loan term in years (1β50) |
Try it out
Live DemoRequest
Loan amount in your chosen currency (e.g. 300000 for $300,000)
Annual interest rate as a percentage (e.g. 6.5 for 6.5%). Must be greater than 0.
Loan term in years (1β50)
Sending request...
Response Fields
| Field | Type | Description |
|---|---|---|
| principal | number |
The original loan amount passed in the request |
| rate | number |
The annual interest rate passed in the request |
| years | integer |
The loan term in years passed in the request |
| monthly_payment | number |
Fixed monthly payment amount (rounded to 2 decimal places) |
| total_payment | number |
Total amount paid over the life of the loan |
| total_interest | number |
Total interest paid (total_payment minus principal) |
| schedule | array |
Full amortization schedule β one entry per month (years Γ 12 entries) |
| schedule[].month | integer |
Month number (1 to years Γ 12) |
| schedule[].payment | number |
Total payment for this month |
| schedule[].principal | number |
Portion of this month's payment applied to principal |
| schedule[].interest | number |
Portion of this month's payment applied to interest |
| schedule[].balance | number |
Remaining loan balance after this payment |
Code Examples
curl "https://api.requiems.xyz/v1/finance/mortgage?principal=300000&rate=6.5&years=30" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://api.requiems.xyz/v1/finance/mortgage"
headers = {"requiems-api-key": "YOUR_API_KEY"}
params = {"principal": 300000, "rate": 6.5, "years": 30}
response = requests.get(url, headers=headers, params=params)
data = response.json()["data"]
print(data["monthly_payment"]) # 1896.2
print(data["total_interest"]) # 382632.0
print(len(data["schedule"])) # 360
const params = new URLSearchParams({ principal: 300000, rate: 6.5, years: 30 });
const response = await fetch(
`https://api.requiems.xyz/v1/finance/mortgage?${params}`,
{ headers: { 'requiems-api-key': 'YOUR_API_KEY' } }
);
const { data } = await response.json();
console.log(data.monthly_payment); // 1896.2
console.log(data.total_interest); // 382632.0
console.log(data.schedule.length); // 360
require 'net/http'
require 'json'
uri = URI('https://api.requiems.xyz/v1/finance/mortgage')
uri.query = URI.encode_www_form(principal: 300000, rate: 6.5, years: 30)
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)['data']
puts data['monthly_payment'] # 1896.2
puts data['total_interest'] # 382632.0
Error Responses
bad_request
A required parameter is missing, not a valid number, or out of range (e.g. years > 50 or rate <= 0).
internal_error
Unexpected server error.
Frequently Asked Questions
Standard fixed-rate amortization: M = P Γ (r(1+r)^n) / ((1+r)^n β 1), where P is the principal, r is the monthly rate (annual rate / 12 / 100), and n is the total number of payments (years Γ 12).
Yes β all monetary values in the response (monthly_payment, total_payment, total_interest, and each schedule entry) are rounded to 2 decimal places.
Due to floating-point rounding on each monthly payment, the final balance may show $0.00β$0.99 rather than exactly $0. This is expected behaviour for fixed-payment amortization schedules.
The API is currency-agnostic. Pass your principal in any unit and interpret the results in that same unit. There is no currency conversion.
Not currently. Only fixed-rate mortgages are supported. The rate is applied uniformly over the entire loan term.