# Savings Goal API
> Personal-savings planning maths as an API, computed locally and deterministically. The future endpoint computes the future value of regular saving — FV = initial·(1+r)^n + deposit·((1+r)^n − 1)/r with the rate compounded monthly — and breaks it into the total you put in and the interest earned. The goal endpoint works backwards: the monthly deposit needed to reach a target by a date, (target − initial·(1+r)^n)·r / ((1+r)^n − 1), and tells you when an initial sum already grows to the target by itself. The emergency endpoint sizes an emergency fund as a number of months of expenses (3–6 is the usual advice), reports the shortfall against current savings and, with a monthly saving amount, how many months it takes to get there. Everything is computed locally and deterministically, so it is instant and private. Ideal for personal-finance, budgeting and fintech app developers, savings-goal and money-coaching tools, and banking dashboards. Pure local computation — no key, no third-party service, instant. Live, nothing stored. Estimates, not financial advice. 3 endpoints. This is savings planning; for loans and mortgages use a loan API and for NPV/IRR use a finance-calc API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/savings-api/..."
```

## Pricing
- **Free** (Free) — 3,000 calls/Mo, 2 req/s
- **Starter** ($13/Mo) — 40,000 calls/Mo, 6 req/s
- **Pro** ($34/Mo) — 250,000 calls/Mo, 20 req/s
- **Mega** ($109/Mo) — 2,000,000 calls/Mo, 60 req/s

## Endpoints

### Savings

#### `GET /v1/emergency` — Emergency fund

**Parameters:**
- `monthly_expenses` (query, required, string) — Monthly expenses Example: `2000`
- `months` (query, optional, string) — Months of cover (default 6) Example: `6`
- `current_savings` (query, optional, string) — Current savings (default 0) Example: `3000`
- `monthly_saving` (query, optional, string) — Monthly saving for time-to-reach Example: `500`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/savings-api/v1/emergency?monthly_expenses=2000&months=6&current_savings=3000&monthly_saving=500"
```

**Response:**
```json
{
    "data": {
        "note": "Target = months of expenses; most advice is 3–6 months. Months to reach = ceil(shortfall / monthly saving).",
        "inputs": {
            "months": 6,
            "current_savings": 3000,
            "monthly_expenses": 2000
        },
        "shortfall": 9000,
        "target_fund": 12000,
        "funded_percent": 25,
        "months_to_reach": 18
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:15.728Z",
        "request_id": "9df43df9-54a8-41b4-be00-df9c406fc5ae"
    },
    "status": "ok",
    "message": "Emergency fund",
    "success": true
}
```

#### `GET /v1/future` — Future value of savings

**Parameters:**
- `monthly_deposit` (query, optional, string) — Monthly deposit (default 0) Example: `200`
- `initial` (query, optional, string) — Initial amount (default 0) Example: `1000`
- `annual_rate` (query, optional, string) — Annual interest rate (%, default 0) Example: `5`
- `years` (query, required, string) — Years Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/savings-api/v1/future?monthly_deposit=200&initial=1000&annual_rate=5&years=10"
```

**Response:**
```json
{
    "data": {
        "note": "FV = initial·(1+r)^n + deposit·((1+r)^n − 1)/r, with r the monthly rate and n the number of months.",
        "inputs": {
            "years": 10,
            "initial": 1000,
            "annual_rate": 5,
            "monthly_deposit": 200
        },
        "months": 120,
        "future_value": 32703.47,
        "interest_earned": 7703.47,
        "total_contributions": 25000
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:15.846Z",
        "request_id": "4d233409-e267-4c78-afd6-ba607e96de34"
    },
    "status": "ok",
    "message": "Future value",
    "success": true
}
```

#### `GET /v1/goal` — Deposit to reach a goal

**Parameters:**
- `target` (query, required, string) — Savings target Example: `50000`
- `initial` (query, optional, string) — Initial amount (default 0) Example: `1000`
- `annual_rate` (query, optional, string) — Annual interest rate (%, default 0) Example: `5`
- `years` (query, required, string) — Years to reach it Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/savings-api/v1/goal?target=50000&initial=1000&annual_rate=5&years=10"
```

**Response:**
```json
{
    "data": {
        "note": "Required deposit = (target − initial·(1+r)^n)·r / ((1+r)^n − 1).",
        "inputs": {
            "years": 10,
            "target": 50000,
            "initial": 1000,
            "annual_rate": 5
        },
        "monthly_deposit": 311.39,
        "projected_interest": 11633.48,
        "total_contributions": 38366.52
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:15.960Z",
        "request_id": "70a335d3-9530-473e-96ff-8795c8af1a64"
    },
    "status": "ok",
    "message": "Goal deposit",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/savings-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "notes": "Money in any currency, annual_rate as a percentage, compounded monthly. Deposits assumed at period end (ordinary annuity). Estimates — not financial advice.",
        "service": "savings-api",
        "formulae": {
            "goal": "PMT = (target − P·(1+r)^n)·r / ((1+r)^n − 1)",
            "emergency": "target = months × monthly_expenses",
            "future_value": "FV = P·(1+r)^n + PMT·((1+r)^n − 1)/r"
        },
        "endpoints": {
            "GET /v1/goal": "Monthly deposit needed to reach a savings target by a date.",
            "GET /v1/meta": "This document.",
            "GET /v1/future": "Future value of an initial sum plus monthly deposits at an interest rate.",
            "GET /v1/emergency": "Emergency-fund target and the time to reach it."
        },
        "description": "Personal-savings goal calculator: future value of regular savings, the monthly deposit to reach a target, and emergency-fund planning."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:16.066Z",
        "request_id": "1b66ba42-8d43-4fd9-bf0e-0e5bcb4acb73"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/savings-api
OpenAPI spec: https://www.oanor.com/api/savings-api/openapi.json
