# Moment of Inertia API
> Rigid-body rotational-inertia mechanics as an API, computed locally and deterministically. The shape endpoint returns the mass moment of inertia and the radius of gyration k = √(I/m) for a named standard body about its characteristic axis — a solid sphere (I = 2/5·m·r²), thin spherical shell (2/3·m·r²), solid cylinder or disk (1/2·m·r²), annular/hollow cylinder (1/2·m·(r1²+r2²)), thin ring (m·r²), thin rod about its centre (1/12·m·l²) or about one end (1/3·m·l²), rectangular plate or cuboid (1/12·m·(a²+b²)), solid cone (3/10·m·r²) and point mass (m·r²) — so a 2 kg solid sphere of radius 0.5 m has I = 0.2 kg·m². The parallel-axis endpoint applies the Steiner theorem I = I_cm + m·d² to shift a moment of inertia from the centre-of-mass axis to any parallel axis a distance d away. The shapes endpoint lists the whole catalog with its formulas. All quantities are SI (kg, m → kg·m²). Everything is computed locally and deterministically, so it is instant and private. Ideal for mechanical-engineering, robotics, CAD/CAE, rotating-machinery, structural-dynamics and physics-education app developers, flywheel-and-shaft design tools, and simulation software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is rotational inertia; for stored rotational energy and flywheel sizing use a flywheel API and for torque and angular acceleration a torque 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/momentofinertia-api/..."
```

## Pricing
- **Free** (Free) — 3,800 calls/Mo, 2 req/s
- **Starter** ($7/Mo) — 36,000 calls/Mo, 6 req/s
- **Pro** ($21/Mo) — 175,000 calls/Mo, 15 req/s
- **Mega** ($65/Mo) — 1,080,000 calls/Mo, 40 req/s

## Endpoints

### Inertia

#### `GET /v1/parallel-axis` — Parallel-axis (Steiner) theorem

**Parameters:**
- `i_cm` (query, required, string) — Moment about centre-of-mass axis (kg·m²) Example: `0.02`
- `mass` (query, required, string) — Mass (kg) Example: `1`
- `distance` (query, required, string) — Distance d to parallel axis (m) Example: `0.3`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/momentofinertia-api/v1/parallel-axis?i_cm=0.02&mass=1&distance=0.3"
```

**Response:**
```json
{
    "data": {
        "note": "Parallel-axis (Steiner) theorem: I = I_cm + m·d², where I_cm is the moment about the centre-of-mass axis and d is the perpendicular distance to the parallel axis.",
        "inputs": {
            "i_cm": 0.02,
            "mass": 1,
            "distance": 0.3
        },
        "shift_term": 0.09,
        "moment_of_inertia": 0.11
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:31.342Z",
        "request_id": "d2177c8d-c73c-4170-ba8c-1749d3615044"
    },
    "status": "ok",
    "message": "Parallel-axis theorem",
    "success": true
}
```

#### `GET /v1/shape` — Moment of inertia of a shape

**Parameters:**
- `shape` (query, required, string) — Shape name (see /v1/shapes) Example: `solid_sphere`
- `mass` (query, required, string) — Mass (kg) Example: `2`
- `r` (query, optional, string) — Radius (m) Example: `0.5`
- `l` (query, optional, string) — Length (m)
- `a` (query, optional, string) — Side a (m)
- `b` (query, optional, string) — Side b (m)
- `r1` (query, optional, string) — Inner radius (m)
- `r2` (query, optional, string) — Outer radius (m)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/momentofinertia-api/v1/shape?shape=solid_sphere&mass=2&r=0.5"
```

**Response:**
```json
{
    "data": {
        "note": "Moment of inertia in kg·m². Radius of gyration k = √(I/m). Use /v1/parallel-axis to shift to a parallel axis.",
        "inputs": {
            "r": 0.5,
            "mass": 2,
            "shape": "solid_sphere"
        },
        "formula": "I = 2/5·m·r²",
        "moment_of_inertia": 0.2,
        "radius_of_gyration": 0.316227766
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:31.470Z",
        "request_id": "3a9e243d-8d2e-4064-8716-34a45c5bf11b"
    },
    "status": "ok",
    "message": "Moment of inertia of a shape",
    "success": true
}
```

#### `GET /v1/shapes` — Shape catalog

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

**Response:**
```json
{
    "data": {
        "note": "All masses in kg, all lengths/radii in m, result in kg·m². Pass shape + mass + the listed params to /v1/shape.",
        "count": 12,
        "shapes": {
            "rod_end": {
                "params": [
                    "mass",
                    "l"
                ],
                "formula": "I = 1/3·m·l² (thin rod about one end, ⊥)"
            },
            "thin_ring": {
                "params": [
                    "mass",
                    "r"
                ],
                "formula": "I = m·r² (hoop about central axis)"
            },
            "point_mass": {
                "params": [
                    "mass",
                    "r"
                ],
                "formula": "I = m·r² (point mass at distance r)"
            },
            "rod_center": {
                "params": [
                    "mass",
                    "l"
                ],
                "formula": "I = 1/12·m·l² (thin rod about centre, ⊥)"
            },
            "solid_cone": {
                "params": [
                    "mass",
                    "r"
                ],
                "formula": "I = 3/10·m·r² (about central axis)"
            },
            "solid_disk": {
                "params": [
                    "mass",
                    "r"
                ],
                "formula": "I = 1/2·m·r² (about central axis)"
            },
            "solid_cuboid": {
                "
…(truncated, see openapi.json for full schema)
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "SI units (kg, m → kg·m²). This is rigid-body rotational inertia; for stored rotational energy and flywheels use a flywheel API.",
        "service": "momentofinertia-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/shape": "Moment of inertia and radius of gyration for a named shape.",
            "GET /v1/shapes": "Catalog of supported shapes and their formulas.",
            "GET /v1/parallel-axis": "Shift a moment of inertia to a parallel axis (I = I_cm + m·d²)."
        },
        "description": "Moment of inertia of standard rigid bodies, the parallel-axis (Steiner) theorem, and the radius of gyration."
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:31.653Z",
        "request_id": "bdd61033-9366-4537-a65a-d67c36e37e9c"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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