# Roofing Calculator API
> Roofing geometry as an API, computed locally and deterministically. The pitch endpoint converts a roof pitch between every common form — rise-over-run (such as 6:12), the angle in degrees, the percent slope, and the slope multiplier (the factor that turns a flat footprint into the real sloped area). The rafter endpoint computes the rafter length from the horizontal run and the pitch — that is, the hypotenuse √(run² + rise²) — with an optional overhang projected along the slope. The area endpoint computes the true sloped roof area from the building footprint (entered directly or as length × width) and the pitch, adds a wastage allowance, and reports the number of US roofing squares and shingle bundles needed. Everything is computed locally and deterministically, so it is instant and private. Lengths are unit-agnostic — use consistent units — while the squares and bundles figures assume US roofing squares of 100 square feet, so pass the footprint in square feet for those. Ideal for roofing contractors and estimators, construction and DIY tools, solar-install planning, and quoting software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is roof geometry; for paint, tile, concrete and brick quantities use a construction-calculator 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/roofing-api/..."
```

## Pricing
- **Free** (Free) — 10,235 calls/Mo, 2 req/s
- **Starter** ($12/Mo) — 19,850 calls/Mo, 8 req/s
- **Pro** ($32/Mo) — 248,500 calls/Mo, 20 req/s
- **Mega** ($70/Mo) — 1,285,000 calls/Mo, 50 req/s

## Endpoints

### Roofing

#### `GET /v1/area` — Roof area, squares & bundles

**Parameters:**
- `footprint` (query, optional, string) — Plan area (or length+width) Example: `1500`
- `length` (query, optional, string) — Length
- `width` (query, optional, string) — Width
- `pitch` (query, optional, string) — rise:run Example: `6:12`
- `waste_percent` (query, optional, string) — default 10 Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/roofing-api/v1/area?footprint=1500&pitch=6%3A12&waste_percent=10"
```

**Response:**
```json
{
    "data": {
        "note": "Roof area = footprint × slope multiplier. Squares assume 100 ft² each and ~3 shingle bundles per square; pass footprint in ft² for those.",
        "input": {
            "ratio": 0.5,
            "rise_run": "6:12",
            "angle_degrees": 26.565,
            "percent_slope": 50,
            "waste_percent": 10,
            "footprint_area": 1500,
            "slope_multiplier": 1.118034
        },
        "squares": 18.45,
        "roof_area": 1677.051,
        "shingle_bundles": 56,
        "slope_multiplier": 1.118034,
        "roof_area_with_waste": 1844.756
    },
    "meta": {
        "timestamp": "2026-06-03T17:41:55.476Z",
        "request_id": "a27d6793-70d3-454e-92ed-c613cc6b6d17"
    },
    "status": "ok",
    "message": "Roof area",
    "success": true
}
```

#### `GET /v1/pitch` — Convert roof pitch

**Parameters:**
- `pitch` (query, optional, string) — rise:run e.g. 6:12 Example: `6:12`
- `angle` (query, optional, string) — Or angle (degrees)
- `percent` (query, optional, string) — Or percent slope
- `rise` (query, optional, string) — Or rise (with run)
- `run` (query, optional, string) — Run

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/roofing-api/v1/pitch?pitch=6%3A12"
```

**Response:**
```json
{
    "data": {
        "note": "Slope multiplier = √(1 + (rise/run)²); multiply plan (footprint) area by it to get sloped roof area.",
        "input": {
            "angle": null,
            "pitch": "6:12",
            "percent": null
        },
        "ratio": 0.5,
        "rise_run": "6:12",
        "angle_degrees": 26.565,
        "percent_slope": 50,
        "slope_multiplier": 1.118034
    },
    "meta": {
        "timestamp": "2026-06-03T17:41:55.582Z",
        "request_id": "351a8ff3-d775-4ea9-bccb-0ac4af23d505"
    },
    "status": "ok",
    "message": "Roof pitch conversion",
    "success": true
}
```

#### `GET /v1/rafter` — Rafter length

**Parameters:**
- `run` (query, required, string) — Horizontal run Example: `12`
- `pitch` (query, optional, string) — rise:run Example: `6:12`
- `angle` (query, optional, string) — Or angle
- `overhang` (query, optional, string) — Horizontal overhang Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/roofing-api/v1/rafter?run=12&pitch=6%3A12&overhang=0"
```

**Response:**
```json
{
    "data": {
        "note": "Rafter = run × slope multiplier = √(run² + rise²). Overhang is measured horizontally and projected along the slope.",
        "rise": 6,
        "input": {
            "run": 12,
            "rise": 6,
            "ratio": 0.5,
            "overhang": 0,
            "rise_run": "6:12",
            "angle_degrees": 26.565,
            "percent_slope": 50,
            "slope_multiplier": 1.118034
        },
        "rafter_length": 13.4164,
        "total_rafter_length": 13.4164,
        "overhang_along_rafter": 0
    },
    "meta": {
        "timestamp": "2026-06-03T17:41:55.688Z",
        "request_id": "760cd886-aebe-41f6-8a81-ba383c471112"
    },
    "status": "ok",
    "message": "Rafter length",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "note": "Lengths are unit-agnostic (use consistent units); square/bundle figures assume US roofing squares (100 ft²) — pass footprint in ft².",
        "service": "roofing",
        "endpoints": {
            "/v1/area": "Sloped roof area from the footprint and pitch, with waste, roofing squares and shingle bundles.",
            "/v1/pitch": "Convert roof pitch between rise:run, angle (degrees), percent slope and slope multiplier.",
            "/v1/rafter": "Rafter length from the horizontal run and the pitch, with optional overhang."
        },
        "description": "Roofing maths: pitch conversions, rafter length, and roof area with shingle squares and bundles."
    },
    "meta": {
        "timestamp": "2026-06-03T17:41:55.776Z",
        "request_id": "d9212c11-70a2-4113-980b-7ffd6370f1c3"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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