NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server →

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.

Online
(4.2)

From 8,431 users

800+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
254ms272ms308ms542ms956ms

Didn't find what you were looking for? Suggest an improvement

https://api.api-ninjas.com/v1/mortgagecalculator

Returns monthly payment, annual payment, and interest rate information based on given mortgage parameters.

interest_rate and either loan_amount or both home_value and downpayment must be set.

Parameters

  • loan_amount  optional

    Principal loan amount.

  • home_value  optional

    Total value of the home or asset. Must be greater than downpayment.

  • downpayment  optional

    Downpayment on the home or asset. Cannot exceed home_value.

  • interest_rate  required

    Annual interest rate (in %). For example, a 3.5% interest rate would be 3.5. Cannot exceed 10000.

  • duration_years  optional

    Duration of the loan in years. Must be between 1 and 10000. If not set, the default value is 30 years.

  • monthly_hoa  optional

    Monthly homeowner association fees.

  • annual_property_tax  optional

    Annual property tax owed.

  • annual_home_insurance  optional

    Annual homeowner's insurance bill.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • monthly_payment

    Object with the fields total, mortgage, property_tax, hoa, and annual_home_ins representing the monthly amounts in each category.

  • annual_payment

    Object with the fields total, mortgage, property_tax, hoa, and home_insurance representing the annual amounts.

  • total_interest_paid

    Total interest paid over the full term of the loan.

Live Demo

Live demo · no API key required
Query parameters
loan_amount
interest_rate
duration_years
home_value
downpayment

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/mortgagecalculator?loan_amount=200000&interest_rate=3.5&duration_years=30
Sample response
{
"monthly_payment": {
"total": 898,
"mortgage": 898,
"property_tax": 0,
"hoa": 0,
"annual_home_ins": 0
},
"annual_payment": {
"total": 10777,
"mortgage": 10777,
"property_tax": 0,
"hoa": 0,
"home_insurance": 0
},
"total_interest_paid": 123312
}

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/mortgagecalculator?loan_amount=200000&interest_rate=3.5&duration_years=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

  • 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.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • You must always set interest_rate (the annual rate in %, e.g. 3.5), plus either loan_amount or the combination of home_value and downpayment; duration_years is optional and defaults to 30. To estimate payments with current rates, pair this with the Mortgage Rate API.
  • Yes. You can pass the optional annual_property_tax, monthly_hoa, and annual_home_insurance parameters, and the response breaks each out under monthly_payment and annual_payment so you see total housing costs rather than just principal and interest. See all API Ninjas APIs for related finance tools.
  • It returns a monthly_payment object and an annual_payment object (each with total, mortgage, property_tax, and hoa fields), plus total_interest_paid over the full loan term; on a failed request you get an error code instead.
  • It is ideal for real estate listings, home-affordability tools, and loan comparison widgets that need monthly/annual payments and total interest from inputs like loan_amount and interest_rate. Developers often combine it with the Income Tax Calculator API to model overall household budgets; review usage limits on our pricing page.