# Hydrostatic Pressure API
> Fluid-statics maths as an API, computed locally and deterministically. The pressure endpoint computes the pressure at a depth in a fluid — the gauge pressure ρ·g·h and the absolute pressure (gauge plus atmospheric) — in pascals, kilopascals, bar, psi and atmospheres, for water, seawater, oil, mercury and more, or a custom density; depths accept metres, feet or centimetres, which makes it handy for diving (about 10 m of seawater adds one atmosphere). The force endpoint computes the resultant hydrostatic force on a submerged vertical rectangular surface — an aquarium wall, a tank side, a dam face or a flood gate — as F = ρ·g·h_c·A from its width and the top and bottom depths, and gives the depth of the centre of pressure, which sits below the centroid. The buoyancy endpoint applies Archimedes' principle, F_b = ρ_fluid·g·V, to give the buoyant force and the displaced mass, and — if you supply the object's density or mass — tells you whether it floats or sinks and what fraction sits below the waterline. Everything is computed locally and deterministically, so it is instant and private. Ideal for civil and marine engineering tools, diving and aquarium apps, tank and dam design, and physics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is fluid statics; for pump power and head use a pump API and for pipe flow rate use a pipe-flow 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/hydrostatic-api/..."
```

## Pricing
- **Free** (Free) — 3,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 40,000 calls/Mo, 6 req/s
- **Pro** ($24/Mo) — 300,000 calls/Mo, 20 req/s
- **Mega** ($75/Mo) — 2,500,000 calls/Mo, 60 req/s

## Endpoints

### Hydrostatic

#### `GET /v1/buoyancy` — Buoyancy & flotation

**Parameters:**
- `volume` (query, required, string) — Displaced volume (m³) Example: `0.01`
- `fluid` (query, optional, string) — Fluid (default water) Example: `water`
- `density` (query, optional, string) — Or explicit fluid density
- `object_density` (query, optional, string) — Object density (for flotation) Example: `500`
- `mass` (query, optional, string) — Or object mass (kg)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hydrostatic-api/v1/buoyancy?volume=0.01&fluid=water&object_density=500"
```

**Response:**
```json
{
    "data": {
        "note": "Buoyant force = ρ_fluid·g·V_displaced (Archimedes).",
        "fluid": "water",
        "floats": true,
        "volume_m3": 0.01,
        "buoyant_force": {
            "N": 98.067,
            "kN": 0.09807,
            "kgf": 10
        },
        "object_weight_N": 49.033,
        "displaced_mass_kg": 10,
        "submerged_percent": 50,
        "submerged_fraction": 0.5,
        "fluid_density_kg_m3": 1000
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:04.529Z",
        "request_id": "c5a661a2-f687-401f-b8f6-2eae872ed2fd"
    },
    "status": "ok",
    "message": "Buoyancy & flotation",
    "success": true
}
```

#### `GET /v1/force` — Force on a submerged wall

**Parameters:**
- `width` (query, required, string) — Width of the surface Example: `3`
- `height` (query, optional, string) — Height (surface starts at top_depth) Example: `2`
- `top_depth` (query, optional, string) — Depth of the top edge (default 0) Example: `0`
- `bottom_depth` (query, optional, string) — Or depth of the bottom edge
- `fluid` (query, optional, string) — Fluid (default water) Example: `water`
- `density` (query, optional, string) — Or explicit density

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hydrostatic-api/v1/force?width=3&height=2&top_depth=0&fluid=water"
```

**Response:**
```json
{
    "data": {
        "note": "F = ρ·g·hc·A on a vertical surface; hc = centroid depth. Centre of pressure is below the centroid by I/(hc·A).",
        "fluid": "water",
        "width_m": 3,
        "top_depth_m": 0,
        "density_kg_m3": 1000,
        "bottom_depth_m": 2,
        "resultant_force": {
            "N": 58839.9,
            "kN": 58.8399,
            "kgf": 6000
        },
        "surface_area_m2": 6,
        "centroid_depth_m": 1,
        "center_of_pressure_depth_m": 1.3333
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:04.632Z",
        "request_id": "48ed1ee7-be54-49f9-9b95-b18970e96919"
    },
    "status": "ok",
    "message": "Hydrostatic force on a wall",
    "success": true
}
```

#### `GET /v1/pressure` — Pressure at depth

**Parameters:**
- `depth` (query, required, string) — Depth Example: `10`
- `depth_unit` (query, optional, string) — m|ft|cm (default m) Example: `m`
- `fluid` (query, optional, string) — water|seawater|oil|mercury|… (default water) Example: `water`
- `density` (query, optional, string) — Or explicit density (kg/m³)
- `atmospheric_pa` (query, optional, string) — Atmospheric pressure (default 101325)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hydrostatic-api/v1/pressure?depth=10&depth_unit=m&fluid=water"
```

**Response:**
```json
{
    "data": {
        "note": "Gauge pressure = ρ·g·h. Absolute = gauge + atmospheric (101325 Pa default). For diving, ~10 m of seawater adds about 1 atm.",
        "fluid": "water",
        "depth_m": 10,
        "density_kg_m3": 1000,
        "gauge_pressure": {
            "pa": 98066.5,
            "atm": 0.96784,
            "bar": 0.98067,
            "kpa": 98.0665,
            "psi": 14.2233
        },
        "head_m_of_fluid": 10,
        "absolute_pressure": {
            "pa": 199391.5,
            "atm": 1.96784,
            "bar": 1.99392,
            "kpa": 199.3915,
            "psi": 28.9193
        }
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:04.732Z",
        "request_id": "012a046c-15b0-44e0-88d4-5083fbd070b9"
    },
    "status": "ok",
    "message": "Pressure at depth",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "api": "hydrostatic",
        "note": "Fluid-statics maths — computed locally and deterministically, no key, no third-party service.",
        "fluids": [
            "water",
            "freshwater",
            "seawater",
            "saltwater",
            "oil",
            "diesel",
            "gasoline",
            "petrol",
            "ethanol",
            "mercury",
            "glycerin",
            "glycol",
            "milk",
            "honey"
        ],
        "endpoints": [
            "/v1/pressure",
            "/v1/force",
            "/v1/buoyancy",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:04.805Z",
        "request_id": "817b3c07-ed24-4956-b8ee-720b6c66aacf"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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