# LED Resistor API
> LED current-limiting-resistor maths as an API, computed locally and deterministically. The resistor endpoint sizes the series resistor for a single LED, R = (V_supply − V_forward) / I, and returns the resistor power dissipation (I²·R), the LED power, a recommended resistor wattage rating and the nearest E12 standard value (rounded up so the LED current stays at or below the target). The series endpoint sizes the one shared resistor for several LEDs wired in series, where the forward voltages add, R = (V_supply − n·V_f) / I, and flags when the supply is too low for the string. The parallel endpoint gives the per-LED resistor for LEDs in parallel (each needs its own) and the total current the supply must deliver. Currents are entered in milliamps. Everything is computed locally and deterministically, so it is instant and private. Ideal for electronics, maker, Arduino and hardware app developers, LED and lighting-circuit design tools, and electronics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is LED resistor sizing; for general Ohm's law and reactance use an Ohm's-law API and for AWG wire properties use a wire-gauge 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/ledresistor-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 25,000 calls/Mo, 5 req/s
- **Pro** ($15/Mo) — 150,000 calls/Mo, 15 req/s
- **Mega** ($45/Mo) — 795,000 calls/Mo, 40 req/s

## Endpoints

### LED

#### `GET /v1/parallel` — Parallel LEDs

**Parameters:**
- `supply_voltage` (query, required, string) — Supply voltage (V) Example: `5`
- `led_voltage` (query, required, string) — LED forward voltage Vf (V) Example: `2`
- `count` (query, required, string) — Number of parallel LEDs Example: `4`
- `current` (query, optional, string) — Current per LED (mA) Example: `20`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ledresistor-api/v1/parallel?supply_voltage=5&led_voltage=2&count=4&current=20"
```

**Response:**
```json
{
    "data": {
        "note": "Each parallel LED gets its own resistor R = (Vsupply − Vf)/I; the supply must deliver n × the per-LED current. Avoid a single shared resistor.",
        "inputs": {
            "count": 4,
            "current_ma": 20,
            "led_voltage": 2,
            "supply_voltage": 5
        },
        "total_power_w": 0.4,
        "nearest_e12_ohm": 150,
        "total_current_ma": 80,
        "resistor_per_led_ohm": 150
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:12.596Z",
        "request_id": "1f2654ae-1aca-4cf4-a95f-05cffc93133e"
    },
    "status": "ok",
    "message": "Parallel LEDs",
    "success": true
}
```

#### `GET /v1/resistor` — Single LED resistor

**Parameters:**
- `supply_voltage` (query, required, string) — Supply voltage (V) Example: `5`
- `led_voltage` (query, required, string) — LED forward voltage Vf (V) Example: `2`
- `current` (query, optional, string) — LED current (mA) Example: `20`
- `current_a` (query, optional, string) — Or current in A

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ledresistor-api/v1/resistor?supply_voltage=5&led_voltage=2&current=20"
```

**Response:**
```json
{
    "data": {
        "note": "R = (Vsupply − Vf)/I. The nearest E12 is rounded up so the LED current stays at or below the target.",
        "inputs": {
            "current_ma": 20,
            "led_voltage": 2,
            "supply_voltage": 5
        },
        "led_power_w": 0.04,
        "resistance_ohm": 150,
        "nearest_e12_ohm": 150,
        "resistor_power_w": 0.06,
        "recommended_resistor_rating_w": "0.25 W"
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:12.707Z",
        "request_id": "b38f314e-533b-4812-92c4-07b7572258bc"
    },
    "status": "ok",
    "message": "LED resistor",
    "success": true
}
```

#### `GET /v1/series` — Series LEDs

**Parameters:**
- `supply_voltage` (query, required, string) — Supply voltage (V) Example: `12`
- `led_voltage` (query, required, string) — LED forward voltage Vf (V) Example: `2`
- `count` (query, required, string) — Number of LEDs in series Example: `3`
- `current` (query, optional, string) — LED current (mA) Example: `20`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ledresistor-api/v1/series?supply_voltage=12&led_voltage=2&count=3&current=20"
```

**Response:**
```json
{
    "data": {
        "note": "Series LEDs add forward voltages and share one resistor: R = (Vsupply − n·Vf)/I, the same current flows through all.",
        "inputs": {
            "count": 3,
            "current_ma": 20,
            "led_voltage": 2,
            "supply_voltage": 12
        },
        "total_power_w": 0.24,
        "resistance_ohm": 300,
        "nearest_e12_ohm": 330,
        "resistor_power_w": 0.12,
        "total_led_voltage": 6
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:12.815Z",
        "request_id": "0e1543ff-6818-4b29-8e8d-1c5ddc6f6d13"
    },
    "status": "ok",
    "message": "Series LEDs",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Voltages in volts, current in mA (or current_a in A). Typical LED currents are 10–20 mA. The nearest E12 resistor is rounded up to keep the current at or below target.",
        "service": "ledresistor-api",
        "formulae": {
            "power": "P_resistor = I²·R,  P_led = Vf·I",
            "series": "R = (Vsupply − n·Vf)/I",
            "resistor": "R = (Vsupply − Vf) / I"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/series": "One resistor for LEDs wired in series (forward voltages add).",
            "GET /v1/parallel": "Per-LED resistor and total current for LEDs in parallel.",
            "GET /v1/resistor": "Series resistor for one LED, with the nearest E12 value and power dissipation."
        },
        "description": "LED current-limiting-resistor calculator: single LED, series strings and parallel arrays, with the nearest E12 value and power ratings."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:12.895Z",
        "request_id": "5431d254-7203-4af4-b71a-94beed127b3f"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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