# Depreciation Calculator API
> Asset-depreciation maths as an API, computed locally and deterministically, returning the full year-by-year schedule. The straight-line endpoint spreads the depreciable amount evenly, annual = (cost − salvage) / life, with the book value falling to the salvage value over the asset life. The declining-balance endpoint is accelerated — each year depreciates the current book value times factor/life (a factor of 2 is the double-declining method) — and it is capped so the book value never drops below salvage. The sum-of-years-digits endpoint is also accelerated, front-loading the expense: year t depreciates (remaining life / SYD) × (cost − salvage), where SYD = n(n+1)/2. Each method returns the depreciation, accumulated depreciation and book value for every year. Everything is computed locally and deterministically, so it is instant and private. Ideal for accounting, ERP, asset-management and bookkeeping app developers, fixed-asset registers, and finance dashboards. Pure local computation — no key, no third-party service, instant. Live, nothing stored. General accounting maths — tax rules such as MACRS differ by jurisdiction. 3 endpoints. This is asset depreciation; for NPV and IRR use a finance-calc API and for loans use a loan 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/depreciation-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($14/Mo) — 20,000 calls/Mo, 8 req/s
- **Pro** ($39/Mo) — 150,000 calls/Mo, 25 req/s
- **Mega** ($119/Mo) — 1,000,000 calls/Mo, 80 req/s

## Endpoints

### Depreciation

#### `GET /v1/declining-balance` — Declining-balance depreciation

**Parameters:**
- `cost` (query, required, string) — Asset cost Example: `10000`
- `salvage` (query, optional, string) — Salvage value (default 0) Example: `1000`
- `life` (query, required, string) — Useful life (years) Example: `5`
- `factor` (query, optional, string) — Factor (2 = double-declining, default 2) Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/depreciation-api/v1/declining-balance?cost=10000&salvage=1000&life=5&factor=2"
```

**Response:**
```json
{
    "data": {
        "note": "Declining-balance: each year depreciates book × (factor/life); factor 2 is double-declining. Capped so book value never drops below salvage.",
        "inputs": {
            "cost": 10000,
            "life": 5,
            "factor": 2,
            "salvage": 1000
        },
        "method": "declining-balance",
        "schedule": [
            {
                "year": 1,
                "book_value": 6000,
                "accumulated": 4000,
                "depreciation": 4000
            },
            {
                "year": 2,
                "book_value": 3600,
                "accumulated": 6400,
                "depreciation": 2400
            },
            {
                "year": 3,
                "book_value": 2160,
                "accumulated": 7840,
                "depreciation": 1440
            },
            {
                "year": 4,
                "book_value": 1296,
                "accumulated": 8704,
                "depreciation": 864
            },
            {
                "year": 5,
                "book_value": 1000,
                "accumulated": 9000,
                "depreciation": 296
            }
        ],
        "depreciation_rate": 0.4,
        "total_depreciation": 9000
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:16.197Z",
        "request_id": "cf1fcfaa-0c96-42fc-84bf-b43de8720352"
    },
    "status": "ok",
    "message": "Declining-balance",
    "success": true
}
```

#### `GET /v1/straight-line` — Straight-line depreciation

**Parameters:**
- `cost` (query, required, string) — Asset cost Example: `10000`
- `salvage` (query, optional, string) — Salvage value (default 0) Example: `1000`
- `life` (query, required, string) — Useful life (years) Example: `5`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/depreciation-api/v1/straight-line?cost=10000&salvage=1000&life=5"
```

**Response:**
```json
{
    "data": {
        "note": "Straight-line: equal annual depreciation = (cost − salvage) / life.",
        "inputs": {
            "cost": 10000,
            "life": 5,
            "salvage": 1000
        },
        "method": "straight-line",
        "schedule": [
            {
                "year": 1,
                "book_value": 8200,
                "accumulated": 1800,
                "depreciation": 1800
            },
            {
                "year": 2,
                "book_value": 6400,
                "accumulated": 3600,
                "depreciation": 1800
            },
            {
                "year": 3,
                "book_value": 4600,
                "accumulated": 5400,
                "depreciation": 1800
            },
            {
                "year": 4,
                "book_value": 2800,
                "accumulated": 7200,
                "depreciation": 1800
            },
            {
                "year": 5,
                "book_value": 1000,
                "accumulated": 9000,
                "depreciation": 1800
            }
        ],
        "total_depreciation": 9000,
        "annual_depreciation": 1800
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:16.288Z",
        "request_id": "bf9b00b2-7335-46f3-81bd-24e29cf4ed64"
    },
    "status": "ok",
    "message": "Straight-line",
    "success": true
}
```

#### `GET /v1/sum-of-years` — Sum-of-years-digits depreciation

**Parameters:**
- `cost` (query, required, string) — Asset cost Example: `10000`
- `salvage` (query, optional, string) — Salvage value (default 0) Example: `1000`
- `life` (query, required, string) — Useful life (years) Example: `5`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/depreciation-api/v1/sum-of-years?cost=10000&salvage=1000&life=5"
```

**Response:**
```json
{
    "data": {
        "note": "Sum-of-years-digits: year t depreciates (remaining_life / SYD) × (cost − salvage); SYD = n(n+1)/2. Accelerated, early-loaded.",
        "inputs": {
            "cost": 10000,
            "life": 5,
            "salvage": 1000
        },
        "method": "sum-of-years-digits",
        "schedule": [
            {
                "year": 1,
                "book_value": 7000,
                "accumulated": 3000,
                "depreciation": 3000
            },
            {
                "year": 2,
                "book_value": 4600,
                "accumulated": 5400,
                "depreciation": 2400
            },
            {
                "year": 3,
                "book_value": 2800,
                "accumulated": 7200,
                "depreciation": 1800
            },
            {
                "year": 4,
                "book_value": 1600,
                "accumulated": 8400,
                "depreciation": 1200
            },
            {
                "year": 5,
                "book_value": 1000,
                "accumulated": 9000,
                "depreciation": 600
            }
        ],
        "total_depreciation": 9000,
        "sum_of_years_digits": 15
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:16.424Z",
        "request_id": "f4c51e40-f873-4d6f-885e-3d85456e6505"
    },
    "status": "ok",
    "message": "Sum-of-years-digits",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Cost and salvage in any currency, life in whole years. Each endpoint returns the full depreciation schedule. Accounting estimate — tax rules (e.g. MACRS) differ by jurisdiction.",
        "service": "depreciation-api",
        "formulae": {
            "sum_of_years": "dep_t = (remaining_life / SYD) × (cost − salvage),  SYD = n(n+1)/2",
            "straight_line": "annual = (cost − salvage) / life",
            "declining_balance": "dep = book × (factor/life)"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/sum-of-years": "Sum-of-years-digits accelerated depreciation.",
            "GET /v1/straight-line": "Equal annual depreciation and year-by-year book value.",
            "GET /v1/declining-balance": "Accelerated declining-balance (double-declining by default), capped at salvage."
        },
        "description": "Asset-depreciation calculator with full schedules: straight-line, declining-balance and sum-of-years-digits."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:16.494Z",
        "request_id": "d5be9887-3a2f-4351-9444-8184f396db16"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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