# Capillary & Surface Tension API
> Surface-tension and small-scale fluid-physics maths as an API, computed locally and deterministically. The capillary-rise endpoint applies Jurin's law, h = 2γ·cosθ / (ρ·g·r), to give the height a liquid climbs (or, for a contact angle above 90° like mercury, is depressed) in a narrow tube from its surface tension, the tube radius, the liquid density and the contact angle — and can solve the surface tension back from a measured rise. The laplace-pressure endpoint computes the Young-Laplace excess pressure across a curved interface: a liquid droplet ΔP = 2γ/r, a soap bubble ΔP = 4γ/r (two surfaces) and a cylindrical jet ΔP = γ/r. The poiseuille endpoint applies the Hagen-Poiseuille law, Q = π·r⁴·ΔP / (8·μ·L), for laminar flow in a pipe, returning the volumetric flow rate, the average velocity and the peak centreline velocity (twice the average) from the radius, the pressure drop, the fluid viscosity and the length. Surface tension is in N/m, lengths in m, density in kg/m³, viscosity in Pa·s and pressures in Pa; water is γ ≈ 0.0728 N/m at 20 °C. Everything is computed locally and deterministically, so it is instant and private. Ideal for microfluidics, fluid-engineering, lab-on-a-chip, inkjet and coating app developers, capillary-action and wicking tools, and physics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is surface tension and capillarity; for incompressible Bernoulli flow use a Bernoulli API and for pipe friction a Darcy 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/capillary-api/..."
```

## Pricing
- **Free** (Free) — 2,500 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 50,000 calls/Mo, 6 req/s
- **Pro** ($25/Mo) — 350,000 calls/Mo, 15 req/s
- **Mega** ($69/Mo) — 2,000,000 calls/Mo, 40 req/s

## Endpoints

### Capillary

#### `GET /v1/capillary-rise` — Capillary rise

**Parameters:**
- `surface_tension` (query, required, string) — Surface tension γ (N/m) Example: `0.0728`
- `radius` (query, required, string) — Tube radius (m) Example: `0.0005`
- `density` (query, optional, string) — Liquid density (kg/m³) Example: `1000`
- `contact_angle` (query, optional, string) — Contact angle (deg) Example: `0`
- `gravity` (query, optional, string) — Gravity (m/s²) Example: `9.80665`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/capillary-api/v1/capillary-rise?surface_tension=0.0728&radius=0.0005&density=1000&contact_angle=0&gravity=9.80665"
```

**Response:**
```json
{
    "data": {
        "note": "Jurin's law: h = 2γ·cosθ / (ρ·g·r). A contact angle above 90° (e.g. mercury) gives a depression.",
        "inputs": {
            "radius_m": 0.0005,
            "gravity_ms2": 9.80665,
            "density_kg_m3": 1000,
            "contact_angle_deg": 0,
            "surface_tension_n_m": 0.0728
        },
        "direction": "rise (wetting, θ < 90°)",
        "capillary_rise_m": 0.029694136,
        "capillary_rise_mm": 29.694136
    },
    "meta": {
        "timestamp": "2026-06-05T03:08:57.906Z",
        "request_id": "5eb93a61-bfc5-40d0-bdbc-dd1066305296"
    },
    "status": "ok",
    "message": "Capillary rise",
    "success": true
}
```

#### `GET /v1/laplace-pressure` — Young-Laplace pressure

**Parameters:**
- `surface_tension` (query, required, string) — Surface tension γ (N/m) Example: `0.0728`
- `radius` (query, required, string) — Radius (m) Example: `0.001`
- `shape` (query, optional, string) — droplet, bubble or cylinder Example: `droplet`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/capillary-api/v1/laplace-pressure?surface_tension=0.0728&radius=0.001&shape=droplet"
```

**Response:**
```json
{
    "data": {
        "note": "Young-Laplace: a liquid droplet ΔP = 2γ/r; a soap bubble has two surfaces so ΔP = 4γ/r; a cylindrical jet ΔP = γ/r.",
        "inputs": {
            "shape": "droplet",
            "radius_m": 0.001,
            "surface_tension_n_m": 0.0728
        },
        "formula_factor": 2,
        "excess_pressure_pa": 145.6,
        "excess_pressure_kpa": 0.1456
    },
    "meta": {
        "timestamp": "2026-06-05T03:08:57.984Z",
        "request_id": "aad444ef-5d52-4449-8bd2-72a0047863c8"
    },
    "status": "ok",
    "message": "Laplace pressure",
    "success": true
}
```

#### `GET /v1/poiseuille` — Hagen-Poiseuille flow

**Parameters:**
- `radius` (query, required, string) — Pipe radius (m) Example: `0.005`
- `pressure_drop` (query, required, string) — Pressure drop (Pa) Example: `1000`
- `viscosity` (query, required, string) — Dynamic viscosity (Pa·s) Example: `0.001`
- `length` (query, required, string) — Pipe length (m) Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/capillary-api/v1/poiseuille?radius=0.005&pressure_drop=1000&viscosity=0.001&length=1"
```

**Response:**
```json
{
    "data": {
        "note": "Hagen-Poiseuille: Q = π·r⁴·ΔP / (8·μ·L) for laminar flow. Peak (centreline) velocity is twice the average.",
        "inputs": {
            "length_m": 1,
            "radius_m": 0.005,
            "viscosity_pa_s": 0.001,
            "pressure_drop_pa": 1000
        },
        "max_velocity_ms": 6.25,
        "average_velocity_ms": 3.125,
        "volumetric_flow_lpm": 14.726216,
        "volumetric_flow_m3s": 0.000245436926
    },
    "meta": {
        "timestamp": "2026-06-05T03:08:58.043Z",
        "request_id": "80930176-54ce-449a-94ed-1e9462ca796b"
    },
    "status": "ok",
    "message": "Poiseuille flow",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Surface tension in N/m, radii and lengths in m, density in kg/m³, viscosity in Pa·s, pressures in Pa. Water γ ≈ 0.0728 N/m at 20 °C.",
        "service": "capillary-api",
        "formulae": {
            "poiseuille": "Q = π·r⁴·ΔP / (8·μ·L)",
            "capillary_rise": "h = 2γ·cosθ / (ρ·g·r)",
            "laplace_droplet": "ΔP = 2γ/r"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/poiseuille": "Laminar pipe flow rate and velocity from radius, pressure drop and viscosity.",
            "GET /v1/capillary-rise": "Capillary rise (or depression) height from surface tension, radius and contact angle.",
            "GET /v1/laplace-pressure": "Excess pressure inside a droplet, soap bubble or cylindrical jet."
        },
        "description": "Surface-tension and small-scale fluid calculator: capillary rise (Jurin's law), Young-Laplace excess pressure for droplets and bubbles, and Hagen-Poiseuille laminar pipe flow."
    },
    "meta": {
        "timestamp": "2026-06-05T03:08:58.111Z",
        "request_id": "c5ee366d-147f-48e1-a52a-44ddfb7bd56d"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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