# Bernoulli Flow API
> Bernoulli and incompressible-flow maths as an API, computed locally and deterministically. The bernoulli endpoint applies Bernoulli's principle, P + ½ρv² + ρgh = constant along a streamline, taking the pressure, velocity and height at one point and solving the unknown pressure or velocity at a second point, and reporting the total head pressure. The dynamic-pressure endpoint computes the dynamic pressure q = ½ρv² from a velocity, or — the pitot-tube relation — the airspeed v = √(2q/ρ) from a measured dynamic pressure, plus the stagnation (total) pressure when a static pressure is supplied. The venturi endpoint computes the flow rate and inlet and throat velocities of a venturi or contraction from the inlet and throat areas and the pressure drop, Q = Cd·A₂·√(2ΔP/(ρ(1−(A₂/A₁)²))), combining continuity with Bernoulli, with an optional discharge coefficient. Density is taken from a value or a named fluid (air, water, seawater, oil). Everything is computed locally and deterministically, so it is instant and private. Ideal for aerospace, HVAC, plumbing, process and hydraulics app developers, airspeed and flow-meter tools, and fluid-mechanics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is Bernoulli/streamline flow; for pipe friction head loss use a Darcy API and for orifice metering an orifice 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/bernoulli-api/..."
```

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

## Endpoints

### Bernoulli

#### `GET /v1/bernoulli` — Bernoulli streamline

**Parameters:**
- `p1` (query, required, string) — Pressure at point 1 (Pa) Example: `101325`
- `v1` (query, required, string) — Velocity at point 1 (m/s) Example: `10`
- `h1` (query, optional, string) — Height at point 1 (m) Example: `0`
- `v2` (query, optional, string) — Velocity at point 2 (to solve p2) Example: `20`
- `p2` (query, optional, string) — Or pressure at point 2 (to solve v2)
- `h2` (query, optional, string) — Height at point 2 (m) Example: `0`
- `fluid` (query, optional, string) — Fluid (air, water, seawater, oil) Example: `air`
- `density` (query, optional, string) — Or density (kg/m³)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bernoulli-api/v1/bernoulli?p1=101325&v1=10&h1=0&v2=20&h2=0&fluid=air"
```

**Response:**
```json
{
    "data": {
        "h2_m": 0,
        "note": "Bernoulli (incompressible, frictionless): P + ½ρv² + ρgh is constant along a streamline.",
        "p2_pa": 101141.25,
        "v2_ms": 20,
        "inputs": {
            "point1": {
                "h1": 0,
                "p1": 101325,
                "v1": 10
            },
            "density_kg_m3": 1.225,
            "density_source": "air"
        },
        "solved_for": "p2",
        "total_pressure_pa": 101386.25
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:06.183Z",
        "request_id": "7a4748f0-d09c-4b05-9e1e-ae560a0f8894"
    },
    "status": "ok",
    "message": "Bernoulli",
    "success": true
}
```

#### `GET /v1/dynamic-pressure` — Dynamic & pitot

**Parameters:**
- `velocity` (query, optional, string) — Velocity (m/s) Example: `50`
- `dynamic_pressure` (query, optional, string) — Or dynamic pressure (Pa) for airspeed
- `static_pressure` (query, optional, string) — Static pressure (Pa) for stagnation
- `fluid` (query, optional, string) — Fluid (air, water, ...) Example: `air`
- `density` (query, optional, string) — Or density (kg/m³)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bernoulli-api/v1/dynamic-pressure?velocity=50&fluid=air"
```

**Response:**
```json
{
    "data": {
        "note": "Dynamic pressure q = ½ρv²; airspeed v = √(2q/ρ). Stagnation (total) pressure = static + dynamic.",
        "inputs": {
            "density_kg_m3": 1.225,
            "density_source": "air"
        },
        "velocity_ms": 50,
        "velocity_kmh": 180,
        "dynamic_pressure_pa": 1531.25
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:06.310Z",
        "request_id": "129bf1b7-21ae-4b04-aa06-1d08b829311c"
    },
    "status": "ok",
    "message": "Dynamic pressure",
    "success": true
}
```

#### `GET /v1/venturi` — Venturi flow

**Parameters:**
- `area1` (query, required, string) — Inlet area (m²) Example: `0.01`
- `area2` (query, required, string) — Throat area (m²) Example: `0.005`
- `pressure_drop` (query, required, string) — Pressure drop (Pa) Example: `1000`
- `discharge_coefficient` (query, optional, string) — Discharge coefficient Cd Example: `0.98`
- `fluid` (query, optional, string) — Fluid (water, air, ...) Example: `water`
- `density` (query, optional, string) — Or density (kg/m³)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/bernoulli-api/v1/venturi?area1=0.01&area2=0.005&pressure_drop=1000&discharge_coefficient=0.98&fluid=water"
```

**Response:**
```json
{
    "data": {
        "note": "Venturi: Q = Cd·A₂·√(2ΔP/(ρ(1−(A₂/A₁)²))) from continuity and Bernoulli. Cd defaults to 1 (ideal).",
        "inputs": {
            "area1_m2": 0.01,
            "area2_m2": 0.005,
            "density_kg_m3": 1000,
            "density_source": "water",
            "pressure_drop_pa": 1000,
            "discharge_coefficient": 0.98
        },
        "area_ratio": 0.5,
        "mass_flow_kgs": 8.001666,
        "inlet_velocity_ms": 0.800167,
        "throat_velocity_ms": 1.632993,
        "volumetric_flow_lpm": 480.09999,
        "volumetric_flow_m3s": 0.008001666
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:06.406Z",
        "request_id": "3f806ff3-3df7-496c-9746-442ce4d74112"
    },
    "status": "ok",
    "message": "Venturi flow",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "SI units: pressure Pa, velocity m/s, height m, area m². Density via 'density' (kg/m³) or 'fluid' (air, water, seawater, oil); defaults to water. Incompressible, frictionless.",
        "service": "bernoulli-api",
        "formulae": {
            "pitot": "v = √(2q/ρ)",
            "venturi": "Q = Cd·A₂·√(2ΔP/(ρ(1−(A₂/A₁)²)))",
            "bernoulli": "P + ½ρv² + ρgh = constant",
            "dynamic_pressure": "q = ½ρv²"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/venturi": "Venturi/contraction flow rate and velocities from areas and a pressure drop.",
            "GET /v1/bernoulli": "Solve the unknown pressure or velocity at a second point on a streamline.",
            "GET /v1/dynamic-pressure": "Dynamic pressure from velocity, or pitot airspeed from dynamic pressure."
        },
        "description": "Bernoulli and incompressible-flow calculator: solve pressure/velocity/height along a streamline, dynamic and stagnation pressure (pitot airspeed), and venturi flow rate from a pressure drop."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:06.498Z",
        "request_id": "c3063ffc-da68-470c-8741-f7a3cff12c1f"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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