# Voltage Divider API
> Resistive voltage-divider circuit design as an API, computed locally and deterministically. The divide endpoint takes an input voltage and two resistors and returns the output voltage Vout = Vin·R2/(R1+R2), the current I = Vin/(R1+R2) that flows through the chain, and the power dissipated in each resistor and in total — a 12 V source with R1 = 1 kΩ and R2 = 2 kΩ gives 8 V at 4 mA. The loaded endpoint adds a load resistor across R2, computes the parallel combination R2′ = R2·RL/(R2+RL) and the loaded output Vout = Vin·R2′/(R1+R2′), and reports the droop in volts and percent against the unloaded value, the classic mistake when a divider feeds a real load. The resistor endpoint sizes the missing resistor for a target output — R2 = R1·Vout/(Vin−Vout) or R1 = R2·(Vin−Vout)/Vout — so you can pick parts for a reference or sensor-bias point. All quantities are volts, ohms, amps and watts. Everything is computed locally and deterministically, so it is instant and private. Ideal for electronics, embedded, hardware, sensor-interfacing and EE-education app developers, reference-voltage and bias-network tools, and maker software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is the resistive divider; for a single Ohm’s-law relationship use an Ohm’s-law API and for RC/RL filters an RC-filter 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/voltagedivider-api/..."
```

## Pricing
- **Free** (Free) — 5,200 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 52,000 calls/Mo, 6 req/s
- **Pro** ($15/Mo) — 240,000 calls/Mo, 15 req/s
- **Mega** ($47/Mo) — 1,380,000 calls/Mo, 40 req/s

## Endpoints

### Divider

#### `GET /v1/divide` — Voltage divider

**Parameters:**
- `vin` (query, required, string) — Input voltage (V) Example: `12`
- `r1` (query, required, string) — Top resistor R1 (ohm) Example: `1000`
- `r2` (query, required, string) — Bottom resistor R2 (ohm) Example: `2000`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/voltagedivider-api/v1/divide?vin=12&r1=1000&r2=2000"
```

**Response:**
```json
{
    "data": {
        "note": "Unloaded divider: Vout = Vin·R2/(R1+R2); current I = Vin/(R1+R2) flows through both resistors; power Pi = I²·Ri.",
        "vout": 8,
        "inputs": {
            "r1": 1000,
            "r2": 2000,
            "vin": 12
        },
        "current_a": 0.004,
        "current_ma": 4,
        "power_r1_w": 0.016,
        "power_r2_w": 0.032,
        "total_power_w": 0.048,
        "total_resistance_ohm": 3000
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:29.400Z",
        "request_id": "b7cfd114-5e8d-4c80-8651-4fc70ee8d653"
    },
    "status": "ok",
    "message": "Voltage divider",
    "success": true
}
```

#### `GET /v1/loaded` — Loaded divider

**Parameters:**
- `vin` (query, required, string) — Input voltage (V) Example: `12`
- `r1` (query, required, string) — R1 (ohm) Example: `1000`
- `r2` (query, required, string) — R2 (ohm) Example: `2000`
- `rload` (query, required, string) — Load resistance RL (ohm) Example: `2000`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/voltagedivider-api/v1/loaded?vin=12&r1=1000&r2=2000&rload=2000"
```

**Response:**
```json
{
    "data": {
        "note": "Loaded divider: the load RL sits in parallel with R2, so R2' = R2·RL/(R2+RL) and Vout = Vin·R2'/(R1+R2'). The droop is the drop from the unloaded output — keep RL ≫ R2 to minimise it.",
        "inputs": {
            "r1": 1000,
            "r2": 2000,
            "vin": 12,
            "rload": 2000
        },
        "droop_volts": 2,
        "vout_loaded": 6,
        "droop_percent": 25,
        "vout_unloaded": 8,
        "load_current_a": 0.003,
        "r2_parallel_load_ohm": 1000
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:29.512Z",
        "request_id": "081cc967-7f14-4a7f-b510-4345b98acad5"
    },
    "status": "ok",
    "message": "Loaded divider",
    "success": true
}
```

#### `GET /v1/resistor` — Solve resistor for target Vout

**Parameters:**
- `vin` (query, required, string) — Input voltage (V) Example: `12`
- `vout` (query, required, string) — Target output (V) Example: `5`
- `r1` (query, optional, string) — R1 if known (ohm) Example: `1000`
- `r2` (query, optional, string) — R2 if known (ohm)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/voltagedivider-api/v1/resistor?vin=12&vout=5&r1=1000"
```

**Response:**
```json
{
    "data": {
        "note": "Resistive divider sizing: Vout = Vin·R2/(R1+R2) ⇒ R2 = R1·Vout/(Vin−Vout), R1 = R2·(Vin−Vout)/Vout.",
        "inputs": {
            "r1": 1000,
            "vin": 12,
            "vout": 5
        },
        "r2_ohm": 714.285714
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:29.626Z",
        "request_id": "55819d8d-9210-4452-beba-38b3a19490a1"
    },
    "status": "ok",
    "message": "Solve resistor for target Vout",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Volts, ohms, amps, watts. Ideal resistive divider; for a single Ohm's-law V/I/R relationship use an Ohm's-law API and for RC/RL filters an RC-filter API.",
        "service": "voltagedivider-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/divide": "Vout, current and per-resistor power for an unloaded divider.",
            "GET /v1/loaded": "Loaded divider — output with a load RL across R2, plus droop.",
            "GET /v1/resistor": "Solve R1 or R2 for a target Vout."
        },
        "description": "Resistive voltage divider: output voltage, current and power; loaded divider with output droop; and resistor sizing for a target output."
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:29.710Z",
        "request_id": "9d972638-8331-45b7-b5d5-bbbc7907b827"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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