# Ohm's Law & Circuits API
> Electronics circuit maths as an API. The ohms-law endpoint takes any two of voltage, current, resistance and power and returns all four (V = IR, P = VI = I²R = V²/R). The combine endpoint computes the total of resistors, capacitors or inductors wired in series or parallel — resistors and inductors add in series and combine reciprocally in parallel, while capacitors do the opposite. The voltage-divider endpoint computes the output voltage of a two-resistor divider and the current through it. The reactance endpoint computes capacitive reactance (Xc = 1/2πfC), inductive reactance (XL = 2πfL), the LC resonant frequency, and the RC or RL time constant. Everything is computed locally with exact formulas in SI units, so it is instant and private. Ideal for electronics design and education, embedded and hardware engineering, hobby and bench projects, and physics teaching. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 5 endpoints. This is circuit maths; for resistor colour codes use a resistor API and for general unit conversion use a unit 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/ohmslaw-api/..."
```

## Pricing
- **Free** (Free) — 6,635 calls/Mo, 2 req/s
- **Starter** ($8/Mo) — 16,150 calls/Mo, 8 req/s
- **Pro** ($28/Mo) — 212,500 calls/Mo, 20 req/s
- **Mega** ($66/Mo) — 1,105,000 calls/Mo, 50 req/s

## Endpoints

### Circuits

#### `GET /v1/combine` — Components in series/parallel

**Parameters:**
- `values` (query, required, string) — List of values Example: `4,4`
- `type` (query, optional, string) — resistor|capacitor|inductor Example: `resistor`
- `mode` (query, optional, string) — series|parallel Example: `parallel`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ohmslaw-api/v1/combine?values=4%2C4&type=resistor&mode=parallel"
```

**Response:**
```json
{
    "data": {
        "mode": "parallel",
        "type": "resistor",
        "unit": "Ω",
        "count": 2,
        "total": 2,
        "values": [
            4,
            4
        ]
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:12.393Z",
        "request_id": "343332fe-f96d-4060-aab0-97346c4c7436"
    },
    "status": "ok",
    "message": "Combine components",
    "success": true
}
```

#### `GET /v1/ohms-law` — V / I / R / P (give any two)

**Parameters:**
- `voltage` (query, optional, string) — Volts Example: `12`
- `current` (query, optional, string) — Amps
- `resistance` (query, optional, string) — Ohms Example: `4`
- `power` (query, optional, string) — Watts

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ohmslaw-api/v1/ohms-law?voltage=12&resistance=4"
```

**Response:**
```json
{
    "data": {
        "power_w": 36,
        "current_a": 3,
        "voltage_v": 12,
        "resistance_ohm": 4
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:12.511Z",
        "request_id": "fff126ce-fd18-4d9a-b1fd-b855fefe1c64"
    },
    "status": "ok",
    "message": "Ohm's law",
    "success": true
}
```

#### `GET /v1/reactance` — Reactance / resonance / time constant

**Parameters:**
- `frequency` (query, optional, string) — Hz Example: `1000`
- `capacitance` (query, optional, string) — Farads Example: `0.000001`
- `inductance` (query, optional, string) — Henries
- `resistance` (query, optional, string) — Ohms

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/ohmslaw-api/v1/reactance?frequency=1000&capacitance=0.000001"
```

**Response:**
```json
{
    "data": {
        "inputs": {
            "frequency": 1000,
            "inductance": null,
            "resistance": null,
            "capacitance": 1.0e-6
        },
        "capacitive_reactance_ohm": 159.15494
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:12.606Z",
        "request_id": "4060bef2-6086-4a41-b6ad-0eed9a6ec257"
    },
    "status": "ok",
    "message": "Reactance",
    "success": true
}
```

#### `GET /v1/voltage-divider` — Two-resistor divider

**Parameters:**
- `vin` (query, required, string) — Input volts Example: `9`
- `r1` (query, required, string) — Top resistor Example: `1000`
- `r2` (query, required, string) — Bottom resistor Example: `2000`

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

**Response:**
```json
{
    "data": {
        "r1": 1000,
        "r2": 2000,
        "vin": 9,
        "vout": 6,
        "ratio": 0.66666667,
        "current_a": 0.003
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:12.729Z",
        "request_id": "144ba4ef-f59e-4f05-8a04-35484144b32c"
    },
    "status": "ok",
    "message": "Voltage divider",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "name": "Ohm's Law & Circuits API",
        "notes": "SI base units (volts, amps, ohms, watts, farads, henries, hertz, seconds). Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/ohms-law",
                "params": {
                    "power": "W (give any two)",
                    "current": "A",
                    "voltage": "V",
                    "resistance": "Ω"
                },
                "returns": "voltage, current, resistance and power"
            },
            {
                "path": "/v1/combine",
                "params": {
                    "mode": "series|parallel",
                    "type": "resistor|capacitor|inductor",
                    "values": "list of component values"
                },
                "returns": "the combined total"
            },
            {
                "path": "/v1/voltage-divider",
                "params": {
                    "r1": "top resistor",
                    "r2": "bottom resistor",
                    "vin": "input voltage"
                },
                "returns": "Vout and the current"
            },
            {
                "path": "/v1/reactance",
                "params": {
                    "frequency": "Hz",
                    "inductance": "H",
                    "resistance": "Ω",
                    "capacitance": "F"
                },
                "returns": "Xc, XL, resonant f
…(truncated, see openapi.json for full schema)
```


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