# Mohr Circle Stress API
> Mohr's circle and 2D (plane) stress transformation as an API, computed locally and deterministically. The principal endpoint takes a plane-stress state — the normal stresses σx and σy and the shear stress τxy — and returns the principal stresses σ1 and σ2 = (σx+σy)/2 ± √(((σx−σy)/2)² + τxy²), the maximum in-plane shear stress, the orientation of the principal and maximum-shear planes, the centre and radius of Mohr's circle, and the von Mises and Tresca equivalent stresses (treating plane stress with the third principal σ3 = 0). The transform endpoint rotates the stress state onto a plane at any angle θ, returning σx', σy' and τx'y' using the standard transformation equations, and confirms the σx+σy invariant. The safety endpoint computes the factor of safety against a material's yield strength under either the von Mises (distortion-energy) or the Tresca (maximum-shear) criterion, from a full stress state or from principal stresses directly. Everything is computed locally and deterministically, so it is instant and private. Ideal for mechanical, structural and aerospace engineering tools, finite-element pre- and post-processing, machine-design and stress-analysis apps, and engineering education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is stress-state analysis; for fillet-weld throat sizing use a weld API and for helical-spring rates use a spring 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/mohr-api/..."
```

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

## Endpoints

### Stress

#### `GET /v1/principal` — Principal stresses & Mohr circle

**Parameters:**
- `sigma_x` (query, required, string) — Normal stress σx Example: `100`
- `sigma_y` (query, required, string) — Normal stress σy Example: `20`
- `tau_xy` (query, optional, string) — Shear stress τxy (default 0) Example: `30`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mohr-api/v1/principal?sigma_x=100&sigma_y=20&tau_xy=30"
```

**Response:**
```json
{
    "data": {
        "input": {
            "tau_xy": 30,
            "sigma_x": 100,
            "sigma_y": 20
        },
        "formula": "σ1,2 = (σx+σy)/2 ± √(((σx−σy)/2)² + τxy²); τmax = R; θp = ½·atan2(2τxy, σx−σy).",
        "sigma_1": 110,
        "sigma_2": 10,
        "mohr_circle": {
            "center": 60,
            "radius": 50
        },
        "tresca_stress": 110,
        "von_mises_stress": 105.356538,
        "max_in_plane_shear": 50,
        "max_shear_angle_deg": -26.565051,
        "principal_angle_deg": 18.434949,
        "sigma_3_plane_stress": 0
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:51.236Z",
        "request_id": "e9d498a2-e6ed-4925-bf66-34b53f5c8567"
    },
    "status": "ok",
    "message": "Principal stresses & Mohr circle",
    "success": true
}
```

#### `GET /v1/safety` — Factor of safety vs yield

**Parameters:**
- `yield_strength` (query, required, string) — Yield strength Sy Example: `250`
- `criterion` (query, optional, string) — von-mises | tresca (default von-mises) Example: `von-mises`
- `sigma_x` (query, optional, string) — Normal stress σx Example: `100`
- `sigma_y` (query, optional, string) — Normal stress σy Example: `20`
- `tau_xy` (query, optional, string) — Shear stress τxy Example: `30`
- `sigma_1` (query, optional, string) — Or principal σ1 directly
- `sigma_2` (query, optional, string) — And principal σ2

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mohr-api/v1/safety?yield_strength=250&criterion=von-mises&sigma_x=100&sigma_y=20&tau_xy=30"
```

**Response:**
```json
{
    "data": {
        "formula": "FoS = Sy / σvm; σvm = √(σ1² − σ1σ2 + σ2²).",
        "sigma_1": 110,
        "sigma_2": 10,
        "criterion": "von-mises",
        "tresca_stress": 110,
        "yield_strength": 250,
        "factor_of_safety": 2.372895,
        "von_mises_stress": 105.356538,
        "equivalent_stress": 105.356538
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:51.336Z",
        "request_id": "ecacc07f-a5e9-4917-933f-85ceb5e1b5c9"
    },
    "status": "ok",
    "message": "Factor of safety",
    "success": true
}
```

#### `GET /v1/transform` — Stresses on a rotated plane

**Parameters:**
- `sigma_x` (query, required, string) — Normal stress σx Example: `100`
- `sigma_y` (query, required, string) — Normal stress σy Example: `20`
- `tau_xy` (query, optional, string) — Shear stress τxy (default 0) Example: `30`
- `angle` (query, required, string) — Rotation angle θ (degrees) Example: `30`
- `angle_unit` (query, optional, string) — deg|rad (default deg) Example: `deg`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/mohr-api/v1/transform?sigma_x=100&sigma_y=20&tau_xy=30&angle=30&angle_unit=deg"
```

**Response:**
```json
{
    "data": {
        "input": {
            "angle": 30,
            "tau_xy": 30,
            "sigma_x": 100,
            "sigma_y": 20,
            "angle_unit": "deg"
        },
        "formula": "σx' = C + ((σx−σy)/2)·cos2θ + τxy·sin2θ; τx'y' = −((σx−σy)/2)·sin2θ + τxy·cos2θ.",
        "tau_xy_prime": -19.641016,
        "sigma_x_prime": 105.980762,
        "sigma_y_prime": 14.019238,
        "sum_invariant": 120
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:51.424Z",
        "request_id": "bbc5691a-92bc-47d4-af2b-8d2f574e9b98"
    },
    "status": "ok",
    "message": "Rotated-plane stresses",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "api": "mohr",
        "note": "Mohr's circle / 2D stress transformation — computed locally and deterministically, no key, no third-party service.",
        "endpoints": [
            "/v1/principal",
            "/v1/transform",
            "/v1/safety",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:51.498Z",
        "request_id": "eec52f07-7f7b-46ac-8252-bfab2bdbb5b3"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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