# Capacitor API
> Capacitor maths as an API, computed locally and deterministically. The energy endpoint computes the stored energy and charge of a capacitor from any two of the capacitance, the voltage and the charge — E = ½CV² = ½QV and Q = CV — in joules, millijoules and coulombs. The charging endpoint models the RC charging and discharging transient: the time constant τ = RC, the voltage at a given time, V(t) = Vs(1 − e^(−t/RC)) when charging or V(t) = V₀·e^(−t/RC) when discharging, and the percent charged, or — given a target voltage — the time to reach it; a capacitor reaches about 63 % of the way in one time constant and over 99 % in five. The combination endpoint computes the total capacitance of capacitors in series (1/C = Σ1/Cᵢ) or parallel (C = ΣCᵢ). Capacitance accepts farads or the handy µF/nF/pF units. Everything is computed locally and deterministically, so it is instant and private. Ideal for electronics, maker, embedded and circuit-design app developers, power-supply and timing tools, and electronics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is capacitor maths; for AC reactance and resonance use a resonance API and for LED resistor sizing an LED-resistor 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/capacitor-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 20,000 calls/Mo, 5 req/s
- **Pro** ($24/Mo) — 120,000 calls/Mo, 15 req/s
- **Mega** ($74/Mo) — 600,000 calls/Mo, 40 req/s

## Endpoints

### Capacitor

#### `GET /v1/charging` — RC transient

**Parameters:**
- `resistance` (query, required, string) — Resistance (Ω) Example: `1000`
- `capacitance_uf` (query, optional, string) — Capacitance (µF) Example: `100`
- `capacitance` (query, optional, string) — Or capacitance (F)
- `mode` (query, optional, string) — charging or discharging Example: `charging`
- `source_voltage` (query, optional, string) — Source voltage (charging) Example: `12`
- `initial_voltage` (query, optional, string) — Initial voltage (discharging)
- `time` (query, optional, string) — Time (s) for the voltage Example: `0.1`
- `target_voltage` (query, optional, string) — Or target voltage for the time

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/capacitor-api/v1/charging?resistance=1000&capacitance_uf=100&mode=charging&source_voltage=12&time=0.1"
```

**Response:**
```json
{
    "data": {
        "note": "Charging V(t)=Vs(1−e^(−t/RC)); discharging V(t)=V₀·e^(−t/RC). τ=RC; ≈63 % at 1τ, ≈99 % at 5τ.",
        "inputs": {
            "mode": "charging",
            "capacitance_f": 0.0001,
            "resistance_ohm": 1000
        },
        "time_s": 0.1,
        "percent": 63.212056,
        "voltage_v": 7.585446706,
        "time_constant_s": 0.1,
        "time_constant_ms": 100
    },
    "meta": {
        "timestamp": "2026-06-05T03:08:59.900Z",
        "request_id": "d9ee5b93-35fb-4fc8-8ab9-d01528937f1b"
    },
    "status": "ok",
    "message": "RC transient",
    "success": true
}
```

#### `GET /v1/combination` — Series/parallel

**Parameters:**
- `capacitances` (query, required, string) — Comma-separated capacitances Example: `100,200,300`
- `mode` (query, optional, string) — series or parallel Example: `parallel`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/capacitor-api/v1/combination?capacitances=100%2C200%2C300&mode=parallel"
```

**Response:**
```json
{
    "data": {
        "note": "Parallel: C = ΣCᵢ. Series: 1/C = Σ(1/Cᵢ). Output is in the same unit as the inputs.",
        "inputs": {
            "mode": "parallel",
            "count": 3
        },
        "total_capacitance": 600
    },
    "meta": {
        "timestamp": "2026-06-05T03:09:00.002Z",
        "request_id": "c3851bc9-2530-41d6-93f2-cb942bebc1c9"
    },
    "status": "ok",
    "message": "Series/parallel",
    "success": true
}
```

#### `GET /v1/energy` — Energy & charge

**Parameters:**
- `capacitance_uf` (query, optional, string) — Capacitance (µF) Example: `100`
- `capacitance` (query, optional, string) — Or capacitance (F)
- `voltage` (query, optional, string) — Voltage (V) Example: `12`
- `charge` (query, optional, string) — Charge (C)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/capacitor-api/v1/energy?capacitance_uf=100&voltage=12"
```

**Response:**
```json
{
    "data": {
        "note": "E = ½CV² = ½QV; charge Q = CV. Energy in joules, charge in coulombs.",
        "inputs": {
            "charge_c": 0.0012,
            "voltage_v": 12,
            "capacitance_f": 0.0001
        },
        "charge_c": 0.0012,
        "energy_j": 0.0072,
        "charge_uc": 1200,
        "energy_mj": 7.2,
        "capacitance_uf": 100
    },
    "meta": {
        "timestamp": "2026-06-05T03:09:00.062Z",
        "request_id": "0b04e534-a51e-41d0-bacd-57edd7a08ab8"
    },
    "status": "ok",
    "message": "Energy & charge",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Capacitance in F (or capacitance_uf/_nf/_pf), voltage in V, resistance in Ω, time in s. The combination list shares one unit.",
        "service": "capacitor-api",
        "formulae": {
            "charge": "Q = CV",
            "energy": "E = ½CV² = ½QV",
            "charging": "V(t) = Vs(1 − e^(−t/RC))",
            "time_constant": "τ = RC"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/energy": "Energy and charge from any two of capacitance, voltage and charge.",
            "GET /v1/charging": "RC transient — voltage at a time, or the time to reach a target voltage.",
            "GET /v1/combination": "Total capacitance of capacitors in series or parallel."
        },
        "description": "Capacitor calculator: stored energy and charge, RC charging/discharging transients with the time constant, and series/parallel capacitance."
    },
    "meta": {
        "timestamp": "2026-06-05T03:09:00.145Z",
        "request_id": "476736de-0745-4dff-94ab-6cb88e586a9d"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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