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.
Vue d'ensemble
Cas d'utilisation
- Mortgage calculators for real estate platforms
- Loan comparison tools
- Personal finance dashboards
- Amortization schedule exports for borrowers
- Financial planning and budgeting apps
Fonctionnalités
Points de terminaison de l'API
Calculate Mortgage
Returns the monthly payment, total cost, and full amortization schedule for a fixed-rate mortgage.
https://requiems.xyz/v1/finance/mortgage
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
| principal | number |
Requis | Loan amount in your chosen currency (e.g. 300000 for $300,000) |
| rate | number |
Requis | Annual interest rate as a percentage (e.g. 6.5 for 6.5%). Must be greater than 0. |
| years | integer |
Requis | Loan term in years (1–50) |
Essayez-le
Démo en directRequête
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)
Champs de réponse
| Champ | 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<object> |
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 |
Exemples de code
curl "https://requiems.xyz/v1/finance/mortgage?principal=300000&rate=6.5&years=30" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://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://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://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
Réponses d'erreur
A required parameter is missing, not a valid number, or out of range (e.g. years > 50 or rate <= 0).
Unexpected server error.
Batch Calculate Mortgages
Calculate up to 50 mortgages in a single request. Results are returned in the same order as the input.
https://requiems.xyz/v1/finance/mortgage/batch
Paramètres
| Nom | Type | Requis | Description |
|---|---|---|---|
| mortgages | array<object> |
Requis | Array of mortgages to calculate (min: 1, max: 50). |
Essayez-le
Démo en directRequête
Array of mortgages to calculate (min: 1, max: 50).
Champs de réponse
| Champ | Type | Description |
|---|---|---|
| results | array<object> |
Mortgage calculation result for each mortgage request in the same order as the input. Each item has the same fields as the single mortgage endpoint. |
| total | integer |
Number of results returned. Matches the length of the input array. |
Exemples de code
curl -X POST "https://requiems.xyz/v1/finance/mortgage/batch" \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mortgages":[{"principal": 150000,"rate": 6.5,"years": 10},{"principal": 250000,"rate": 5.2,"years": 30}]}'
import requests
url = "https://requiems.xyz/v1/finance/mortgage/batch"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {"mortgages":[{"principal": 150000,"rate": 6.5,"years": 10},{"principal": 250000,"rate": 5.2,"years": 30}]}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch(
'https://requiems.xyz/v1/finance/mortgage/batch',
{
method: 'POST',
headers: {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ mortgages: [{"principal": 150000,"rate": 6.5,"years": 10},{"principal": 250000,"rate": 5.2,"years": 30}] })
}
);
const { data } = await response.json();
console.log(data);
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/finance/mortgage/batch')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = { mortgages: [{"principal": 150000,"rate": 6.5,"years": 10},{"principal": 250000,"rate": 5.2,"years": 30}] }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts JSON.pretty_generate(JSON.parse(response.body))
Réponses d'erreur
The mortgages array is missing, empty, or contains more than 50 items.