# RF Path Loss API
> RF path-loss and link-budget maths as an API, computed locally and deterministically. The fspl endpoint computes the free-space path loss, FSPL(dB) = 20·log₁₀(d_km) + 20·log₁₀(f_MHz) + 32.44, the ideal line-of-sight attenuation between two antennas, and the wavelength. The linkbudget endpoint computes the received power, Prx = Ptx + Gtx + Grx − path loss − cable losses, the EIRP, and — given a receiver sensitivity — the link margin and whether the link closes. The dbm endpoint converts RF power between dBm, watts and dBW (0 dBm = 1 mW, 30 dBm = 1 W). Everything is computed locally and deterministically, so it is instant and private. Ideal for wireless, IoT, LoRa, Wi-Fi and radio app developers, link-planning and coverage tools, and RF engineering education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is RF link budget; for VSWR and impedance match use a VSWR API and for antenna gain use an antenna 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/pathloss-api/..."
```

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

## Endpoints

### Path Loss

#### `GET /v1/dbm` — Power conversion

**Parameters:**
- `dbm` (query, optional, string) — Power in dBm Example: `30`
- `watts` (query, optional, string) — Or power in watts
- `dbw` (query, optional, string) — Or power in dBW

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/pathloss-api/v1/dbm?dbm=30"
```

**Response:**
```json
{
    "data": {
        "dbm": 30,
        "dbw": 0,
        "note": "dBm = 10·log₁₀(P/1 mW); dBW = 10·log₁₀(P/1 W). 0 dBm = 1 mW, 30 dBm = 1 W.",
        "watts": 1,
        "inputs": {
            "dbm": 30
        },
        "milliwatts": 1000
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:11.242Z",
        "request_id": "575f0951-7b72-4e90-9657-d589a8646832"
    },
    "status": "ok",
    "message": "Power conversion",
    "success": true
}
```

#### `GET /v1/fspl` — Free-space path loss

**Parameters:**
- `distance` (query, required, string) — Distance (km) Example: `1`
- `frequency` (query, required, string) — Frequency (MHz) Example: `2400`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/pathloss-api/v1/fspl?distance=1&frequency=2400"
```

**Response:**
```json
{
    "data": {
        "note": "FSPL(dB) = 20·log₁₀(d_km) + 20·log₁₀(f_MHz) + 32.44. Free-space, line-of-sight only — real paths add obstruction and multipath loss.",
        "inputs": {
            "distance_km": 1,
            "frequency_mhz": 2400
        },
        "fspl_db": 100.0442,
        "wavelength_m": 0.124914
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:11.355Z",
        "request_id": "e4df9836-7348-44b3-b3d3-6cf7b2241604"
    },
    "status": "ok",
    "message": "Free-space path loss",
    "success": true
}
```

#### `GET /v1/linkbudget` — Link budget

**Parameters:**
- `tx_power` (query, required, string) — TX power (dBm) Example: `20`
- `tx_gain` (query, optional, string) — TX antenna gain (dBi) Example: `5`
- `rx_gain` (query, optional, string) — RX antenna gain (dBi) Example: `5`
- `distance` (query, optional, string) — Distance (km) Example: `1`
- `frequency` (query, optional, string) — Frequency (MHz) Example: `2400`
- `path_loss` (query, optional, string) — Or path loss directly (dB)
- `losses` (query, optional, string) — Cable/connector losses (dB) Example: `2`
- `sensitivity` (query, optional, string) — RX sensitivity (dBm) for margin Example: `-90`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/pathloss-api/v1/linkbudget?tx_power=20&tx_gain=5&rx_gain=5&distance=1&frequency=2400&losses=2&sensitivity=-90"
```

**Response:**
```json
{
    "data": {
        "note": "Prx = Ptx + Gtx + Grx − path loss − losses (all in dB/dBm/dBi). Link margin = Prx − receiver sensitivity; aim for > 10 dB.",
        "inputs": {
            "losses": 2,
            "rx_gain": 5,
            "tx_gain": 5,
            "tx_power": 20,
            "path_loss": 100.0442
        },
        "link_ok": true,
        "eirp_dbm": 23,
        "link_margin_db": 17.9558,
        "sensitivity_dbm": -90,
        "received_power_dbm": -72.0442
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:11.454Z",
        "request_id": "447f6fda-7bce-4d11-b0ed-977be5836e86"
    },
    "status": "ok",
    "message": "Link budget",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "notes": "Distance in km, frequency in MHz, powers in dBm, gains in dBi, losses in dB. FSPL is the ideal line-of-sight minimum; add fade margin for real links.",
        "service": "pathloss-api",
        "formulae": {
            "dbm": "dBm = 10·log₁₀(P/1 mW)",
            "fspl": "FSPL = 20·log₁₀(d_km) + 20·log₁₀(f_MHz) + 32.44",
            "link_budget": "Prx = Ptx + Gtx + Grx − path_loss − losses"
        },
        "endpoints": {
            "GET /v1/dbm": "Convert RF power between dBm, watts and dBW.",
            "GET /v1/fspl": "Free-space path loss from distance (km) and frequency (MHz).",
            "GET /v1/meta": "This document.",
            "GET /v1/linkbudget": "Received power and link margin from TX power, antenna gains, path loss and losses."
        },
        "description": "RF path-loss and link-budget calculator: free-space path loss, link budget with margin, and dBm/watt power conversion."
    },
    "meta": {
        "timestamp": "2026-06-04T18:38:11.521Z",
        "request_id": "aff4c908-a300-4a48-8206-71368402b0d7"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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