# 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"
```

**Response:**
```json
{
    "data": {
        "note": "Solar array = daily energy ÷ (peak sun hours × system efficiency). Peak sun hours is the day's irradiance expressed as equivalent hours at 1000 W/m² (about 3–6 depending on place and season — look it up for your site), and the efficiency rolls up charge-controller, wiring, temperature and dust losses (~70–80 %). A 2 kWh/day load at 4 sun hours and 75 % efficiency needs about 670 W of panels — size up for winter, the worst case.",
        "inputs": {
            "daily_load_wh": 2000,
            "peak_sun_hours": 4,
            "system_efficiency_pct": 75
        },
        "required_array_watts": 667
    },
    "meta": {
        "timestamp": "2026-06-07T08:18:04.863Z",
        "request_id": "6b14d588-47e8-4efb-a6f1-91684234eed3"
    },
    "status": "ok",
    "message": "Solar array",
    "success": true
}
```

#### `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"
```

**Response:**
```json
{
    "data": {
        "note": "Battery bank = (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 likes ~50 %, lithium tolerates 80–100 %, which is why a lithium bank can be much smaller for the same usable energy. A 2 kWh/day load at 12 V with 2 days autonomy, 50 % DoD and 85 % efficiency needs ~785 Ah.",
        "inputs": {
            "daily_load_wh": 2000,
            "days_autonomy": 2,
            "system_voltage_v": 12,
            "battery_efficiency_pct": 85,
            "depth_of_discharge_pct": 50
        },
        "usable_capacity_wh": 4000,
        "required_capacity_ah": 784.3,
        "required_capacity_wh": 9412
    },
    "meta": {
        "timestamp": "2026-06-07T08:18:04.964Z",
        "request_id": "05ef1364-47eb-4254-a417-b37c4b297b57"
    },
    "status": "ok",
    "message": "Battery bank",
    "success": true
}
```

#### `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"
```

**Response:**
```json
{
    "data": {
        "note": "Charge-controller current = array watts ÷ battery voltage, then × a 1.25 safety factor (NEC) for irradiance edge-cases — a 700 W array on a 12 V bank is ~58 A, so rate the controller at ~73 A (round up to the next standard size, e.g. 80 A). An MPPT controller lets a higher-voltage panel string feed a lower-voltage battery and harvests more in cold or low light than a cheaper PWM unit. Mind the controller's own max PV voltage.",
        "inputs": {
            "array_watts": 700,
            "safety_factor": 1.25,
            "system_voltage_v": 12
        },
        "array_current_a": 58.33,
        "min_controller_amps": 72.9
    },
    "meta": {
        "timestamp": "2026-06-07T08:18:05.050Z",
        "request_id": "c396c91e-2794-487c-a8e5-f4aac9126fe2"
    },
    "status": "ok",
    "message": "Charge controller",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Wh, V, Ah, W, A, peak sun hours. bank = (load·days)/(DoD·eff)/V; array = load/(sun·eff); controller A = (array W/V)×1.25. Size for the worst month. For solar irradiance/sun hours use a solar API; for battery runtime under load a battery API.",
        "service": "offgrid-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/array": "Solar-array wattage for the daily energy.",
            "GET /v1/battery-bank": "Battery capacity (Ah/Wh) for a load and days of autonomy.",
            "GET /v1/charge-controller": "Charge-controller current from array watts and voltage."
        },
        "description": "Off-grid solar sizing maths: battery bank for autonomy, solar-array wattage, and charge-controller current."
    },
    "meta": {
        "timestamp": "2026-06-07T08:18:05.125Z",
        "request_id": "5984eb3f-7c6b-4653-8f82-e8f68fe839c9"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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