The Mortgage Rate API provides access to current and historical mortgage rate data going back decades.
https://api.api-ninjas.com/v1/mortgagerate
Returns mortgage interest rate data for fixed-rate mortgage (FRM), ARM and more. If no parameters are set, the mortgage rate data for the most recent week is returned.
date
optional Premium OnlyIndividual date to query in YYYY-MM-DD
format.
min_date
optional Premium OnlyMinimum date range to query in YYYY-MM-DD
format. Must be used with max_date
.
max_date
optional Premium OnlyMaximum date range to query in YYYY-MM-DD
format. Must be used with min_date
.
X-Api-Key
requiredAPI Key associated with your account.
https://api.api-ninjas.com/v1/mortgagerate
1
2
3
4
5
6
7
[
{
"week": "2024-10-17",
"frm_30": 6.44,
"frm_15": 5.63
}
]
1
2
3
4
5
6
7
import requests
api_url = 'https://api.api-ninjas.com/v1/mortgagerate'
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)
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.