# Rebar Calculator API
> Reinforcement-steel (rebar) maths as an API, computed locally and deterministically. The area endpoint computes the cross-sectional area of a reinforcing bar, a = π/4·d², its mass per metre (a·7850/1e6, steel ρ = 7850 kg/m³), the total area and mass for a number of bars, and — given a required steel area — the number of bars needed and the area provided. The spacing endpoint lays out bars across a section: from the width, the cover, the bar diameter and either a centre-to-centre spacing or a bar count it returns the other, n = floor((width − 2·cover − d)/spacing) + 1, the total steel area and the area per metre of width. The ratio endpoint computes the reinforcement ratio ρ = As/(b·d) of a section from the steel area (or the bars) and the section width and effective depth, as a fraction and a percentage, the single number that governs whether a beam is under- or over-reinforced. Everything is computed locally and deterministically, so it is instant and private. Ideal for structural and site-engineering tools, reinforced-concrete detailing, bar-bending schedules and steel take-off, and civil-engineering education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is rebar geometry and quantities; for concrete mix proportions use a concrete 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/rebar-api/..."
```

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

## Endpoints

### Rebar

#### `GET /v1/area` — Bar area, mass & count

**Parameters:**
- `diameter` (query, required, string) — Bar diameter d (mm) Example: `16`
- `count` (query, optional, string) — Number of bars for the total Example: `5`
- `required_area` (query, optional, string) — Or a required steel area (mm²) to solve the count

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/rebar-api/v1/area?diameter=16&count=5"
```

**Response:**
```json
{
    "data": {
        "note": "Single bar area = π/4·d². Bar mass per metre = area·7850/1e6 (steel ρ = 7850 kg/m³).",
        "count": 5,
        "inputs": {
            "diameter": 16
        },
        "total_area_mm2": 1005.3096,
        "bar_mass_kg_per_m": 1.57834,
        "single_bar_area_mm2": 201.0619,
        "total_mass_kg_per_m": 7.89168
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:24.961Z",
        "request_id": "653210d4-620e-40a5-8028-1ef8a9fb4aaa"
    },
    "status": "ok",
    "message": "Bar area & count",
    "success": true
}
```

#### `GET /v1/ratio` — Reinforcement ratio

**Parameters:**
- `width` (query, required, string) — Section width b (mm) Example: `300`
- `effective_depth` (query, required, string) — Effective depth d (mm) Example: `450`
- `steel_area` (query, optional, string) — Steel area As (mm²) Example: `1005`
- `diameter` (query, optional, string) — Or bar diameter (mm) with count
- `count` (query, optional, string) — and number of bars

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/rebar-api/v1/ratio?width=300&effective_depth=450&steel_area=1005"
```

**Response:**
```json
{
    "data": {
        "note": "ρ = As/(b·d). Typical RC beams run 0.4–2 %; check against the code minimum (≈0.13 %) and maximum (≈4 %).",
        "inputs": {
            "width": 300,
            "steel_area_mm2": 1005,
            "effective_depth": 450
        },
        "gross_area_mm2": 135000,
        "reinforcement_ratio": 0.007444,
        "reinforcement_percent": 0.7444
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:25.079Z",
        "request_id": "72de68b0-3c64-4e21-8b69-feaa1959f098"
    },
    "status": "ok",
    "message": "Reinforcement ratio",
    "success": true
}
```

#### `GET /v1/spacing` — Section spacing layout

**Parameters:**
- `width` (query, required, string) — Section width (mm) Example: `1000`
- `diameter` (query, required, string) — Bar diameter d (mm) Example: `12`
- `cover` (query, optional, string) — Cover each side (mm, default 25) Example: `25`
- `spacing` (query, optional, string) — Centre-to-centre spacing (mm) to get the count Example: `150`
- `count` (query, optional, string) — Or a bar count to get the spacing

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/rebar-api/v1/spacing?width=1000&diameter=12&cover=25&spacing=150"
```

**Response:**
```json
{
    "data": {
        "note": "Outer bars sit at cover + ½d from each face; n = floor((width − 2·cover − d)/spacing) + 1.",
        "inputs": {
            "count": null,
            "cover": 25,
            "width": 1000,
            "spacing": 150,
            "diameter": 12
        },
        "spacing_mm": 150,
        "number_of_bars": 7,
        "total_area_mm2": 791.6813,
        "area_per_metre_mm2_m": 791.6813
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:25.181Z",
        "request_id": "1a8a6a1c-462a-409a-8365-df88acba3faa"
    },
    "status": "ok",
    "message": "Section spacing",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Diameters, widths and depths in mm, areas in mm², mass in kg/m. Steel density 7850 kg/m³. Geometry/quantity helper — not a coded structural design.",
        "service": "rebar-api",
        "formulae": {
            "count": "n = floor((b − 2·cover − d)/spacing) + 1",
            "ratio": "ρ = As/(b·d)",
            "bar_area": "a = π/4·d²",
            "bar_mass": "m = a·7850/1e6 (kg/m)"
        },
        "endpoints": {
            "GET /v1/area": "Single-bar area, total area and mass for N bars, or bars needed for a required area.",
            "GET /v1/meta": "This document.",
            "GET /v1/ratio": "Reinforcement ratio ρ = As/(b·d) for a section, as a fraction and a percentage.",
            "GET /v1/spacing": "Bars across a section width: spacing→count or count→spacing, with area per metre."
        },
        "description": "Reinforcement-steel (rebar) calculator: bar area and mass, bars needed for a required area, section spacing layout and reinforcement ratio."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:25.294Z",
        "request_id": "fed56c9a-a432-4f4e-90a8-d76ff4ce65f9"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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