# Wire Gauge API
> AWG (American Wire Gauge) maths as an API, computed locally and deterministically. The awg endpoint returns the physical properties of a gauge — the diameter, 0.127·92^((36−n)/39) mm, the cross-section area, the DC resistance per kilometre and per 1000 ft for copper or aluminium, and the Preece fusing current (the point at which the wire melts, far above any safe operating ampacity). The fromdiameter endpoint goes the other way, giving the nearest AWG for a measured diameter or cross-section area, n = 36 − 39·log₉₂(d/0.127). The resistance endpoint gives the resistance of a wire run from its gauge, length and material, R = ρ·L/A. Gauges 0/0 (1/0), 00 (2/0) and 000 (3/0) are entered as −1, −2 and −3. Everything is computed locally and deterministically, so it is instant and private. Ideal for electronics, electrical and maker app developers, wiring and cable-selection tools, and engineering education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is wire-gauge geometry and resistance; for cable voltage drop over a circuit use a voltage-drop 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/wiregauge-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 30,000 calls/Mo, 5 req/s
- **Pro** ($24/Mo) — 200,000 calls/Mo, 20 req/s
- **Mega** ($69/Mo) — 1,500,000 calls/Mo, 60 req/s

## Endpoints

### Wire Gauge

#### `GET /v1/awg` — AWG properties

**Parameters:**
- `awg` (query, required, string) — AWG number (40 thin … 0 thick; −1/−2/−3 = 1/0,2/0,3/0) Example: `12`
- `material` (query, optional, string) — copper | aluminium (default copper) Example: `copper`

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

**Response:**
```json
{
    "data": {
        "note": "AWG diameter = 0.127·92^((36−n)/39) mm. Fusing current (Preece) is the melt point — far above the safe ampacity. Use AWG −1/−2/−3 for 1/0, 2/0, 3/0.",
        "inputs": {
            "awg": 12,
            "material": "copper"
        },
        "area_mm2": 3.30877,
        "diameter_mm": 2.05253,
        "fusing_current_a": 236.13,
        "resistance_ohm_per_km": 5.1983,
        "resistance_ohm_per_1000ft": 1.58444
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:13.035Z",
        "request_id": "42747fb3-546b-44c5-b5db-c29cc1bcbf6c"
    },
    "status": "ok",
    "message": "AWG properties",
    "success": true
}
```

#### `GET /v1/fromdiameter` — AWG from diameter

**Parameters:**
- `diameter` (query, optional, string) — Conductor diameter (mm) Example: `2.05`
- `area` (query, optional, string) — Or cross-section area (mm²)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wiregauge-api/v1/fromdiameter?diameter=2.05"
```

**Response:**
```json
{
    "data": {
        "note": "AWG = 36 − 39·log₉₂(d/0.127). Negative AWG means 1/0, 2/0, 3/0 (−1, −2, −3).",
        "inputs": {
            "diameter_mm": 2.05
        },
        "awg_exact": 12.0106,
        "awg_nearest": 12,
        "nearest_diameter_mm": 2.05253
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:13.154Z",
        "request_id": "217844f4-59b9-4ea3-be00-9a9f3ad38ef5"
    },
    "status": "ok",
    "message": "AWG from diameter",
    "success": true
}
```

#### `GET /v1/resistance` — Wire resistance

**Parameters:**
- `awg` (query, required, string) — AWG number Example: `12`
- `length` (query, required, string) — Length (m) Example: `100`
- `material` (query, optional, string) — copper | aluminium (default copper) Example: `copper`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wiregauge-api/v1/resistance?awg=12&length=100&material=copper"
```

**Response:**
```json
{
    "data": {
        "note": "R = ρ·L/A with the AWG cross-section. Copper ρ = 0.0172, aluminium 0.0282 Ω·mm²/m at 20 °C.",
        "inputs": {
            "awg": 12,
            "length": 100,
            "material": "copper"
        },
        "area_mm2": 3.30877,
        "resistance_ohm": 0.51983
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:13.244Z",
        "request_id": "90061ea6-1f84-4305-bbb7-29582f81843a"
    },
    "status": "ok",
    "message": "Wire resistance",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "AWG number (40 thin … 0 thick; use −1/−2/−3 for 1/0, 2/0, 3/0). Diameter in mm, length in m. Fusing current is the wire's melt point (Preece), not a safe operating ampacity.",
        "service": "wiregauge-api",
        "formulae": {
            "area": "A = π/4·d²",
            "diameter": "d = 0.127·92^((36−n)/39) mm",
            "awg_from_d": "n = 36 − 39·log₉₂(d/0.127)",
            "resistance": "R = ρ·L/A"
        },
        "endpoints": {
            "GET /v1/awg": "Diameter, area, resistance per km and fusing current for an AWG gauge.",
            "GET /v1/meta": "This document.",
            "GET /v1/resistance": "Resistance of a wire run from AWG, length and material.",
            "GET /v1/fromdiameter": "Nearest AWG from a diameter (mm) or cross-section area (mm²)."
        },
        "description": "AWG wire-gauge calculator: gauge properties, AWG from a diameter/area, and wire resistance for a run."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:13.338Z",
        "request_id": "ce102b37-6564-4574-9da5-4b0889164c3d"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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