# Plumbing Code API
> Plumbing-code sizing maths as an API, computed locally and deterministically — the fixture-unit and pipe-sizing numbers a plumber, designer or inspector runs from the code book. The dfu endpoint totals drainage fixture units for a set of fixtures (IPC Table 709.1): pass a list like toilet:2,lavatory:3,shower:1,kitchen_sink:1 and it weights each by its discharge — a toilet is 3, a lavatory 1, a tub or shower 2 — for a total of 13, with a grouped full bathroom counting as 6 rather than the sum of its parts. The pipe-size endpoint gives the minimum building-drain size for a DFU load at a slope (IPC Table 710.1(1)): the smallest pipe whose capacity meets the load, so 50 DFU at a quarter-inch-per-foot fall needs a 4-inch drain, with the reminder that any drain carrying a water closet is a 3-inch minimum. The supply-gpm endpoint reads probable peak water demand off the Hunter curve: diversity means 100 supply fixture units draws only about 54 GPM, not the sum of every fixture running at once — the number you size the water service against. Everything is computed locally and deterministically, so it is instant and private. Ideal for plumbing-design and estimating apps, code-check and permit tools, MEP-engineering calculators, and trade-school aids. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 compute endpoints. Based on the IPC — verify against the code adopted in your jurisdiction.

## 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/plumbing-api/..."
```

## Pricing
- **Free** (Free) — 400 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 10,500 calls/Mo, 6 req/s
- **Pro** ($18/Mo) — 70,000 calls/Mo, 15 req/s
- **Mega** ($54/Mo) — 235,000 calls/Mo, 36 req/s

## Endpoints

### Plumbing

#### `GET /v1/dfu` — Total drainage fixture units

**Parameters:**
- `fixtures` (query, required, string) — Fixture list type:count,type:count Example: `toilet:2,lavatory:3,shower:1,kitchen_sink:1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/plumbing-api/v1/dfu?fixtures=toilet%3A2%2Clavatory%3A3%2Cshower%3A1%2Ckitchen_sink%3A1"
```

**Response:**
```json
{
    "data": {
        "note": "Drainage fixture units (IPC Table 709.1, private use) weight each fixture by its discharge — a toilet is 3, a lavatory 1, a tub or shower 2. Sum them to size drains and vents. A grouped full bathroom counts as 6 rather than the sum of its parts. Public/commercial fixtures carry higher values.",
        "inputs": {
            "fixtures": "toilet:2,lavatory:3,shower:1,kitchen_sink:1"
        },
        "breakdown": {
            "shower": 2,
            "toilet": 6,
            "lavatory": 3,
            "kitchen_sink": 2
        },
        "total_dfu": 13
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:43.412Z",
        "request_id": "ab649639-7329-4fc8-830c-71c23743d287"
    },
    "status": "ok",
    "message": "DFU total",
    "success": true
}
```

#### `GET /v1/pipe-size` — Minimum building-drain size

**Parameters:**
- `total_dfu` (query, required, string) — Total drainage fixture units Example: `50`
- `slope_in_per_ft` (query, optional, string) — Slope: 0.125, 0.25 or 0.5 in/ft (default 0.25) Example: `0.25`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/plumbing-api/v1/pipe-size?total_dfu=50&slope_in_per_ft=0.25"
```

**Response:**
```json
{
    "data": {
        "note": "Minimum building-drain/sewer size = the smallest pipe whose DFU capacity (IPC Table 710.1(1), at this slope) meets the load. Note: any drain carrying a water closet must be at least 3 inches regardless of DFU. Steeper slope carries more; never undersize, and keep a clean-out at the base of every stack.",
        "inputs": {
            "total_dfu": 50,
            "slope_in_per_ft": 0.25
        },
        "capacity_dfu": 216,
        "min_drain_size_in": 4
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:43.504Z",
        "request_id": "1b16d98e-83e8-4ef7-895e-fe50c81ebd31"
    },
    "status": "ok",
    "message": "Pipe size",
    "success": true
}
```

#### `GET /v1/supply-gpm` — Water-supply demand from WSFU

**Parameters:**
- `wsfu` (query, required, string) — Supply fixture units Example: `100`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/plumbing-api/v1/supply-gpm?wsfu=100"
```

**Response:**
```json
{
    "data": {
        "note": "Probable peak water demand from supply fixture units, read off the Hunter curve (flush-tank predominant) — diversity means 100 WSFU draws only ~54 GPM, not the sum of every fixture at once. Use the demand GPM with the available pressure to size the water-service and distribution piping.",
        "inputs": {
            "wsfu": 100
        },
        "demand_gpm": 54
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:43.595Z",
        "request_id": "9f1c31b8-9fef-434e-bf7c-e794664d539f"
    },
    "status": "ok",
    "message": "Supply GPM",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Based on IPC Tables 709.1 / 710.1(1) and the Hunter demand curve. Slopes 0.125/0.25/0.5 in/ft. Estimates — verify against the code adopted in your jurisdiction; water closets need a 3-inch minimum drain.",
        "service": "plumbing-api",
        "endpoints": {
            "GET /v1/dfu": "Total drainage fixture units from a fixture list (type:count,...).",
            "GET /v1/meta": "This document.",
            "GET /v1/pipe-size": "Minimum building-drain size for a DFU load at a slope.",
            "GET /v1/supply-gpm": "Water-supply demand (GPM) from supply fixture units (Hunter curve)."
        },
        "description": "Plumbing-code maths: drainage fixture units for a fixture set, minimum building-drain size at a slope, and water-supply demand (GPM) from the Hunter curve."
    },
    "meta": {
        "timestamp": "2026-06-06T15:30:43.672Z",
        "request_id": "5c7e6bc8-b8d5-4b58-a240-90d23c605304"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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