# Off-Grid Solar Sizing API
> Off-grid solar system-sizing maths as an API, computed locally and deterministically — the battery-bank, solar-array and charge-controller numbers an RV, cabin, boat or off-grid homeowner sizes a system with. The battery-bank endpoint gives the storage you need = (daily load × days of autonomy) ÷ (depth of discharge × round-trip efficiency), then ÷ the system voltage for amp-hours: the autonomy carries you through cloudy days and the depth-of-discharge limit protects the cells (lead-acid ~50 %, lithium 80–100 %, which is why lithium banks run smaller), so a 2 kWh/day load at 12 V with 2 days autonomy, 50 % DoD and 85 % efficiency needs about 785 Ah. The array endpoint gives the panels = daily energy ÷ (peak sun hours × system efficiency), where peak sun hours is the day's irradiance as equivalent full-sun hours (~3–6 by place and season) and the efficiency rolls up controller, wiring, heat and dust losses — about 670 W for that load at 4 sun hours and 75 %. The charge-controller endpoint sizes the controller = array watts ÷ battery voltage × a 1.25 safety factor, so a 700 W array on a 12 V bank wants roughly an 80 A controller. Everything is computed locally and deterministically, so it is instant and private. Ideal for solar-installer and DIY tools, RV/marine/cabin power planners, and renewable-energy calculators. Pure local computation — no key, no third-party service, instant. Size for the worst month. 3 compute endpoints. For solar irradiance and sun hours use a solar API; for battery runtime under load a battery 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/offgrid-api/..."
```

## Pricing
- **Free** (Free) — 6,600 calls/Mo, 2 req/s
- **Starter** ($11/Mo) — 65,000 calls/Mo, 6 req/s
- **Pro** ($35/Mo) — 256,000 calls/Mo, 15 req/s
- **Mega** ($109/Mo) — 1,320,000 calls/Mo, 40 req/s

## Endpoints

### OffGrid

#### `GET /v1/array` — Solar-array wattage

**Parameters:**
- `daily_load_wh` (query, required, string) — Daily energy use (Wh) Example: `2000`
- `peak_sun_hours` (query, optional, string) — Peak sun hours (default 4) Example: `4`
- `system_efficiency_pct` (query, optional, string) — System efficiency % (default 75) Example: `75`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/offgrid-api/v1/array?daily_load_wh=2000&peak_sun_hours=4&system_efficiency_pct=75"
```

#### `GET /v1/battery-bank` — Battery bank for autonomy

**Parameters:**
- `daily_load_wh` (query, required, string) — Daily energy use (Wh) Example: `2000`
- `system_voltage_v` (query, required, string) — System voltage (V) Example: `12`
- `days_autonomy` (query, optional, string) — Days of autonomy (default 2) Example: `2`
- `depth_of_discharge_pct` (query, optional, string) — Depth of discharge % (default 50) Example: `50`
- `battery_efficiency_pct` (query, optional, string) — Round-trip efficiency % (default 85) Example: `85`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/offgrid-api/v1/battery-bank?daily_load_wh=2000&system_voltage_v=12&days_autonomy=2&depth_of_discharge_pct=50&battery_efficiency_pct=85"
```

#### `GET /v1/charge-controller` — Charge-controller current

**Parameters:**
- `array_watts` (query, required, string) — Array power (W) Example: `700`
- `system_voltage_v` (query, required, string) — System voltage (V) Example: `12`
- `safety_factor` (query, optional, string) — Safety factor (default 1.25) Example: `1.25`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/offgrid-api/v1/charge-controller?array_watts=700&system_voltage_v=12&safety_factor=1.25"
```

### Meta

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

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


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