# Wire Gauge (AWG) API
> American Wire Gauge maths as an API, computed locally and deterministically from the AWG definition. The awg endpoint takes a gauge — an integer, or 0/00/000/0000 (1/0–4/0) — and returns the conductor diameter (millimetres, inches, mils), the cross-section area (mm², kcmil and circular mils), the DC resistance per kilometre and per 1000 feet for copper and aluminium, and a typical ampacity. The convert endpoint finds the nearest standard AWG for a given cross-section area, diameter or kcmil, and also reports the exact non-integer gauge. The voltage-drop endpoint computes the round-trip voltage drop and power loss for a wiring run from the gauge (or area), length, current and conductor material, with the percentage drop and the voltage left at the load. Everything is computed locally and deterministically, so it is instant and private. Resistances are at 20°C; ampacity figures are typical guidance only — real installations are governed by the NEC/IEC tables for the conductor, insulation and conditions. Ideal for electrical and electronics tools, maker and hobby projects, solar and automotive wiring, and AV and installation planning. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is wire-gauge physics; for Ohm's-law voltage/current/resistance use an electronics API and for resistor colour bands use a 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/awg-api/..."
```

## Pricing
- **Free** (Free) — 10,535 calls/Mo, 2 req/s
- **Starter** ($12/Mo) — 20,150 calls/Mo, 8 req/s
- **Pro** ($32/Mo) — 251,500 calls/Mo, 20 req/s
- **Mega** ($70/Mo) — 1,300,000 calls/Mo, 50 req/s

## Endpoints

### Wire

#### `GET /v1/awg` — AWG diameter, area, resistance, ampacity

**Parameters:**
- `awg` (query, required, string) — Gauge: integer or 0/00/000/0000 Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/awg-api/v1/awg?awg=10"
```

**Response:**
```json
{
    "data": {
        "awg": "10",
        "note": "Diameter d(mm) = 0.127 × 92^((36−n)/39); area = π/4·d². Resistance at 20°C; ampacity is typical guidance only.",
        "input": {
            "awg": "10"
        },
        "area_mm2": 5.2612,
        "area_kcmil": 10.383,
        "diameter_mm": 2.5882,
        "diameter_inch": 0.1019,
        "diameter_mils": 101.9,
        "area_circular_mils": 10383,
        "typical_ampacity_a": 30,
        "resistance_ohm_per_km_copper": 3.2768,
        "resistance_ohm_per_km_aluminum": 5.0369,
        "resistance_ohm_per_1000ft_copper": 0.9988
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:20.911Z",
        "request_id": "78958bc7-11c9-44ae-a482-8bbde21d6c05"
    },
    "status": "ok",
    "message": "AWG properties",
    "success": true
}
```

#### `GET /v1/convert` — Nearest AWG for area/diameter

**Parameters:**
- `area_mm2` (query, optional, string) — Cross-section mm² Example: `5.26`
- `diameter_mm` (query, optional, string) — Or diameter mm
- `kcmil` (query, optional, string) — Or kcmil

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/awg-api/v1/convert?area_mm2=5.26"
```

**Response:**
```json
{
    "data": {
        "note": "Nearest standard AWG to the given size. exact_awg is the non-integer gauge that matches exactly.",
        "input": {
            "target_diameter_mm": 2.5879
        },
        "nearest": {
            "awg": "10",
            "area_mm2": 5.2612,
            "area_kcmil": 10.383,
            "diameter_mm": 2.5882,
            "diameter_inch": 0.1019,
            "diameter_mils": 101.9,
            "area_circular_mils": 10383,
            "typical_ampacity_a": 30,
            "resistance_ohm_per_km_copper": 3.2768,
            "resistance_ohm_per_km_aluminum": 5.0369,
            "resistance_ohm_per_1000ft_copper": 0.9988
        },
        "exact_awg": 10.001,
        "nearest_awg": "10"
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:21.014Z",
        "request_id": "fbfb403b-2f4d-4759-9e41-02303d028174"
    },
    "status": "ok",
    "message": "Area/diameter to AWG",
    "success": true
}
```

#### `GET /v1/voltage-drop` — Circuit voltage drop & loss

**Parameters:**
- `awg` (query, optional, string) — Gauge (or area_mm2) Example: `12`
- `area_mm2` (query, optional, string) — Cross-section mm²
- `length_m` (query, required, string) — One-way run length (m) Example: `30`
- `current_a` (query, required, string) — Current (A) Example: `15`
- `voltage` (query, optional, string) — Source voltage (for %) Example: `120`
- `material` (query, optional, string) — copper|aluminum Example: `copper`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/awg-api/v1/voltage-drop?awg=12&length_m=30&current_a=15&voltage=120&material=copper"
```

**Response:**
```json
{
    "data": {
        "note": "Round-trip drop over two conductors: ΔV = 2 × I × R/m × length. Aim under ~3% for branch circuits.",
        "input": {
            "length_m": 30,
            "material": "copper",
            "current_a": 15,
            "source_voltage": 120,
            "conductor_resistance_ohm_per_km": 5.2104
        },
        "power_loss_w": 70.34,
        "voltage_drop_v": 4.6894,
        "voltage_at_load_v": 115.311,
        "voltage_drop_percent": 3.908,
        "circuit_resistance_ohm": 0.31262
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:21.125Z",
        "request_id": "9d0a4554-f8c0-41ef-b2f7-c9ba1ed20f92"
    },
    "status": "ok",
    "message": "Voltage drop",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "note": "Resistances at 20°C (copper 1.724e-8, aluminum 2.65e-8 Ω·m). Ampacity is typical guidance — follow NEC/IEC for real installs.",
        "service": "awg",
        "endpoints": {
            "/v1/awg": "Diameter, area (mm²/kcmil/cmil), resistance and typical ampacity for an AWG number.",
            "/v1/convert": "Nearest AWG for a cross-section area, diameter or kcmil.",
            "/v1/voltage-drop": "Circuit voltage drop and power loss for a run (AWG/area, length, current, material)."
        },
        "description": "American Wire Gauge maths: diameter, cross-section area, resistance per length, typical ampacity, and circuit voltage drop."
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:21.195Z",
        "request_id": "13c48822-a30e-4fbe-a4d5-455f1a225996"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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