# Inventory Management API
> Inventory-management maths as an API, computed locally and deterministically. The eoq endpoint computes the economic order quantity, EOQ = √(2·D·S/H) from the annual demand, the cost per order and the holding cost per unit per year — the order size that minimises total cost — and returns the number of orders per year, the days between orders and the annual ordering, holding and total costs (which are equal at the EOQ). The reorder endpoint computes the reorder point, daily demand × lead time + safety stock, the stock level at which to place the next order. The safety endpoint computes the safety stock for a target service level, Z × σ × √lead_time, where Z is the normal-distribution value for the service level (95 % gives 1.645) found by an exact inverse-normal calculation, so any service level works. Everything is computed locally and deterministically, so it is instant and private. Ideal for e-commerce, retail, warehouse and supply-chain app developers, stock-planning and procurement tools, and operations dashboards. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is inventory optimisation; for break-even and cost-volume-profit use a break-even 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/inventory-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($15/Mo) — 40,000 calls/Mo, 6 req/s
- **Pro** ($39/Mo) — 250,000 calls/Mo, 20 req/s
- **Mega** ($119/Mo) — 1,526,000 calls/Mo, 60 req/s

## Endpoints

### Inventory

#### `GET /v1/eoq` — Economic order quantity

**Parameters:**
- `annual_demand` (query, required, string) — Annual demand (units) Example: `10000`
- `ordering_cost` (query, required, string) — Cost per order Example: `50`
- `holding_cost` (query, required, string) — Holding cost per unit per year Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/inventory-api/v1/eoq?annual_demand=10000&ordering_cost=50&holding_cost=2"
```

**Response:**
```json
{
    "data": {
        "note": "EOQ = √(2·D·S/H). At the EOQ the annual ordering and holding costs are equal.",
        "inputs": {
            "holding_cost": 2,
            "annual_demand": 10000,
            "ordering_cost": 50
        },
        "orders_per_year": 14.1421,
        "total_annual_cost": 1414.2136,
        "annual_holding_cost": 707.1068,
        "days_between_orders": 25.8094,
        "annual_ordering_cost": 707.1068,
        "economic_order_quantity": 707.1068
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:18.446Z",
        "request_id": "de332b92-30ad-4831-9954-189cc8cf8f52"
    },
    "status": "ok",
    "message": "Economic order quantity",
    "success": true
}
```

#### `GET /v1/reorder` — Reorder point

**Parameters:**
- `daily_demand` (query, required, string) — Daily demand (units) Example: `40`
- `lead_time_days` (query, required, string) — Lead time (days) Example: `7`
- `safety_stock` (query, optional, string) — Safety stock (units, default 0) Example: `50`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/inventory-api/v1/reorder?daily_demand=40&lead_time_days=7&safety_stock=50"
```

**Response:**
```json
{
    "data": {
        "note": "Reorder point = daily demand × lead time + safety stock. Place a new order when stock hits this level.",
        "inputs": {
            "daily_demand": 40,
            "safety_stock": 50,
            "lead_time_days": 7
        },
        "reorder_point": 330,
        "demand_during_lead_time": 280
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:18.546Z",
        "request_id": "2b821186-fee0-4188-989d-7da3a873a43a"
    },
    "status": "ok",
    "message": "Reorder point",
    "success": true
}
```

#### `GET /v1/safety` — Safety stock

**Parameters:**
- `service_level` (query, required, string) — Service level (%) Example: `95`
- `demand_std_dev` (query, required, string) — Demand std dev per day Example: `10`
- `lead_time_days` (query, required, string) — Lead time (days) Example: `7`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/inventory-api/v1/safety?service_level=95&demand_std_dev=10&lead_time_days=7"
```

**Response:**
```json
{
    "data": {
        "note": "Safety stock = Z × σ × √lead_time. Z is the normal-distribution value for the target service level (95 % → 1.645).",
        "inputs": {
            "service_level": 95,
            "demand_std_dev": 10,
            "lead_time_days": 7
        },
        "z_score": 1.6449,
        "safety_stock": 43.5187
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:18.643Z",
        "request_id": "04526d05-b77d-48e7-b502-84d92580ac6b"
    },
    "status": "ok",
    "message": "Safety stock",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Demand in units, costs per order / per unit-year, lead time in days. Service level as a percentage (e.g. 95). Single-item model with normal demand.",
        "service": "inventory-api",
        "formulae": {
            "eoq": "EOQ = √(2·D·S/H)",
            "safety": "SS = Z × σ × √lead_time",
            "reorder": "ROP = daily_demand × lead_time + safety_stock"
        },
        "endpoints": {
            "GET /v1/eoq": "Economic order quantity √(2DS/H), order frequency and the annual cost breakdown.",
            "GET /v1/meta": "This document.",
            "GET /v1/safety": "Safety stock = Z(service level) × σ × √lead_time.",
            "GET /v1/reorder": "Reorder point = daily demand × lead time + safety stock."
        },
        "description": "Inventory-management calculator: economic order quantity (EOQ), reorder point and safety stock."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:18.749Z",
        "request_id": "ce488d5c-ba09-4ea0-9590-eff1602353ae"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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