# Break-Even Calculator API
> Break-even and cost-volume-profit maths as an API, computed locally and deterministically. The breakeven endpoint computes the break-even point of a product — the units you must sell to cover all costs, fixed costs ÷ (price − variable cost) — together with the break-even revenue, the contribution margin per unit and the contribution-margin ratio. The target endpoint computes the units and revenue needed to reach a target profit, (fixed costs + target profit) ÷ contribution margin. The margin-of-safety endpoint takes an actual sales level (in units or revenue) and returns the margin of safety — how far sales can fall before a loss — both in units and as a percentage, plus the profit at that level. Everything is computed locally and deterministically, so it is instant and private. Ideal for business, startup and finance app developers, pricing and product-planning tools, and small-business and accounting dashboards. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is cost-volume-profit analysis; for per-unit margin and markup pricing use a margin 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/breakeven-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($14/Mo) — 30,000 calls/Mo, 6 req/s
- **Pro** ($39/Mo) — 200,000 calls/Mo, 20 req/s
- **Mega** ($119/Mo) — 1,500,000 calls/Mo, 60 req/s

## Endpoints

### Break-Even

#### `GET /v1/breakeven` — Break-even point

**Parameters:**
- `fixed_costs` (query, required, string) — Fixed costs Example: `10000`
- `price` (query, required, string) — Selling price per unit Example: `50`
- `variable_cost` (query, required, string) — Variable cost per unit Example: `30`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/breakeven-api/v1/breakeven?fixed_costs=10000&price=50&variable_cost=30"
```

**Response:**
```json
{
    "data": {
        "note": "Break-even units = fixed / (price − variable). Each unit past break-even adds one contribution margin of profit.",
        "inputs": {
            "price": 50,
            "fixed_costs": 10000,
            "variable_cost": 30
        },
        "break_even_units": 500,
        "break_even_revenue": 25000,
        "contribution_margin": 20,
        "contribution_margin_ratio": 0.4
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:18.901Z",
        "request_id": "f6202834-1067-48cb-9ecf-8457fc095999"
    },
    "status": "ok",
    "message": "Break-even point",
    "success": true
}
```

#### `GET /v1/margin-of-safety` — Margin of safety

**Parameters:**
- `fixed_costs` (query, required, string) — Fixed costs Example: `10000`
- `price` (query, required, string) — Selling price per unit Example: `50`
- `variable_cost` (query, required, string) — Variable cost per unit Example: `30`
- `actual_units` (query, optional, string) — Actual units sold Example: `800`
- `actual_sales` (query, optional, string) — Or actual revenue

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/breakeven-api/v1/margin-of-safety?fixed_costs=10000&price=50&variable_cost=30&actual_units=800"
```

**Response:**
```json
{
    "data": {
        "note": "Margin of safety = actual − break-even (how far sales can fall before a loss). Profit = units × CM − fixed.",
        "inputs": {
            "price": 50,
            "fixed_costs": 10000,
            "actual_units": 800,
            "variable_cost": 30
        },
        "profit": 6000,
        "break_even_units": 500,
        "margin_of_safety_units": 300,
        "margin_of_safety_percent": 37.5
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:19.014Z",
        "request_id": "91c0286e-577a-48e8-9325-a3e8a5eef266"
    },
    "status": "ok",
    "message": "Margin of safety",
    "success": true
}
```

#### `GET /v1/target` — Units for a target profit

**Parameters:**
- `fixed_costs` (query, required, string) — Fixed costs Example: `10000`
- `price` (query, required, string) — Selling price per unit Example: `50`
- `variable_cost` (query, required, string) — Variable cost per unit Example: `30`
- `target_profit` (query, optional, string) — Target profit (default 0) Example: `5000`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/breakeven-api/v1/target?fixed_costs=10000&price=50&variable_cost=30&target_profit=5000"
```

**Response:**
```json
{
    "data": {
        "note": "Required units = (fixed + target_profit) / (price − variable). Revenue = units × price.",
        "inputs": {
            "price": 50,
            "fixed_costs": 10000,
            "target_profit": 5000,
            "variable_cost": 30
        },
        "required_units": 750,
        "required_revenue": 37500,
        "contribution_margin": 20
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:19.129Z",
        "request_id": "1c4d04ad-a6b1-4f6e-a20d-66f9fa2b53e2"
    },
    "status": "ok",
    "message": "Target profit units",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "All money values in the same currency; units are whole products in practice (results may be fractional). Single-product CVP model with linear costs.",
        "service": "breakeven-api",
        "formulae": {
            "target": "units = (fixed + target_profit) / CM",
            "break_even": "units = fixed / CM",
            "contribution": "CM = price − variable_cost",
            "margin_of_safety": "MOS = actual − break-even"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/target": "Units and revenue needed to reach a target profit.",
            "GET /v1/breakeven": "Break-even units and revenue, with the contribution margin and ratio.",
            "GET /v1/margin-of-safety": "Margin of safety and profit at an actual sales level."
        },
        "description": "Break-even and cost-volume-profit calculator: break-even point, units for a target profit, and margin of safety."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:19.249Z",
        "request_id": "62fd056f-e7b6-4c2f-b595-505d27ea173f"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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