Calculator APIs

Integrate our powerful mortgage and rental comparison calculations into your applications

Free to Use
Secure & Reliable

API Overview

Note for Large Language Models (LLMs) and AI Agents: This API is designed for programmatic use. You can construct GET requests with the parameters detailed below to receive structured JSON responses for financial calculations. This is the preferred method for accessing our tools for integration into your applications or workflows.

Our Calculator APIs provide access to the same powerful financial calculations that power our web applications. Built with TypeScript and validated using Zod schemas, these APIs offer reliable and accurate mortgage and rental comparison calculations.

Mortgage Calculator API

Calculate monthly payments, amortization schedules, and savings from extra payments

Rent vs Buy API

Compare long-term financial outcomes of renting versus buying with detailed analysis

Mortgage Calculator API

Endpoint

GET /api/mortgage/calculate

Request Parameters

Required Parameters

homePrice Home price (number, > 0)
downPayment Down payment (number, ≥ 0)
downPaymentPercent Down payment percentage (optional, 0-100)
interestRate Annual interest rate (number, 0-100)
loanTerm Loan term in years (number, 1-50)

Optional Parameters

propertyTax Annual property tax
homeInsurance Annual home insurance
hoaFees Monthly HOA fees
extraMonthly Extra monthly payment
extraYearly Extra yearly payment
oneTimeExtra One-time extra payment

Example Requests

GET Request (Recommended)

https://ownorent.com/api/mortgage/calculate?homePrice=400000&downPayment=80000&interestRate=6.5&loanTerm=30&propertyTax=5000&homeInsurance=1200&hoaFees=150&extraMonthly=200&extraYearly=2000&oneTimeExtra=5000

Response Format

Success Response

monthlyPayment Base monthly payment
loanAmount Loan amount
totalInterest Total interest
estimatedTotalPayment Total monthly payment including all costs
yearlyAmortization Yearly amortization schedule
extraPaymentSavings Extra payment savings (if applicable)

Rent vs Buy Calculator API

Endpoint

GET /api/own-or-rent/calculate

Request Parameters

Required Parameters

homePrice Home price (number, > 0)
downPayment Down payment (number, ≥ 0)
interestRate Annual interest rate (number, 0-100)
loanTerm Loan term in years (number, 1-50)
monthlyRent Monthly rent (number, > 0)

Optional Parameters

Buying Costs
downPaymentPercent Down payment percentage (0-100)
propertyTax Annual property tax
homeInsurance Annual home insurance
hoaFees Monthly HOA fees
propertyType Property type (condo|house|general)
Renting & Assumptions
tenantInsurance Annual tenant insurance
annualRentIncrease Annual rent increase rate (%)
homeAppreciation Home appreciation rate (%)
investmentReturn Investment return rate (%)
sellingCostRate Selling cost rate (%)

Example Request

https://ownorent.com/api/own-or-rent/calculate?homePrice=400000&downPayment=80000&interestRate=6.5&loanTerm=30&propertyTax=5000&homeInsurance=1200&monthlyRent=2000&tenantInsurance=200&homeAppreciation=3&investmentReturn=7&sellingCostRate=6

Response Format

Success Response

summary.winner Winner ("buying" | "renting")
summary.wealthDifference Wealth difference
breakEven.monthlyCostYear Break-even year (monthly cost)
breakEven.netWorthYear Break-even year (net worth)
yearlyResults[] Array of yearly detailed results

Error Handling

HTTP Status Codes

200 Success
400 Request parameters error
500 Internal server error

Error Response Format

{
  "success": false,
  "error": "Error message",
  "details": [] // Zod validation error details (validation failures only)
}

Usage Examples

JavaScript/TypeScript

const response = await fetch('https://ownorent.com/api/mortgage/calculate?homePrice=400000&downPayment=80000&interestRate=6.5&loanTerm=30');
const result = await response.json();

if (result.success) {
  console.log('Monthly payment:', result.data.monthlyPayment);
  console.log('Total interest:', result.data.totalInterest);
}

Python

import requests

def calculate_mortgage():
    url = "https://ownorent.com/api/mortgage/calculate"
    params = {
        "homePrice": 400000,
        "downPayment": 80000,
        "interestRate": 6.5,
        "loanTerm": 30
    }

    response = requests.get(url, params=params)
    result = response.json()

    if result["success"]:
        print(f"Monthly payment: {result['data']['monthlyPayment']}")
        print(f"Total interest: {result['data']['totalInterest']}")

Ready to Try Our Calculators?

Experience our calculators firsthand before integrating the APIs into your applications.