# Earth Pressure API
> Lateral earth-pressure maths (Rankine theory) as an API, computed locally and deterministically for retaining-wall design. The active endpoint computes the active earth pressure that pushes a wall outward when the soil is allowed to yield: the coefficient Ka = (1−sinφ)/(1+sinφ) from the soil friction angle, the pressure at the base of the wall σ = Ka·γ·H, the total thrust per metre run ½·Ka·γ·H², plus the contributions of a surface surcharge and of soil cohesion (which reduces the pressure by 2c√Ka and forms a tension crack of depth 2c/(γ√Ka)). The passive endpoint computes the passive resistance Kp = (1+sinφ)/(1−sinφ) that the soil mobilises when a wall is pushed into it — the resisting pressure and thrust, with cohesion adding 2c√Kp. The atrest endpoint computes the at-rest pressure K0 = 1−sinφ (Jaky) for unyielding walls such as basements and braced excavations. Everything is computed locally and deterministically, so it is instant and private. Ideal for geotechnical and civil-engineering tools, retaining-wall, sheet-pile and basement-wall design, excavation-shoring and foundation apps, and engineering education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is Rankine lateral earth pressure; for slope geometry use a slope API and for open-channel weir flow use a weir 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/earthpressure-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 15,000 calls/Mo, 5 req/s
- **Pro** ($24/Mo) — 80,000 calls/Mo, 15 req/s
- **Mega** ($75/Mo) — 409,000 calls/Mo, 40 req/s

## Endpoints

### Earth Pressure

#### `GET /v1/active` — Active earth pressure

**Parameters:**
- `friction_angle` (query, required, string) — Soil friction angle φ (degrees) Example: `30`
- `unit_weight` (query, required, string) — Soil unit weight γ (kN/m³) Example: `18`
- `height` (query, required, string) — Wall height H (m) Example: `5`
- `surcharge` (query, optional, string) — Surface surcharge q (kPa) Example: `10`
- `cohesion` (query, optional, string) — Soil cohesion c (kPa) Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/earthpressure-api/v1/active?friction_angle=30&unit_weight=18&height=5&surcharge=10&cohesion=0"
```

**Response:**
```json
{
    "data": {
        "note": "Rankine active: Ka = (1−sinφ)/(1+sinφ). Cohesion reduces pressure by 2c√Ka; a tension crack forms in the upper soil.",
        "type": "active",
        "inputs": {
            "height": 5,
            "cohesion": 0,
            "surcharge": 10,
            "unit_weight": 18,
            "friction_angle": 30
        },
        "coefficient": 0.333333,
        "soil_thrust_kn_m": 75,
        "base_pressure_kpa": 33.3333,
        "total_thrust_kn_m": 91.6667,
        "surcharge_thrust_kn_m": 16.6667,
        "soil_thrust_line_of_action_m": 1.6667
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:27.105Z",
        "request_id": "24335e47-8b86-4c60-9851-4846dd5b9482"
    },
    "status": "ok",
    "message": "Active earth pressure",
    "success": true
}
```

#### `GET /v1/atrest` — At-rest earth pressure

**Parameters:**
- `friction_angle` (query, required, string) — Soil friction angle φ (degrees) Example: `30`
- `unit_weight` (query, required, string) — Soil unit weight γ (kN/m³) Example: `18`
- `height` (query, required, string) — Wall height H (m) Example: `5`
- `surcharge` (query, optional, string) — Surface surcharge q (kPa) Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/earthpressure-api/v1/atrest?friction_angle=30&unit_weight=18&height=5&surcharge=0"
```

**Response:**
```json
{
    "data": {
        "note": "At-rest (Jaky): K0 = 1−sinφ. Used for unyielding walls such as basements and braced cuts.",
        "type": "at-rest",
        "inputs": {
            "height": 5,
            "surcharge": 0,
            "unit_weight": 18,
            "friction_angle": 30
        },
        "coefficient": 0.5,
        "soil_thrust_kn_m": 112.5,
        "base_pressure_kpa": 45,
        "total_thrust_kn_m": 112.5,
        "surcharge_thrust_kn_m": 0,
        "soil_thrust_line_of_action_m": 1.6667
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:27.196Z",
        "request_id": "9ca0fb53-b8bb-4ace-b680-25727ade8507"
    },
    "status": "ok",
    "message": "At-rest earth pressure",
    "success": true
}
```

#### `GET /v1/passive` — Passive earth pressure

**Parameters:**
- `friction_angle` (query, required, string) — Soil friction angle φ (degrees) Example: `30`
- `unit_weight` (query, required, string) — Soil unit weight γ (kN/m³) Example: `18`
- `height` (query, required, string) — Wall height H (m) Example: `5`
- `surcharge` (query, optional, string) — Surface surcharge q (kPa) Example: `10`
- `cohesion` (query, optional, string) — Soil cohesion c (kPa) Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/earthpressure-api/v1/passive?friction_angle=30&unit_weight=18&height=5&surcharge=10&cohesion=0"
```

**Response:**
```json
{
    "data": {
        "note": "Rankine passive: Kp = (1+sinφ)/(1−sinφ). Cohesion adds 2c√Kp to the resisting pressure.",
        "type": "passive",
        "inputs": {
            "height": 5,
            "cohesion": 0,
            "surcharge": 10,
            "unit_weight": 18,
            "friction_angle": 30
        },
        "coefficient": 3,
        "soil_thrust_kn_m": 675,
        "base_pressure_kpa": 300,
        "total_thrust_kn_m": 825,
        "surcharge_thrust_kn_m": 150,
        "soil_thrust_line_of_action_m": 1.6667
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:27.265Z",
        "request_id": "7eb62773-564c-4203-bd46-f3fe7f20f5f5"
    },
    "status": "ok",
    "message": "Passive earth pressure",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Friction angle φ in degrees, unit weight γ in kN/m³, height H in m, surcharge q in kPa, cohesion c in kPa. Thrust is per metre run of wall. Horizontal backfill, vertical wall, no wall friction.",
        "service": "earthpressure-api",
        "formulae": {
            "active": "Ka = (1−sinφ)/(1+sinφ),  P = ½Ka·γ·H² + Ka·q·H − 2c·H·√Ka",
            "at_rest": "K0 = 1−sinφ,  P = ½K0·γ·H²",
            "passive": "Kp = (1+sinφ)/(1−sinφ),  P = ½Kp·γ·H² + Kp·q·H + 2c·H·√Kp"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/active": "Active earth pressure Ka, base pressure, soil/surcharge/cohesion thrust and tension-crack depth.",
            "GET /v1/atrest": "At-rest earth pressure K0 (Jaky) for unyielding walls.",
            "GET /v1/passive": "Passive earth pressure Kp, base pressure and total resisting thrust."
        },
        "description": "Lateral earth-pressure calculator (Rankine theory): active, passive and at-rest coefficients, base pressures and total thrust on retaining walls."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:27.359Z",
        "request_id": "dd967bdb-79e3-4ba7-b870-71efdceab99c"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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