# Space Weather API
> Live solar and geomagnetic conditions as an API, relayed from NOAA's Space Weather Prediction Center (SWPC). Get the current planetary K-index with its activity level and geomagnetic-storm scale (Kp 5+ → G1-G5); the real-time solar wind from the L1 point (speed, density, temperature, magnetic field Bz/Bt); the current NOAA scales for radio blackouts (R), solar-radiation storms (S) and geomagnetic storms (G); and the latest space-weather alerts, watches and warnings. Ideal for aurora forecasting, satellite & power-grid operations, HF-radio and amateur-radio apps, and science dashboards.

## 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/spaceweather-api/..."
```

## Pricing
- **Free** (Free) — 3,000 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 50,000 calls/Mo, 8 req/s
- **Pro** ($17/Mo) — 240,000 calls/Mo, 20 req/s
- **Mega** ($44/Mo) — 1,200,000 calls/Mo, 50 req/s

## Endpoints

### Space Weather

#### `GET /v1/alerts` — Recent space-weather alerts, watches & warnings

**Parameters:**
- `limit` (query, optional, string) — Max alerts (1-50, default 10) Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/spaceweather-api/v1/alerts?limit=10"
```

**Response:**
```json
{
    "data": {
        "count": 10,
        "alerts": [
            {
                "id": "TIIA",
                "message": "Space Weather Message Code: ALTTP2\nSerial Number: 1481\nIssue Time: 2026 May 01 1550 UTC\n\nALERT: Type II Radio Emission\nBegin Time: 2026 May 01 1535 UTC\nEstimated Velocity: 593 km/s\n\n\n\nDescription: Type II emissions occur in association with eruptions on the sun and typically indicate a coronal mass ejection is associated with a flare event.",
                "issued_at": "2026-05-01 15:50:32.247"
            },
            {
                "id": "TIIA",
                "message": "Space Weather Message Code: ALTTP2\nSerial Number: 1482\nIssue Time: 2026 May 02 1111 UTC\n\nALERT: Type II Radio Emission\nBegin Time: 2026 May 02 1051 UTC\nEstimated Velocity: 641 km/s\n\nComment: Likely associated with C-class flare acitivity originating from AR 4420 on the west limb.\n\n\n\nDescription: Type II emissions occur in association with eruptions on the sun and typically indicate a coronal mass ejection is associated with a flare event.",
                "issued_at": "2026-05-02 11:11:38.977"
            },
            {
                "id": "K04W",
                "message": "Space Weather Message Code: WARK04\nSerial Number: 5333\nIssue Time: 2026 May 04 1649 UTC\n\nWARNING: Geomagnetic K-index of 4 expected\nValid From: 2026 May 04 1645 UTC\nValid To: 2026 May 05 0300 UTC\nWarning Condition: Onset\n\nNOAA Space Weather Scale descriptions can be
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/kp` — Planetary K-index (latest + recent series)

**Parameters:**
- `limit` (query, optional, string) — Number of recent 3-hour points (1-100, default 12) Example: `12`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/spaceweather-api/v1/kp?limit=12"
```

**Response:**
```json
{
    "data": {
        "note": "Planetary K-index (0-9) in 3-hour intervals; higher = stronger geomagnetic activity.",
        "latest": {
            "kp": 3.67,
            "time": "2026-05-31T00:00:00",
            "level": "Unsettled",
            "g_scale": null
        },
        "series": [
            {
                "kp": 3.33,
                "time": "2026-05-29T15:00:00"
            },
            {
                "kp": 4,
                "time": "2026-05-29T18:00:00"
            },
            {
                "kp": 3.33,
                "time": "2026-05-29T21:00:00"
            },
            {
                "kp": 3.33,
                "time": "2026-05-30T00:00:00"
            },
            {
                "kp": 3,
                "time": "2026-05-30T03:00:00"
            },
            {
                "kp": 1.33,
                "time": "2026-05-30T06:00:00"
            },
            {
                "kp": 1.67,
                "time": "2026-05-30T09:00:00"
            },
            {
                "kp": 2,
                "time": "2026-05-30T12:00:00"
            },
            {
                "kp": 2.33,
                "time": "2026-05-30T15:00:00"
            },
            {
                "kp": 4.33,
                "time": "2026-05-30T18:00:00"
            },
            {
                "kp": 4,
                "time": "2026-05-30T21:00:00"
            },
            {
                "kp": 3.67,
                "time": "2026-05-31T0
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/scales` — Current NOAA scales (R radio / S radiation / G geomagnetic)

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

**Response:**
```json
{
    "data": {
        "date": "2026-05-31",
        "note": "NOAA scales 0-5: R = radio blackouts, S = solar radiation storms, G = geomagnetic storms.",
        "time": "05:47:00",
        "radio_blackouts": {
            "text": "none",
            "scale": 0
        },
        "solar_radiation": {
            "text": "none",
            "scale": 0
        },
        "geomagnetic_storms": {
            "text": "none",
            "scale": 0
        }
    },
    "meta": {
        "timestamp": "2026-05-31T05:48:01.028Z",
        "request_id": "3f265063-e46b-47ed-a752-fbebe5cc193e"
    },
    "status": "ok",
    "message": "Scales retrieved",
    "success": true
}
```

#### `GET /v1/solarwind` — Real-time solar wind (speed, density, Bz/Bt)

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

**Response:**
```json
{
    "data": {
        "note": "ACE/DSCOVR real-time solar wind at L1. Negative Bz favours geomagnetic coupling; high speed drives storms.",
        "time": "2026-05-31 05:45:00.000",
        "plasma": {
            "speed_km_s": 544.9,
            "density_p_cm3": 2.95,
            "temperature_k": 208502
        },
        "magnetic_field": {
            "bt_nt": 4.45,
            "bz_gsm_nt": -0.84
        }
    },
    "meta": {
        "timestamp": "2026-05-31T05:48:01.133Z",
        "request_id": "58a966dc-807d-4427-9769-1724d66e0ee1"
    },
    "status": "ok",
    "message": "Solar wind retrieved",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Source & scale reference

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

**Response:**
```json
{
    "data": {
        "note": "Live solar & geomagnetic conditions relayed from NOAA SWPC; not cached.",
        "scales": {
            "G": "Geomagnetic storms",
            "R": "Radio blackouts",
            "S": "Solar radiation storms"
        },
        "source": "NOAA Space Weather Prediction Center (services.swpc.noaa.gov)",
        "kp_scale": "0-9 (5+ = geomagnetic storm G1-G5)",
        "endpoints": [
            "/v1/kp",
            "/v1/solarwind",
            "/v1/scales",
            "/v1/alerts",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-05-31T05:48:01.189Z",
        "request_id": "d09a229d-0148-4ca8-8a82-205dcce96864"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


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