# Inflation Calculator API
> Inflation-economics maths as an API, computed locally and deterministically. The adjust endpoint expresses a value across time in two ways — by an annual inflation rate over a number of years, V = amount·(1+r)^years, or by a ratio of consumer-price-index figures, V = amount·CPI_end/CPI_start — so an old price can be restated in today's money, with the total inflation over the period. The real-rate endpoint computes the real (inflation-adjusted) interest or investment rate from a nominal rate and an inflation rate using the Fisher equation, 1 + real = (1 + nominal)/(1 + inflation), alongside the rough nominal-minus-inflation approximation. The purchasing-power endpoint shows how inflation erodes money over time — the future buying power of today's amount, amount/(1+r)^years, the value lost and the larger amount needed to maintain the same purchasing power. Rates may be entered as a percent or a fraction and amounts in any currency. Everything is computed locally and deterministically, so it is instant and private. Ideal for personal-finance, budgeting, salary, retirement-planning and economics app developers, cost-of-living and real-return tools, and finance education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is inflation adjustment; for loan repayments use a loan API and for investment growth an investment 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/inflation-api/..."
```

## Pricing
- **Free** (Free) — 2,800 calls/Mo, 2 req/s
- **Starter** ($13/Mo) — 35,000 calls/Mo, 6 req/s
- **Pro** ($34/Mo) — 215,000 calls/Mo, 15 req/s
- **Mega** ($99/Mo) — 1,400,000 calls/Mo, 40 req/s

## Endpoints

### Inflation

#### `GET /v1/adjust` — Inflation adjust

**Parameters:**
- `amount` (query, required, string) — Amount Example: `100`
- `rate` (query, optional, string) — Annual inflation rate (% or fraction) Example: `3`
- `years` (query, optional, string) — Number of years Example: `10`
- `cpi_start` (query, optional, string) — CPI at start
- `cpi_end` (query, optional, string) — CPI at end

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/inflation-api/v1/adjust?amount=100&rate=3&years=10"
```

**Response:**
```json
{
    "data": {
        "note": "Annual-rate method: adjusted = amount · (1+r)^years. The rate may be a percent (3) or a fraction (0.03).",
        "inputs": {
            "rate": 3,
            "years": 10,
            "amount": 100
        },
        "method": "annual-rate",
        "adjusted_amount": 134.3916,
        "inflation_factor": 1.34391638,
        "total_inflation_pct": 34.391638
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:32.383Z",
        "request_id": "d49ccc26-e12f-4518-9813-04ce2957c52c"
    },
    "status": "ok",
    "message": "Inflation adjust",
    "success": true
}
```

#### `GET /v1/purchasing-power` — Purchasing power

**Parameters:**
- `amount` (query, required, string) — Amount Example: `100`
- `rate` (query, required, string) — Inflation rate (% or fraction) Example: `3`
- `years` (query, required, string) — Number of years Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/inflation-api/v1/purchasing-power?amount=100&rate=3&years=10"
```

**Response:**
```json
{
    "data": {
        "note": "After 'years' of inflation, today's amount buys future_purchasing_power = amount/(1+r)^years; amount_to_maintain_power = amount·(1+r)^years keeps the same buying power.",
        "inputs": {
            "rate": 3,
            "years": 10,
            "amount": 100
        },
        "value_lost": 25.5906,
        "erosion_pct": 25.590609,
        "future_purchasing_power": 74.4094,
        "amount_to_maintain_power": 134.3916
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:32.470Z",
        "request_id": "f45b8664-6007-47ef-bf35-19377ae34b79"
    },
    "status": "ok",
    "message": "Purchasing power",
    "success": true
}
```

#### `GET /v1/real-rate` — Fisher real rate

**Parameters:**
- `nominal_rate` (query, required, string) — Nominal rate (% or fraction) Example: `7`
- `inflation_rate` (query, required, string) — Inflation rate (% or fraction) Example: `3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/inflation-api/v1/real-rate?nominal_rate=7&inflation_rate=3"
```

**Response:**
```json
{
    "data": {
        "note": "Fisher equation: 1 + real = (1 + nominal)/(1 + inflation). The approximate form (nominal − inflation) is only accurate at low rates.",
        "inputs": {
            "nominal_rate": 7,
            "inflation_rate": 3
        },
        "real_rate": 0.03883495,
        "real_rate_pct": 3.883495,
        "approximate_real_rate_pct": 4
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:32.575Z",
        "request_id": "2cafd0ce-4f2e-43e2-9149-2757b764bda7"
    },
    "status": "ok",
    "message": "Fisher real rate",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Rates may be a percent (3) or a fraction (0.03). Amounts are in any currency. CPI values are index numbers.",
        "service": "inflation-api",
        "formulae": {
            "fisher": "1 + real = (1 + nominal)/(1 + inflation)",
            "adjust_cpi": "V = amount · CPI_end / CPI_start",
            "adjust_rate": "V = amount · (1+r)^years",
            "purchasing_power": "P = amount / (1+r)^years"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/adjust": "Adjust an amount for inflation by an annual rate over n years, or by CPI start/end.",
            "GET /v1/real-rate": "Real (inflation-adjusted) interest rate from nominal rate and inflation (Fisher).",
            "GET /v1/purchasing-power": "Future purchasing power and the amount needed to keep buying power."
        },
        "description": "Inflation calculator: adjust a value across years by an annual rate or a CPI ratio, the Fisher real interest rate, and the erosion of purchasing power over time."
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:32.688Z",
        "request_id": "580ccbfb-0565-4df0-8a51-12e8cf899d62"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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