# Lever & Simple Machine API
> Lever, moment-balance and simple-machine mechanical-advantage maths as an API, computed locally and deterministically. The lever endpoint applies the lever law, effort·effort_arm = load·load_arm, and solves for whichever of the effort, the load, the effort arm or the load arm you leave out, returning the mechanical advantage MA = effort_arm/load_arm = load/effort and whether the lever multiplies force or speed. The moment endpoint computes a single moment of force, M = F·d, or balances a seesaw about a pivot: from the force and distance on each side it tells you whether it is balanced, the net moment and which way it rotates, or solves the one value you omit to bring it into equilibrium. The machine endpoint gives the ideal mechanical advantage of a simple machine — an inclined plane (length/height), a screw (2πR/pitch), a wheel and axle (R/r), a wedge (length/thickness) or a pulley system (number of supporting strands) — and, given an efficiency and an effort, the actual mechanical advantage and the output force. Everything is computed locally and deterministically, so it is instant and private. Ideal for physics and engineering-education tools, mechanics and statics apps, and machine-design and DIY calculators. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is levers and simple-machine mechanical advantage; for gear and belt drive ratios use a gear or belt-drive 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/lever-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($8/Mo) — 40,000 calls/Mo, 5 req/s
- **Pro** ($22/Mo) — 250,000 calls/Mo, 20 req/s
- **Mega** ($69/Mo) — 1,500,000 calls/Mo, 60 req/s

## Endpoints

### Lever

#### `GET /v1/lever` — Lever law & mechanical advantage

**Parameters:**
- `load` (query, optional, string) — Load force Example: `100`
- `effort` (query, optional, string) — Effort force
- `effort_arm` (query, optional, string) — Effort arm (distance to fulcrum) Example: `2`
- `load_arm` (query, optional, string) — Load arm (distance to fulcrum) Example: `0.5`
- `class` (query, optional, string) — Lever class 1|2|3 (optional label)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lever-api/v1/lever?load=100&effort_arm=2&load_arm=0.5"
```

**Response:**
```json
{
    "data": {
        "formula": "effort·effort_arm = load·load_arm; MA = effort_arm/load_arm = load/effort.",
        "load_arm": 0.5,
        "effort_arm": 2,
        "load_force": 100,
        "effort_force": 25,
        "advantage_type": "force multiplier (MA > 1)",
        "mechanical_advantage": 4
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:48.639Z",
        "request_id": "ab4bf347-75a6-4f25-81ee-4ac2d8cc02ba"
    },
    "status": "ok",
    "message": "Lever law & mechanical advantage",
    "success": true
}
```

#### `GET /v1/machine` — Simple-machine mechanical advantage

**Parameters:**
- `machine` (query, required, string) — inclined_plane|screw|wheel_and_axle|wedge|pulley Example: `inclined_plane`
- `length` (query, optional, string) — Length (inclined plane / wedge) Example: `5`
- `height` (query, optional, string) — Height (inclined plane) Example: `1`
- `handle_radius` (query, optional, string) — Handle radius (screw)
- `pitch` (query, optional, string) — Pitch (screw)
- `wheel_radius` (query, optional, string) — Wheel radius (wheel & axle)
- `axle_radius` (query, optional, string) — Axle radius (wheel & axle)
- `supporting_strands` (query, optional, string) — Supporting strands (pulley)
- `efficiency` (query, optional, string) — Efficiency 0–1 for actual MA
- `effort` (query, optional, string) — Effort force for output force

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lever-api/v1/machine?machine=inclined_plane&length=5&height=1"
```

**Response:**
```json
{
    "data": {
        "height": 1,
        "length": 5,
        "formula": "inclined plane L/h; screw 2πR/pitch; wheel&axle R/r; wedge L/t; pulley = supporting strands.",
        "machine": "inclined_plane",
        "ideal_mechanical_advantage": 5
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:48.743Z",
        "request_id": "bab1c24c-2161-4a31-a3db-d645c67f2649"
    },
    "status": "ok",
    "message": "Simple-machine mechanical advantage",
    "success": true
}
```

#### `GET /v1/moment` — Moment / seesaw balance

**Parameters:**
- `force` (query, optional, string) — Force for a single moment M=F·d Example: `50`
- `distance` (query, optional, string) — Distance (moment arm) Example: `0.3`
- `left_force` (query, optional, string) — Left-side force (for balance)
- `left_distance` (query, optional, string) — Left-side distance
- `right_force` (query, optional, string) — Right-side force (omit one to solve)
- `right_distance` (query, optional, string) — Right-side distance

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lever-api/v1/moment?force=50&distance=0.3"
```

**Response:**
```json
{
    "data": {
        "mode": "single_moment",
        "force": 50,
        "formula": "M = F · d.",
        "distance": 0.3,
        "moment_nm": 15
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:48.859Z",
        "request_id": "8d0cd80f-8364-45bb-a626-5f2a1346a989"
    },
    "status": "ok",
    "message": "Moment / seesaw balance",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "api": "lever",
        "note": "Lever, moment balance and simple-machine mechanical advantage — computed locally and deterministically, no key, no third-party service.",
        "machines": [
            "inclined_plane",
            "screw",
            "wheel_and_axle",
            "wedge",
            "pulley"
        ],
        "endpoints": [
            "/v1/lever",
            "/v1/moment",
            "/v1/machine",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:48.965Z",
        "request_id": "4c503013-976c-4af1-8d46-e2af5453d900"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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