# Vehicle Braking API
> Vehicle-braking physics as an API, computed locally and deterministically. The stopping-distance endpoint computes the total distance to stop a vehicle as the sum of the reaction distance the vehicle travels during the driver's reaction time, v·t, and the braking distance v²/(2·μ·g) — which grows with the square of speed, so doubling the speed quadruples the braking distance — from the speed, the tyre-road friction coefficient, the reaction time and the road grade, along with the deceleration and the time to stop. The braking-force endpoint computes the braking force F = m·a and the deceleration of a vehicle, either from a stop-in-a-given-distance (a = v²/2d) or from the friction coefficient (a = μ·g), with the kinetic energy that must be dissipated as heat. The skid-speed endpoint reconstructs the speed at the start of a skid from the skid-mark length, v = √(2·μ·g·d), a lower-bound estimate used in accident reconstruction. Speed is in km/h by default (also m/s or mph), mass in kg and distances in m; dry asphalt has μ ≈ 0.7, wet ≈ 0.4 and ice ≈ 0.1. Everything is computed locally and deterministically, so it is instant and private. Ideal for automotive, driving-safety, fleet, telematics and accident-reconstruction app developers, stopping-distance and forensic tools, and physics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is vehicle braking; for general kinematics use a kinematics API and for an object on a slope an inclined-plane 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/brake-api/..."
```

## Pricing
- **Free** (Free) — 4,000 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 45,000 calls/Mo, 6 req/s
- **Pro** ($14/Mo) — 228,000 calls/Mo, 15 req/s
- **Mega** ($45/Mo) — 1,330,000 calls/Mo, 40 req/s

## Endpoints

### Brake

#### `GET /v1/braking-force` — Braking force

**Parameters:**
- `mass` (query, required, string) — Vehicle mass (kg) Example: `1500`
- `speed` (query, optional, string) — Speed Example: `27.78`
- `unit` (query, optional, string) — kmh, ms or mph Example: `ms`
- `distance` (query, optional, string) — Braking distance (m) Example: `56.2`
- `friction_coefficient` (query, optional, string) — Tyre-road μ

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/brake-api/v1/braking-force?mass=1500&speed=27.78&unit=ms&distance=56.2"
```

**Response:**
```json
{
    "data": {
        "note": "Braking force F = m·a. The deceleration comes from the stop-in-distance (a = v²/2d) or from the tyre-road friction (a = μ·g). The kinetic energy is dissipated as heat in the brakes.",
        "inputs": {
            "mass_kg": 1500,
            "speed_ms": 27.78,
            "distance_m": 56.2,
            "friction_coefficient": null
        },
        "deceleration_g": 0.7001,
        "braking_force_n": 10298.8665,
        "deceleration_ms2": 6.8659,
        "kinetic_energy_j": 578796.3
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:27.046Z",
        "request_id": "49e02f28-e78b-4d1b-9290-978616535125"
    },
    "status": "ok",
    "message": "Braking force",
    "success": true
}
```

#### `GET /v1/skid-speed` — Speed from skid

**Parameters:**
- `skid_length` (query, required, string) — Skid-mark length (m) Example: `56.2`
- `friction_coefficient` (query, optional, string) — Tyre-road μ Example: `0.7`
- `grade` (query, optional, string) — Road grade (fraction) Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/brake-api/v1/skid-speed?skid_length=56.2&friction_coefficient=0.7&grade=0"
```

**Response:**
```json
{
    "data": {
        "note": "Minimum speed from a skid: v = √(2·μ·g·d). This is the speed at the start of the skid, a lower bound on the actual speed before braking began.",
        "inputs": {
            "grade": 0,
            "skid_length_m": 56.2,
            "friction_coefficient": 0.7
        },
        "speed_ms": 27.7775,
        "speed_kmh": 99.9989,
        "speed_mph": 62.1364
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:27.151Z",
        "request_id": "3008d484-fffd-47c8-8653-8eef6375746f"
    },
    "status": "ok",
    "message": "Speed from skid",
    "success": true
}
```

#### `GET /v1/stopping-distance` — Stopping distance

**Parameters:**
- `speed` (query, required, string) — Speed Example: `100`
- `unit` (query, optional, string) — kmh, ms or mph Example: `kmh`
- `friction_coefficient` (query, optional, string) — Tyre-road μ Example: `0.7`
- `reaction_time` (query, optional, string) — Reaction time (s) Example: `1.5`
- `grade` (query, optional, string) — Road grade (fraction) Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/brake-api/v1/stopping-distance?speed=100&unit=kmh&friction_coefficient=0.7&reaction_time=1.5&grade=0"
```

**Response:**
```json
{
    "data": {
        "note": "Total = reaction distance (v·t) + braking distance (v²/(2·μ·g)). Braking distance grows with the square of speed, so doubling speed quadruples it.",
        "inputs": {
            "grade": 0,
            "speed_ms": 27.7778,
            "reaction_time": 1.5,
            "friction_coefficient": 0.7
        },
        "deceleration_g": 0.7,
        "time_to_stop_s": 4.0465,
        "deceleration_ms2": 6.8647,
        "braking_distance_m": 56.2013,
        "reaction_distance_m": 41.6667,
        "total_stopping_distance_m": 97.868
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:27.244Z",
        "request_id": "f2e024e3-c415-4fd2-887a-1a76106bc345"
    },
    "status": "ok",
    "message": "Stopping distance",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Speed in km/h by default (unit: kmh, ms or mph), mass in kg, distances in m, friction coefficient ~0.7 dry asphalt / ~0.4 wet / ~0.1 ice. Grade is the fractional road slope (positive uphill).",
        "service": "brake-api",
        "formulae": {
            "skid_speed": "v = √(2·μ·g·d)",
            "braking_distance": "d = v²/(2·μ·g)",
            "stopping_distance": "reaction (v·t) + braking"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/skid-speed": "Speed at the start of a skid from the skid-mark length (accident reconstruction).",
            "GET /v1/braking-force": "Braking force and deceleration from mass and either stop distance or friction.",
            "GET /v1/stopping-distance": "Reaction, braking and total stopping distance from speed, friction and reaction time."
        },
        "description": "Vehicle-braking calculator: total stopping distance (reaction + braking), braking force and deceleration, and the speed implied by a skid-mark length."
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:27.365Z",
        "request_id": "89a61d08-2e9c-4af6-9c06-a663a544c6a7"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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