# Weaving API
> Weaving and loom maths as an API, computed locally and deterministically — the warp, weft and sett numbers a handweaver warps a loom by. The warp endpoint computes the total ends and the warp yarn for a project: ends = warp width × EPI (ends per inch, the sett), and the warp length per end = the cloth length adjusted for take-up (~10 %) and shrinkage plus the loom waste (~24 inches of thrums), so a 20-inch-wide piece at 12 EPI woven to 60 inches needs 240 ends and 600 yards of warp. The weft endpoint computes the weft yarn from the picks per inch, the width and the woven length: picks = PPI × woven length, each crossing the width plus the draw-in. The sett endpoint turns a yarn's wraps-per-inch into the ends-per-inch to set: a balanced plain weave is half the WPI, twill two-thirds, satin three-quarters — so a yarn that wraps 24 times per inch setts at 12 EPI for plain weave. Everything is computed locally and deterministically, so it is instant and private. Ideal for weaving, fiber-arts, textile and craft app developers, warp-calculator and project-planning tools, and weaving education. Pure local computation — no key, no third-party service, instant. Imperial inches in; yards out. Live, nothing stored. 3 compute endpoints. Take-up, draw-in and loom waste have sensible defaults — measure your own loom.

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

## Pricing
- **Free** (Free) — 6,050 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 56,500 calls/Mo, 6 req/s
- **Pro** ($11/Mo) — 239,000 calls/Mo, 15 req/s
- **Mega** ($34/Mo) — 1,345,000 calls/Mo, 40 req/s

## Endpoints

### Weaving

#### `GET /v1/sett` — Sett (EPI from WPI)

**Parameters:**
- `wpi` (query, required, string) — Wraps per inch of the yarn Example: `24`
- `structure` (query, optional, string) — plain, twill or satin Example: `plain`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/weaving-api/v1/sett?wpi=24&structure=plain"
```

**Response:**
```json
{
    "data": {
        "note": "Sett (EPI) = wraps-per-inch × structure factor: plain weave ½, twill ⅔, satin ¾. WPI is how many times the yarn wraps around a ruler in an inch — a balanced plain weave uses half that.",
        "inputs": {
            "wpi": 24,
            "structure": "plain"
        },
        "sett_epi": 12,
        "sett_factor": 0.5
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:08.729Z",
        "request_id": "eaeb3732-8fe8-4d85-9bac-0bfea3513f0e"
    },
    "status": "ok",
    "message": "Sett EPI",
    "success": true
}
```

#### `GET /v1/warp` — Warp ends & yarn

**Parameters:**
- `warp_width` (query, required, string) — Warp width in reed (in) Example: `20`
- `epi` (query, required, string) — Ends per inch (sett) Example: `12`
- `cloth_length` (query, required, string) — Woven/finished length (in) Example: `60`
- `takeup_percent` (query, optional, string) — Take-up % (default 10)
- `loom_waste` (query, optional, string) — Loom waste (in, default 24)
- `shrinkage_percent` (query, optional, string) — Shrinkage %

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/weaving-api/v1/warp?warp_width=20&epi=12&cloth_length=60"
```

**Response:**
```json
{
    "data": {
        "note": "Ends = warp width × EPI. Warp length per end = cloth length × (1 + take-up) × (1 + shrinkage) + loom waste. Total warp = ends × that length.",
        "inputs": {
            "epi": 12,
            "loom_waste": 24,
            "warp_width": 20,
            "cloth_length": 60,
            "takeup_percent": 10
        },
        "total_ends": 240,
        "total_warp_yarn_yards": 600,
        "total_warp_yarn_inches": 21600,
        "warp_length_per_end_inches": 90
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:08.838Z",
        "request_id": "a3571fdb-87a1-476d-a1af-79a820e70389"
    },
    "status": "ok",
    "message": "Warp yarn",
    "success": true
}
```

#### `GET /v1/weft` — Weft yarn

**Parameters:**
- `ppi` (query, required, string) — Picks per inch Example: `12`
- `warp_width` (query, required, string) — Width in reed (in) Example: `20`
- `cloth_length` (query, required, string) — Woven length (in) Example: `60`
- `draw_in_percent` (query, optional, string) — Draw-in % (default 10)
- `takeup_percent` (query, optional, string) — Take-up % (default 10)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/weaving-api/v1/weft?ppi=12&warp_width=20&cloth_length=60"
```

**Response:**
```json
{
    "data": {
        "note": "Picks = PPI × woven length. Each pick crosses the warp width plus the draw-in. Total weft = picks × that length; add extra for selvedges and bobbin waste.",
        "inputs": {
            "ppi": 12,
            "warp_width": 20,
            "cloth_length": 60,
            "draw_in_percent": 10
        },
        "total_picks": 792,
        "weft_per_pick_inches": 22,
        "total_weft_yarn_yards": 484,
        "total_weft_yarn_inches": 17424
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:08.934Z",
        "request_id": "71230feb-004d-4dec-b3d3-dfb3b60629fe"
    },
    "status": "ok",
    "message": "Weft yarn",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Imperial inches in; yards out. Take-up (~10%), draw-in (~10%) and loom waste (~24\") have sensible defaults — measure your loom. EPI = ends per inch (the sett); WPI = wraps per inch of the yarn.",
        "service": "weaving-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/sett": "Ends per inch from wraps per inch for plain, twill or satin weave.",
            "GET /v1/warp": "Total ends and warp yarn from width, EPI, cloth length and take-up/waste.",
            "GET /v1/weft": "Total weft yarn from picks per inch, width and length."
        },
        "description": "Weaving maths: warp yarn (ends & length), weft yarn, and sett (EPI from WPI) by weave structure."
    },
    "meta": {
        "timestamp": "2026-06-06T07:14:09.030Z",
        "request_id": "931bb998-1322-4822-b1ce-43720f1c75ea"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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