# Sewing & Fabric API
> Sewing and fabric-estimating maths as an API, computed locally and deterministically — the yardage numbers a sewist, quilter or curtain-maker works a project out with. The yardage endpoint lays cut pieces onto a bolt: pieces per row = floor(fabric width ÷ piece width), rows = ceil(quantity ÷ per row), and the fabric length = rows × piece height plus a waste allowance — six 18×22-inch pieces from 44-inch quilting cotton need about 2 yards. The curtain endpoint sizes drapery for fullness: drops = ceil(window width × fullness ÷ fabric width), where 2× is a standard gather and 2.5–3× is luxe, and each drop is the finished length plus top and bottom hems (rounded up to the pattern repeat) — a 60-inch window at 2.5× fullness on 54-inch fabric takes three drops and about 8.3 yards. The binding endpoint sizes quilt binding: length = perimeter + overlap for corners and joins, strips = ceil(length ÷ fabric width) cut at the strip width. Everything is computed locally and deterministically, so it is instant and private. Ideal for sewing, quilting, home-decor, upholstery and craft app developers, fabric-calculator and project-planning tools, and sewing education. Pure local computation — no key, no third-party service, instant. Imperial inches in; yards and metres out. Live, nothing stored. 3 compute endpoints. Add pattern-repeat allowance for prints; a planning aid.

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

## Pricing
- **Free** (Free) — 5,550 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 52,500 calls/Mo, 6 req/s
- **Pro** ($15/Mo) — 229,000 calls/Mo, 15 req/s
- **Mega** ($46/Mo) — 1,265,000 calls/Mo, 40 req/s

## Endpoints

### Sewing

#### `GET /v1/binding` — Quilt binding

**Parameters:**
- `quilt_width` (query, required, string) — Quilt width (in) Example: `60`
- `quilt_height` (query, required, string) — Quilt height (in) Example: `80`
- `strip_width` (query, optional, string) — Binding strip width (in, default 2.5)
- `fabric_width` (query, optional, string) — Fabric width (in, default 44)
- `overlap` (query, optional, string) — Corner/join overlap (in, default 10)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sewing-api/v1/binding?quilt_width=60&quilt_height=80"
```

#### `GET /v1/curtain` — Curtain fabric

**Parameters:**
- `window_width` (query, required, string) — Window/rod width (in) Example: `60`
- `finished_length` (query, required, string) — Finished curtain length (in) Example: `84`
- `fullness` (query, optional, string) — Fullness ratio (default 2) Example: `2.5`
- `fabric_width` (query, optional, string) — Fabric width (in, default 54) Example: `54`
- `hem_allowance` (query, optional, string) — Top+bottom hems (in, default 16)
- `pattern_repeat` (query, optional, string) — Pattern repeat (in)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sewing-api/v1/curtain?window_width=60&finished_length=84&fullness=2.5&fabric_width=54"
```

#### `GET /v1/yardage` — Fabric for cut pieces

**Parameters:**
- `piece_width` (query, required, string) — Piece width (in) Example: `18`
- `piece_height` (query, required, string) — Piece height (in) Example: `22`
- `quantity` (query, optional, string) — Number of pieces (default 1) Example: `6`
- `fabric_width` (query, optional, string) — Bolt width (in, default 44) Example: `44`
- `waste_percent` (query, optional, string) — Waste % (default 10)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sewing-api/v1/yardage?piece_width=18&piece_height=22&quantity=6&fabric_width=44"
```

### Meta

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

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


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