Skip to main content
POST
/
calculate
Calculate a mortgage
curl --request POST \
  --url https://api.hapi.so/calculate \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "home_price": 123,
  "down_payment_amt": 123,
  "down_payment_type": "percent",
  "state": "<string>",
  "loan_term": 30,
  "interest_rate": 123,
  "yearly_insurance": 123,
  "yearly_property_tax": 123,
  "monthly_pmi": 123,
  "monthly_hoa": 123
}
'
{
  "total_monthly_payment": 123,
  "principal_and_interest": 123,
  "monthly_tax": 123,
  "monthly_insurance": 123,
  "monthly_pmi": 123,
  "monthly_hoa": 123,
  "interest_rate": 123,
  "home_price": 123,
  "down_payment_amount": 123,
  "down_payment_percent": 123,
  "loan_amount": 123,
  "monthly_income_needed": 123,
  "state": "<string>",
  "yearly_income_needed": 123
}

Authorizations

x-api-key
string
header
required

Body

application/json
home_price
number
required

The listing price of the home.

Example:

600000

down_payment_amt
number
required

The down payment amount. Use down_payment_type to specify the type of down payment, either percent or amount. If down_payment_type is set to percent, this field should be a percentage of the home price, e.g. 5.0. If down_payment_type is set to amount, this field should be the actual amount, e.g. 20000.

Examples:

5

20000

down_payment_type
enum<string>
required

The type of down payment - percent or amount.

Available options:
percent,
amount
Examples:

"percent"

"amount"

state
string
required

The state in which the home is located. Used to determine the average interest rate.

Required string length: 2
Examples:

"CA"

"NY"

loan_term
enum<integer>
default:30

The term length of the loan in years.

Available options:
15,
20,
30,
40
Examples:

15

20

30

40

interest_rate
number

The annual interest rate of the loan expressed as a percentage. Will return the current average rate of the given state if not provided.

Example:

6.375

yearly_insurance
number

The yearly cost of homeowner's insurance.

Example:

1200

yearly_property_tax
number

The yearly cost of property tax.

Example:

2500

monthly_pmi
number

The monthly cost of private mortgage insurance.

Example:

100

monthly_hoa
number

The monthly cost of homeowner's association fees.

Example:

50

Response

Successful Response

total_monthly_payment
number
required

The total monthly payment, including principal, interest, taxes, insurance, PMI, and HOA fees.

Example:

3500

principal_and_interest
number
required

The monthly payment for principal and interest only. Does not include taxes, insurance, PMI, or HOA fees.

Example:

2500

monthly_tax
number
required

The monthly cost of property tax.

Example:

200

monthly_insurance
number
required

The monthly cost of homeowner's insurance.

Example:

100

monthly_pmi
number
required

The monthly cost of private mortgage insurance. Not applied if the down payment is 20% or more.

Example:

100

monthly_hoa
number
required

The monthly cost of homeowner's association fees. This value will be the exact same as the input if provided.

Example:

50

interest_rate
number
required

The annual interest rate of the loan expressed as a percentage. This value will be the exact same as the input if provided.

Example:

6.375

home_price
number
required

The total price of the home. This value will be the exact same as the input if provided.

Example:

300000

down_payment_amount
number
required

The total dollar amount of the down payment.

Example:

60000

down_payment_percent
number
required

The percentage of the home price that is paid as a down payment expressed as a percentage.

Example:

5

loan_amount
number
required

The total amount of the loan.

Example:

240000

monthly_income_needed
number
required

The monthly income needed to afford the home. This is based on a debt-to-income ratio of 45%.

Example:

8750

state
string
required

The state in which the home is located. Used to determine the average interest rate.

Required string length: 2
Examples:

"CA"

"NY"

yearly_income_needed
number
required

The yearly income needed to afford the home. This is based on a debt-to-income ratio of 45%.

Example:

105000