API Endpoint
Savings Goal
Calculate how long to reach a savings target given current savings, rate, and contribution.
Endpoint
Also supports GET with query parameters.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
target | number | — | Target savings amount ($) |
current | number | — | Current savings ($) |
annualRate | number | — | Annual return rate (%) |
years | number | — | Time period (years) |
Request Examples
POST (JSON body)
curl -X POST https://likeoptions.com/api/v1/calculate/savings \
-H "Content-Type: application/json" \
-d '{"target": 100000, "current": 50000, "annualRate": 6}'GET (query parameters)
curl "https://likeoptions.com/api/v1/calculate/savings?target=100000¤t=50000&annualRate=6"Response
{
"kind": "savings",
"result": {
"primary": 1234.56,
"secondary": [
{ "label": "Example metric", "value": 100, "format": "money" },
{ "label": "Example percent", "value": 5.5, "format": "percent" }
]
}
}When to Use
- Plan savings targets
- Calculate compound growth
- Estimate time to goal
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 →