# Sheet Metal API
> Sheet-metal bending maths as an API, computed locally and deterministically. The bend-allowance endpoint computes the bend allowance, bend deduction and outside setback for a single bend from the material thickness, the inside bend radius, the bend angle and the K-factor: the bend allowance is BA = θ·(r + K·t), the outside setback is OSSB = (r + t)·tan(θ/2) and the bend deduction is BD = 2·OSSB − BA, with the neutral-axis position reported too. The flat-length endpoint computes the flat blank length you need to cut: from a list of outside (mold-line) flange lengths, or two flanges, or a total, it subtracts the bend deduction for each bend. The kfactor endpoint lists typical K-factors by material — aluminium around 0.33, mild steel 0.44, stainless 0.45 — and estimates a K-factor from the inside-radius-to-thickness ratio. The K-factor can be given directly or chosen by material, and if the inside radius is omitted it defaults to the thickness. Lengths are unit-agnostic — the output matches whatever unit you supply. Everything is computed locally and deterministically, so it is instant and private. Ideal for sheet-metal CAD/CAM and press-brake tools, fabrication and unfolding apps, maker and prototyping projects, and manufacturing calculators. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is sheet-metal bend development; for the weight of the blank use a metal-weight 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/sheetmetal-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 18,000 calls/Mo, 5 req/s
- **Pro** ($24/Mo) — 90,000 calls/Mo, 15 req/s
- **Mega** ($74/Mo) — 400,000 calls/Mo, 40 req/s

## Endpoints

### SheetMetal

#### `GET /v1/bend-allowance` — Bend allowance & deduction

**Parameters:**
- `thickness` (query, required, string) — Material thickness t Example: `2`
- `inside_radius` (query, optional, string) — Inside bend radius (default = thickness) Example: `3`
- `bend_angle` (query, required, string) — Bend angle (degrees) Example: `90`
- `k_factor` (query, optional, string) — K-factor 0-1 (default 0.44) Example: `0.44`
- `material` (query, optional, string) — aluminium|mild_steel|… (instead of k)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sheetmetal-api/v1/bend-allowance?thickness=2&inside_radius=3&bend_angle=90&k_factor=0.44"
```

**Response:**
```json
{
    "data": {
        "formula": "BA = θ·(r + K·t); OSSB = (r+t)·tan(θ/2); BD = 2·OSSB − BA (θ in radians).",
        "k_factor": 0.44,
        "k_source": "explicit",
        "thickness": 2,
        "inside_radius": 3,
        "bend_allowance": 6.09469,
        "bend_angle_deg": 90,
        "bend_deduction": 3.90531,
        "outside_setback": 5,
        "neutral_axis_from_inside": 0.88
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:04.925Z",
        "request_id": "71beaa5f-5b93-45f6-8964-af21562f1a2a"
    },
    "status": "ok",
    "message": "Bend allowance & deduction",
    "success": true
}
```

#### `GET /v1/flat-length` — Blank length from flanges

**Parameters:**
- `thickness` (query, required, string) — Thickness t Example: `2`
- `inside_radius` (query, optional, string) — Inside radius Example: `3`
- `bend_angle` (query, required, string) — Bend angle (degrees) Example: `90`
- `k_factor` (query, optional, string) — K-factor Example: `0.44`
- `flanges` (query, optional, string) — Comma list of outside flange lengths Example: `50,30,40`
- `flange_a` (query, optional, string) — Or flange A
- `flange_b` (query, optional, string) — And flange B
- `outside_total` (query, optional, string) — Or total outside length
- `bends` (query, optional, string) — Number of bends

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sheetmetal-api/v1/flat-length?thickness=2&inside_radius=3&bend_angle=90&k_factor=0.44&flanges=50%2C30%2C40"
```

**Response:**
```json
{
    "data": {
        "note": "Blank length = sum of outside (mold-line) flange lengths − (number of bends × bend deduction).",
        "bends": 2,
        "flanges": [
            50,
            30,
            40
        ],
        "k_factor": 0.44,
        "thickness": 2,
        "blank_length": 112.18938,
        "inside_radius": 3,
        "bend_angle_deg": 90,
        "bend_deduction_each": 3.90531,
        "outside_total_length": 120
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:05.024Z",
        "request_id": "f2893a7e-80e2-4cd1-a466-f409203bb361"
    },
    "status": "ok",
    "message": "Blank length from flanges",
    "success": true
}
```

#### `GET /v1/kfactor` — K-factor reference & estimate

**Parameters:**
- `thickness` (query, optional, string) — Thickness (for r/t estimate) Example: `2`
- `inside_radius` (query, optional, string) — Inside radius (for r/t estimate) Example: `6`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/sheetmetal-api/v1/kfactor?thickness=2&inside_radius=6"
```

**Response:**
```json
{
    "data": {
        "note": "K-factor is the neutral-axis position as a fraction of thickness (0–0.5). It rises with the inside-radius-to-thickness ratio. Confirm with bend tests for precision.",
        "estimate": {
            "r_over_t": 3,
            "estimated_k": 0.45
        },
        "default_k": 0.44,
        "k_factor_by_material": {
            "hard": 0.5,
            "soft": 0.33,
            "brass": 0.4,
            "steel": 0.44,
            "bronze": 0.4,
            "copper": 0.4,
            "medium": 0.44,
            "aluminum": 0.33,
            "aluminium": 0.33,
            "mild_steel": 0.44,
            "stainless_steel": 0.45
        }
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:05.122Z",
        "request_id": "701f6ada-55fd-4dd8-84f9-bee3a1e8f220"
    },
    "status": "ok",
    "message": "K-factor reference",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "api": "sheetmetal",
        "note": "Sheet-metal bending maths — computed locally and deterministically, no key, no third-party service. Lengths are unit-agnostic.",
        "endpoints": [
            "/v1/bend-allowance",
            "/v1/flat-length",
            "/v1/kfactor",
            "/v1/meta"
        ],
        "materials": [
            "aluminium",
            "aluminum",
            "soft",
            "mild_steel",
            "steel",
            "medium",
            "stainless_steel",
            "hard",
            "copper",
            "brass",
            "bronze"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:05.225Z",
        "request_id": "7b01ec36-39c4-4132-837d-eb17444d171f"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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