Reference example
# Fixed reference example. Playground inputs do not update this sample.
curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"interest_rate": 3.5
}'curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"interest_rate": 3.5
}
'import requests
url = "https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage"
payload = { "interest_rate": 3.5 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({interest_rate: 3.5})
};
fetch('https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'interest_rate' => 3.5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage"
payload := strings.NewReader("{\n \"interest_rate\": 3.5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"interest_rate\": 3.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"interest_rate\": 3.5\n}"
response = http.request(request)
puts response.read_body{
"annual_payment": {
"hoa": 123,
"home_insurance": 123,
"mortgage": 123,
"property_tax": 123,
"total": 123
},
"monthly_payment": {
"annual_home_ins": 123,
"hoa": 123,
"mortgage": 123,
"property_tax": 123,
"total": 123
},
"total_interest_paid": 123
}API Ninjas
Calculate Mortgage
Calculate Mortgage
POST
https://api.aisa.one
/
apis
/
v1
/
api-ninjas
/
calculate-mortgage
Reference example
# Fixed reference example. Playground inputs do not update this sample.
curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"interest_rate": 3.5
}'curl --request POST \
--url https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"interest_rate": 3.5
}
'import requests
url = "https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage"
payload = { "interest_rate": 3.5 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({interest_rate: 3.5})
};
fetch('https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'interest_rate' => 3.5
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage"
payload := strings.NewReader("{\n \"interest_rate\": 3.5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"interest_rate\": 3.5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"interest_rate\": 3.5\n}"
response = http.request(request)
puts response.read_body{
"annual_payment": {
"hoa": 123,
"home_insurance": 123,
"mortgage": 123,
"property_tax": 123,
"total": 123
},
"monthly_payment": {
"annual_home_ins": 123,
"hoa": 123,
"mortgage": 123,
"property_tax": 123,
"total": 123
},
"total_interest_paid": 123
}Request contract
- Method and path: POST /apis/v1/api-ninjas/calculate-mortgage
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/api-ninjas/calculate-mortgage
{
"operationId": "api-ninjas.calculate-mortgage",
"method": "POST",
"path": "/apis/v1/api-ninjas/calculate-mortgage",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"annual_home_insurance": {
"description": "Annual homeowner's insurance bill",
"examples": [
1200
],
"minimum": 0,
"type": "number"
},
"annual_property_tax": {
"description": "Annual property tax owed",
"examples": [
3000
],
"minimum": 0,
"type": "number"
},
"downpayment": {
"description": "Downpayment on the home or asset. Cannot exceed home_value.",
"examples": [
50000
],
"minimum": 0,
"type": "number"
},
"duration_years": {
"description": "Loan duration in years (1-10000). Defaults to 30.",
"examples": [
30
],
"maximum": 10000,
"minimum": 1,
"type": "integer"
},
"home_value": {
"description": "Total value of the home or asset. Must be greater than downpayment.",
"examples": [
250000
],
"minimum": 0,
"type": "number"
},
"interest_rate": {
"description": "Annual interest rate (in %). For example, a 3.5% interest rate would be 3.5",
"examples": [
3.5
],
"minimum": 0,
"type": "number"
},
"loan_amount": {
"description": "Principal loan amount. Either this OR (home_value + downpayment) must be provided.",
"examples": [
200000
],
"minimum": 0,
"type": "number"
},
"monthly_hoa": {
"description": "Monthly homeowner association fees",
"examples": [
100
],
"minimum": 0,
"type": "number"
}
},
"required": [
"interest_rate"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
Usage-based pricing. Default request estimate: $0.00089 USD. The final charge depends on actual usage. Your account price may differ; use a request quote where supported.Authorizations
Body
application/json