Use case

Lightning alerts for airport ground operations.

Ramp closures are time-critical and expensive in both directions. Lightning API pushes flashes to you over a WebSocket as they are detected, and fires a zone alert when one lands inside the ring you drew around the airfield, so the stop-work call is made on current data.

Why a stream and not a poll

If you poll once a minute, your worst case is a minute of not knowing. On a ramp with people and fuel on it, that is the wrong shape of latency to design in. A push stream removes the interval entirely: the flash arrives when it is detected.

Subscribing to the live stream

import asyncio, json, websockets

URL = "wss://api.lightningapi.dev/v1/stream?cg_only=true"

async def main():
    async with websockets.connect(
        URL, additional_headers={"X-API-Key": "lapi_your_key_here"}
    ) as ws:
        async for raw in ws:
            msg = json.loads(raw)
            # Batches with an envelope, not one flash per message.
            if msg.get("type") != "flashes":
                continue
            for flash in msg["flashes"]:
                print(flash["lat"], flash["lon"], flash["flash_timestamp_utc"])

asyncio.run(main())

The cg_only filter keeps in-cloud flashes out of the stream. For a ramp decision that is usually what you want, since an in-cloud flash inflates the count without changing the risk on the ground.

Rings around the airfield

Most ground operations run two rings: an outer ring that puts crews on notice and an inner ring that stops work. Both are zones, each with its own webhook, so your system can treat them differently without doing any distance maths itself.

Defending the decision afterwards

Every closure eventually gets questioned. Because the same flashes are queryable historically, you can reconstruct exactly what was inside the ring and when, which turns an argument about judgement into a record.

Reconstructing a closure window

curl "https://api.lightningapi.dev/v1/flashes" \
  -H "X-API-Key: lapi_your_key_here" \
  -G -d since_minutes=180 \
     -d min_lat=32.83 -d max_lat=32.95 \
     -d min_lon=-97.10 -d max_lon=-96.98

Recommended plan

Ultimate

A ramp decision cannot wait on a polling interval, and the WebSocket stream that removes that delay starts at Ultimate, which also carries the 50,000 row per call cap for reviewing a shift afterwards.

Compare plans

Frequently asked questions

Is this an approved source for regulatory decisions?

No. Lightning API is a data feed, not a certified aviation weather service, and nothing here replaces your regulator's requirements or your own operating procedures. Treat it as an input to a policy you already have.

What happens if the WebSocket drops?

Pass the flash_id of the last flash you handled as resume_from_flash_id on reconnect, and the server replays the gap before resuming live. Replayed flashes count toward your quota.

Can I get both lightning and radar in one view?

Yes. Radar tiles are a separate product included on every plan with its own allowance, addressed as standard XYZ map tiles so they composite over whatever base map you already use.

How many zones can I define?

Zone count is capped by plan. Two rings per airfield is the common pattern, so check the plan table if you operate several sites from one account.

Does the stream cover the whole service area?

The stream carries the same coverage as the REST endpoints. See the coverage pages for the regions included.

Related

Last checked 2026-09-20

Coverage areas

Lightning data provided as-is; not for safety-critical use. Commercial use is permitted on every current plan. Read the EULA →