Mortgage Calculator API
The Mortgage Calculator API provides detailed mortgage and other home financing payment information. It uses the standard mortgage calculation formulas to calculate interest and monthly/annual payments.
To get the latest and historical mortgage rate data, check out our Mortgage Rate API.
From 8,431 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 254ms | 272ms | 308ms | 542ms | 956ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/mortgagecalculator GET
https://api.api-ninjas.com/v1/mortgagecalculator
Returns monthly payment, annual payment, and interest rate information based on given mortgage parameters.
Parameters
loan_amountoptionalPrincipal loan amount.
home_valueoptionalTotal value of the home or asset. Must be greater than
downpayment.downpaymentoptionalDownpayment on the home or asset. Cannot exceed
home_value.interest_raterequiredAnnual interest rate (in %). For example, a 3.5% interest rate would be
3.5. Cannot exceed10000.duration_yearsoptionalDuration of the loan in years. Must be between
1and10000. If not set, the default value is30years.monthly_hoaoptionalMonthly homeowner association fees.
annual_property_taxoptionalAnnual property tax owed.
annual_home_insuranceoptionalAnnual homeowner's insurance bill.
interest_rate and either loan_amount or (home_value + downpayment) must be set.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
monthly_paymentObject with the fields
total,mortgage,property_tax,hoa, andannual_home_insrepresenting the monthly amounts in each category.annual_paymentObject with the fields
total,mortgage,property_tax,hoa, andhome_insurancerepresenting the annual amounts.total_interest_paidTotal interest paid over the full term of the loan.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/mortgagecalculator?loan_amount=200000&interest_rate=3.5&duration_years=30Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/mortgagecalculator?loan_amount=200000&interest_rate=3.5&loan_term=30" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Mortgage Calculator API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Mortgage Calculator API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Mortgage Calculator API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Mortgage Calculator API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What parameters are required to calculate a mortgage payment?
You must always setinterest_rate(the annual rate in %, e.g.3.5), plus eitherloan_amountor the combination ofhome_valueanddownpayment;duration_yearsis optional and defaults to30. To estimate payments with current rates, pair this with the Mortgage Rate API.Can I include property tax, HOA fees, and home insurance in the calculation?
Yes. You can pass the optionalannual_property_tax,monthly_hoa, andannual_home_insuranceparameters, and the response breaks each out undermonthly_paymentandannual_paymentso you see total housing costs rather than just principal and interest. See all API Ninjas APIs for related finance tools.What does the Mortgage Calculator API response include?
It returns amonthly_paymentobject and anannual_paymentobject (each withtotal,mortgage,property_tax, andhoafields), plustotal_interest_paidover the full loan term; on a failed request you get an error code instead.What are some use cases for the Mortgage Calculator API?
It is ideal for real estate listings, home-affordability tools, and loan comparison widgets that need monthly/annual payments and total interest from inputs likeloan_amountandinterest_rate. Developers often combine it with the Income Tax Calculator API to model overall household budgets; review usage limits on our pricing page.