Recipe: Real-Time Lightning Monitoring
This recipe shows how to retrieve recent lightning strike data near a location.
These recipes are teaching examples — not production code.
- Host: examples use the development host apidev.accuweather.com. Switch to api.accuweather.com for production.
- Production hardening: GZIP compression, caching, retries with exponential backoff, and error handling are not included. See the Best Practices guide.
Scenario
"I want to show users all lightning strikes that occurred within 25 miles of their location in the last 30 minutes."
Call the Lightning strikes by point and radius endpoint with a latitude/longitude and time interval.
Endpoint:
Code
Bounding box alternative
If you need strikes across a rectangular area (for example, a map viewport), call the bounding box endpoint instead of point-and-radius:
Code
Pagination
Results are returned in sets of 5,000. Use the offset parameter as a page index (0 = first set, 1 = second set, etc.) to fetch additional sets:
Code
Key response fields
| Field | Type | Description |
|---|---|---|
geometry.coordinates | Array | [longitude, latitude] of the strike |
properties.id | String | Unique strike identifier |
properties.date | String | Strike time in UTC |
properties.sourceId | Integer | Data source: 84 (GOES East GLM), 85 (GOES West GLM), 86 (AccuWeather Lightning Network) |
properties.strikeType | String | "cg" (cloud-to-ground), "ic" (intra-cloud), or "" (unknown) |
properties.peakCurrent | Integer | Strike amperage. Positive = positive polarity (more energetic). Negative = negative polarity (most common). null if unavailable. |
| lysis for lightning forecast recipe |
lysis for lightning forecast recipe
Available time intervals
| Value | Description |
|---|---|
5 | Last 5 minutes |
15 | Last 15 minutes |
30 | Last 30 minutes |
60 | Last 1 hour |
120 | Last 2 hours |
Complete code sample
Copy a full, runnable example that fetches recent lightning strikes and prints a summary of each.
Next steps
- Lightning Forecast — check lightning probability for the next 2 hours
- Historical Lightning — analyze past lightning activity for a specific date
- Lightning Parameters — full API reference