# Earthquake Magnitude API
> Earthquake-magnitude seismology as an API, computed locally and deterministically. The energy endpoint computes the radiated seismic energy released by an earthquake of a given magnitude using the Gutenberg-Richter relation, log10(E) = 1.5·M + 4.8 with E in joules, and converts it to a TNT equivalent in tons and kilotons (one ton of TNT ≈ 4.184×10⁹ J), with a felt/damage classification. The compare endpoint quantifies how much bigger one quake is than another: each magnitude unit means about ten times the ground-motion amplitude on a seismograph and about 31.6 times (10^1.5) the energy, so it returns both the amplitude ratio and the energy ratio between two magnitudes. The moment-magnitude endpoint converts between the seismic moment M0 (in newton-metres, M0 = rigidity × rupture area × slip) and the moment magnitude with the Hanks-Kanamori relation Mw = (2/3)·log10(M0) − 6.07, in either direction. Magnitudes are dimensionless, energy is in joules and seismic moment in newton-metres. Everything is computed locally and deterministically, so it is instant and private. Ideal for seismology-education, disaster-modelling, insurance, structural-risk and science app developers, earthquake-energy and magnitude tools, and STEM teaching. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is the earthquake-magnitude calculator; for real-time and historical earthquake event feeds use an earthquake data 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/richter-api/..."
```

## Pricing
- **Free** (Free) — 3,500 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 34,000 calls/Mo, 6 req/s
- **Pro** ($14/Mo) — 215,000 calls/Mo, 15 req/s
- **Mega** ($44/Mo) — 1,280,000 calls/Mo, 40 req/s

## Endpoints

### Seismology

#### `GET /v1/compare` — Magnitude comparison

**Parameters:**
- `magnitude1` (query, required, string) — First magnitude Example: `7`
- `magnitude2` (query, required, string) — Second magnitude Example: `6`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/richter-api/v1/compare?magnitude1=7&magnitude2=6"
```

**Response:**
```json
{
    "data": {
        "note": "Per magnitude unit: ground-motion amplitude scales ×10 and radiated energy ×10^1.5 ≈ 31.6. Ratios use M1 relative to M2.",
        "inputs": {
            "magnitude1": 7,
            "magnitude2": 6
        },
        "summary": "Magnitude 7 shakes the ground 10× as much and releases 31.62× the energy of magnitude 6.",
        "energy_ratio": 31.622777,
        "amplitude_ratio": 10,
        "magnitude_difference": 1
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:35.946Z",
        "request_id": "2afe57ec-8a63-45ad-8132-a6f20c68a3df"
    },
    "status": "ok",
    "message": "Magnitude comparison",
    "success": true
}
```

#### `GET /v1/energy` — Earthquake energy

**Parameters:**
- `magnitude` (query, required, string) — Magnitude Example: `6`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/richter-api/v1/energy?magnitude=6"
```

**Response:**
```json
{
    "data": {
        "note": "Radiated seismic energy: log10(E) = 1.5·M + 4.8 (E in joules). One ton of TNT ≈ 4.184×10⁹ J. Each whole magnitude step releases ~31.6× more energy.",
        "inputs": {
            "magnitude": 6
        },
        "log10_energy": 13.8,
        "energy_joules": 63095734448019.43,
        "classification": "strong (damage in populated areas)",
        "tnt_equivalent_tons": 15080.2425,
        "tnt_equivalent_kilotons": 15.080242
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:36.048Z",
        "request_id": "ed4e2c78-3757-4631-9251-685ba6d11448"
    },
    "status": "ok",
    "message": "Earthquake energy",
    "success": true
}
```

#### `GET /v1/moment-magnitude` — Moment magnitude

**Parameters:**
- `seismic_moment` (query, optional, string) — Seismic moment M0 (N·m) Example: `1e19`
- `moment_magnitude` (query, optional, string) — Or moment magnitude Mw

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/richter-api/v1/moment-magnitude?seismic_moment=1e19"
```

**Response:**
```json
{
    "data": {
        "note": "Hanks-Kanamori: Mw = (2/3)·log10(M0) − 6.07, with the seismic moment M0 in newton-metres (M0 = μ·A·d: rigidity × rupture area × slip).",
        "inputs": {
            "seismic_moment_nm": 1.0e+19
        },
        "classification": "strong (damage in populated areas)",
        "moment_magnitude": 6.5967
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:36.156Z",
        "request_id": "70985fa7-6378-4a22-ac8a-122c44da7ce3"
    },
    "status": "ok",
    "message": "Moment magnitude",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Magnitudes are dimensionless; energy in joules; seismic moment M0 in newton-metres. One ton of TNT ≈ 4.184×10⁹ J.",
        "service": "richter-api",
        "formulae": {
            "energy": "log10(E) = 1.5·M + 4.8  (joules)",
            "energy_ratio": "10^(1.5·(M1 − M2))",
            "amplitude_ratio": "10^(M1 − M2)",
            "moment_magnitude": "Mw = (2/3)·log10(M0) − 6.07"
        },
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/energy": "Radiated energy, TNT equivalent and classification from a magnitude.",
            "GET /v1/compare": "Amplitude and energy ratios between two magnitudes.",
            "GET /v1/moment-magnitude": "Moment magnitude Mw from seismic moment M0 (or the inverse)."
        },
        "description": "Seismology calculator: earthquake radiated energy and TNT equivalent from magnitude, magnitude comparison (amplitude and energy ratios) and moment magnitude from the seismic moment."
    },
    "meta": {
        "timestamp": "2026-06-05T11:30:36.268Z",
        "request_id": "95e34a43-5602-4219-8103-5ba858c52de5"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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