# Mach Number API
> Mach-number and compressible-flow aerodynamics as an API, computed locally and deterministically. The mach endpoint computes the local speed of sound a = √(γ·R·T) (air γ = 1.4, R = 287.05 J/(kg·K)) and the Mach number M = v/a from a speed and a static temperature — given directly in °C or kelvin, or derived from a geopotential altitude through the International Standard Atmosphere (troposphere T = 288.15 − 0.0065·h up to 11 km, then the isothermal 216.65 K layer to 20 km) — and classifies the flight regime as subsonic, transonic, supersonic or hypersonic; the speed of sound is about 340.3 m/s at 15 °C and 295 m/s at 11 km. The speed endpoint inverts it, returning v = M·a in m/s, km/h and knots. The stagnation endpoint gives the isentropic total-to-static ratios T0/T = 1 + (γ−1)/2·M², P0/P = (T0/T)^(γ/(γ−1)) and ρ0/ρ = (T0/T)^(1/(γ−1)) — at Mach 2 the total pressure is about 7.82 times the static pressure — and will scale a supplied static temperature and pressure to their stagnation values. Everything is computed locally and deterministically, so it is instant and private. Ideal for aerospace, CFD, flight-simulation, wind-tunnel, UAV and aerodynamics-education app developers, compressible-flow and flight-envelope tools, and engineering software. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is compressible aerodynamics; for viscous flow and the Reynolds number use a Reynolds API and for incompressible pressure/velocity a Bernoulli 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/machnumber-api/..."
```

## Pricing
- **Free** (Free) — 4,100 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 41,000 calls/Mo, 6 req/s
- **Pro** ($17/Mo) — 198,000 calls/Mo, 15 req/s
- **Mega** ($52/Mo) — 1,160,000 calls/Mo, 40 req/s

## Endpoints

### Mach

#### `GET /v1/mach` — Mach number & speed of sound

**Parameters:**
- `speed` (query, required, string) — Speed (m/s) Example: `680`
- `temperature` (query, optional, string) — Static temperature (°C) Example: `15`
- `temperature_k` (query, optional, string) — Static temperature (K)
- `altitude` (query, optional, string) — ISA geopotential altitude (m)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/machnumber-api/v1/mach?speed=680&temperature=15"
```

**Response:**
```json
{
    "data": {
        "note": "a = √(γ·R·T) with γ=1.4, R=287.05 J/(kg·K); M = v/a. Pass temperature (°C), temperature_k, or altitude (m, ISA). Speed of sound at 15 °C is ≈340.3 m/s.",
        "inputs": {
            "speed": 680,
            "temperature_source": "temperature_c"
        },
        "regime": "supersonic",
        "mach_number": 1.998282,
        "temperature_k": 288.15,
        "speed_of_sound_ms": 340.292287
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:29.835Z",
        "request_id": "8a312df3-e54d-4695-91fa-b3362eb8c159"
    },
    "status": "ok",
    "message": "Mach number",
    "success": true
}
```

#### `GET /v1/speed` — Speed from Mach number

**Parameters:**
- `mach` (query, required, string) — Mach number Example: `2`
- `temperature` (query, optional, string) — Static temperature (°C) Example: `15`
- `temperature_k` (query, optional, string) — Static temperature (K)
- `altitude` (query, optional, string) — ISA altitude (m)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/machnumber-api/v1/speed?mach=2&temperature=15"
```

**Response:**
```json
{
    "data": {
        "note": "v = M·a. Speed returned in m/s, km/h and knots.",
        "inputs": {
            "mach": 2,
            "temperature_source": "temperature_c"
        },
        "regime": "supersonic",
        "speed_ms": 680.584574,
        "speed_kmh": 2450.1045,
        "speed_knots": 1322.9517,
        "temperature_k": 288.15,
        "speed_of_sound_ms": 340.292287
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:29.907Z",
        "request_id": "78110819-ef16-4d77-8409-2e8a87c40cf3"
    },
    "status": "ok",
    "message": "Speed from Mach",
    "success": true
}
```

#### `GET /v1/stagnation` — Isentropic stagnation ratios

**Parameters:**
- `mach` (query, required, string) — Mach number Example: `2`
- `gamma` (query, optional, string) — Heat-capacity ratio γ (default 1.4)
- `static_temperature` (query, optional, string) — Static T (°C) to scale
- `static_pressure` (query, optional, string) — Static pressure to scale

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/machnumber-api/v1/stagnation?mach=2"
```

**Response:**
```json
{
    "data": {
        "note": "Isentropic compressible flow: T0/T = 1+(γ−1)/2·M², P0/P = (T0/T)^(γ/(γ−1)), ρ0/ρ = (T0/T)^(1/(γ−1)). At M=2 (γ=1.4): T0/T=1.8, P0/P≈7.824.",
        "inputs": {
            "mach": 2,
            "gamma": 1.4
        },
        "p0_over_p": 7.82444907,
        "t0_over_t": 1.8,
        "rho0_over_rho": 4.34691615
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:29.981Z",
        "request_id": "b5fcf276-ee0b-44aa-ba86-29d1e77876e9"
    },
    "status": "ok",
    "message": "Isentropic stagnation ratios",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Air γ=1.4, R=287.05 J/(kg·K). Temperature via temperature (°C), temperature_k, or ISA altitude (m, 0–20 km). This is compressible aerodynamics; for viscous flow use a Reynolds-number API and for incompressible pressure/velocity a Bernoulli API.",
        "service": "machnumber-api",
        "constants": {
            "gamma_air": 1.4,
            "specific_gas_constant": 287.05
        },
        "endpoints": {
            "GET /v1/mach": "Mach number and speed of sound from a speed and temperature/altitude.",
            "GET /v1/meta": "This document.",
            "GET /v1/speed": "Speed (m/s, km/h, knots) from a Mach number and temperature/altitude.",
            "GET /v1/stagnation": "Isentropic total/static temperature, pressure and density ratios for a Mach number."
        },
        "description": "Mach number and compressible-flow aerodynamics: speed of sound, flight regime, ISA altitude, and isentropic stagnation ratios."
    },
    "meta": {
        "timestamp": "2026-06-05T19:50:30.050Z",
        "request_id": "02ab9055-15bd-48b3-89d9-204f1522704e"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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