API Endpoint
Rent vs Buy
Compare total costs of renting versus buying over a specified time horizon.
Endpoint
Also supports GET with query parameters.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
monthlyRent | number | — | Monthly rent ($) |
homePrice | number | — | Home purchase price ($) |
downPayment | number | — | Down payment amount ($) |
annualRate | number | — | Annual mortgage rate (%) |
years | number | — | Time horizon (years) |
Request Examples
POST (JSON body)
curl -X POST https://likeoptions.com/api/v1/calculate/rentbuy \
-H "Content-Type: application/json" \
-d '{"monthlyRent": 100000, "homePrice": 50000, "downPayment": 6}'GET (query parameters)
curl "https://likeoptions.com/api/v1/calculate/rentbuy?monthlyRent=100000&homePrice=50000&downPayment=6"Response
{
"kind": "rentbuy",
"result": {
"primary": 1234.56,
"secondary": [
{ "label": "Example metric", "value": 100, "format": "money" },
{ "label": "Example percent", "value": 5.5, "format": "percent" }
]
}
}When to Use
- Compare rent vs buy decision
- Analyze housing cost scenarios
- Plan housing strategy
Error Handling
- 400 Bad Request — Invalid input parameters or missing required fields
- 404 Not Found — Unknown calculator kind
- 429 Too Many Requests — Rate limit exceeded (120 req/hour per IP)
- 413 Payload Too Large — Request body exceeds 16 KB
Related Endpoints
View request examples in JavaScript, Python, cURL, and more →
Mortgages and home financing
- Mortgage payment calculatorCalculator
- Mortgage affordability calculatorCalculator
- Amortization schedule calculatorCalculator
- Refinancing calculatorCalculator
- Home equity and HELOC calculatorCalculator