# Lightning

> Recent GOES-19 GLM lightning flashes in a box, which the live map polls and which fills in what an MQTT client missed before it connected.

API reference · Reference · https://wxalerts.org/docs/api/lightning/

Base URL: `https://api.wxalerts.org`

Lightning flashes seen from orbit by the Geostationary Lightning Mapper (GLM)
on GOES-19, the GOES-East satellite. GLM is an optical sensor: it watches for
the flicker of lightning lighting up cloud tops, day and night, across the
Americas and the Atlantic, at about 8 km resolution. It sees in-cloud and
cloud-to-ground lightning alike and does not tell them apart.

No key needed. It shares the
[per address limit](/docs/developers/rate-limits/). It is also served at `/v1/lightning/flashes` with an API key (`storms:read`); see [Conventions](/docs/api/conventions/#bare-paths-and-v1). Browsers block calls from
other websites (CORS allows only wxalerts.org), so call it from a server,
script or app.

This is how to follow lightning for a box on a map: poll it no faster than every 15
seconds, and take the flashes newer than the ones you hold. The live map does exactly
that. There is no `since` parameter, so ask for `minutes` back and de-duplicate on
the time and position. Round the box to a grid so that clients looking at the same
place send the same request and share the cache.

Your own account's lightning also arrives over the
[MQTT lightning feed](/docs/developers/mqtt/lightning/), within a range you set
around each saved place. The broker keeps nothing, so a client that has just
connected has no strikes from before it did. This route fills that gap: it reads
the same flashes back from the database, so a radar loop or a newly opened page
can draw the last hour and then carry on from MQTT. To combine the two, see
[Merge lightning history with the live feed](/docs/developers/mqtt/merging-lightning/).
For daily counts rather than individual flashes, see
[`/v1/stats/lightning/daily`](/docs/api/stats/).

## `GET /lightning/flashes`

GLM flashes in a bounding box over a recent window, oldest first. Public; also
at `/v1/lightning/flashes` with `storms:read`. The time to the millisecond and
the position to four decimals are the identity the MQTT feed uses, so a flash
heard live and the same flash read here match exactly. The window is
`since < t <= until`. About a day is kept, so a window ending further back
comes back empty rather than as an error.

| Name | In | Type | Required | Default | Bounds and notes |
| --- | --- | --- | --- | --- | --- |
| `bbox` | query | string | yes | none | `minLon,minLat,maxLon,maxLat` in degrees (west, south, east, north). Longitudes inside -180 to 180, latitudes inside -90 to 90, with min below max. A box crossing the antimeridian is not supported. Example `-98.5,32.0,-96.0,33.5` |
| `minutes` | query | integer | no | 70 | 1 to 180. How far back from `until` to reach. The default is a radar loop's hour plus the ten minutes its oldest frame draws behind it |
| `until` | query | ISO 8601 timestamp | no | now | End of the window. A time without a zone is read as UTC. Up to 5 minutes in the future is accepted for clock skew; anything later is pulled back to now plus 5 minutes |
| `limit` | query | integer | no | 30000 | 1 to 60000. When there are more flashes, the newest are kept and `truncated` is true |

| Field | Type | Description |
| --- | --- | --- |
| `since` | timestamp | Start of the window, UTC, exclusive. Echoes the window served |
| `until` | timestamp | End of the window, UTC, inclusive, after defaults and the clamp on `until` |
| `truncated` | boolean | True when there were more flashes than `limit`. The oldest are dropped, so the gap is at the start of the window |
| `flashes` | array of arrays | `[t_ms, lat, lon, energy_j]`: see [Response rows](#response-rows) |

```json
{
  "since": "2026-11-09T18:58:26.935870Z",
  "until": "2026-11-09T19:08:26.935870Z",
  "truncated": false,
  "flashes": [
    [1794250713936, 24.4613, -95.9038, 6.42848946817709e-14],
    [1794250715534, 39.6719, -67.0973, 9.428477557070838e-14],
    [1794251248570, 39.214, -68.1464, null]
  ]
}
```

```bash
curl "https://api.wxalerts.org/lightning/flashes?bbox=-98.5,32.0,-96.0,33.5&minutes=30"
```

| Status | Body | When |
| --- | --- | --- |
| 401 | `{"detail": {"code": "api_key_invalid", "message": "..."}}` | A key was sent and is bad |
| 403 | `{"detail": {"code": "insufficient_scope", "message": "...", "scope": "storms:read"}}` | `/v1` with a key lacking `storms:read` |
| 422 | `{"detail": "bbox must be minLon,minLat,maxLon,maxLat"}` | `bbox` is not four numbers separated by commas |
| 422 | `{"detail": "bbox must be minLon,minLat,maxLon,maxLat inside -180..180 and -90..90"}` | A coordinate out of range, or min not below max |
| 422 | validation array | `bbox` missing, `minutes` or `limit` out of bounds, or `until` not a timestamp |
| 429 | `{"detail": {"code": "rate_limited", "message": "..."}}` with `Retry-After` and `RateLimit-*` | Over the address or key budget |

Cached with `Cache-Control: public, max-age=20` (`private` on `/v1`); no `ETag`.
Timestamps end in `Z`.

## Response rows

- **`flashes`** are rows, not GeoJSON: an hour over a busy view is tens of
  thousands of flashes, and four key names on each would triple the payload.
  Each row is `[t_ms, lat, lon, energy_j]`.
- **`t_ms`** is the observation time in epoch milliseconds (truncated, not
  rounded). This is when GLM saw the flash, not when it reached us; flashes run
  about 20 seconds behind.
- **`lat`, `lon`**: note the order, latitude first, unlike `bbox` and GeoJSON.
- **`energy_j`** is the flash's total optical energy as GLM measured it. The
  numbers are tiny (around 1e-14 to 1e-12) because it is the light reaching the
  sensor; use it to compare flashes, for size or brightness, not as the energy
  of the discharge.
- **`truncated`**: narrow the box or shorten `minutes` rather than raising
  `limit` to the ceiling as a habit.

## Caching

Responses are sent with `Cache-Control: public, max-age=20`: the newest minute
changes with every GLM granule, so poll no faster than that, and use your
MQTT feed for anything per place that must be live.

## Errors

See [Errors](/docs/developers/errors/) and the errors table under the route.
