# Poll the weather API politely

> How much of the weather response to ask for, and how often to ask, so a display stays fresh without wasted calls.

Developers · How-to guide · https://wxalerts.org/docs/developers/polling/

Use this to keep a display of [`GET /weather`](/docs/api/weather/) current
without asking for more than it can show or more often than the data changes.
The [rate limits](/docs/developers/rate-limits/) apply either way.

## Ask only for what you show

Set `hours` and `days` to what the screen draws:

```
GET /weather?lat=33.2&lon=-97.1&hours=12&days=5
```

| | default | range |
| --- | --- | --- |
| `hours` | 24 | 1 to 168 |
| `days` | 7 | 1 to 8 |

A panel showing the next twelve hours should ask for twelve. `hours` counts
steps, not clock hours: the series is hourly for about two days, 3-hourly to
about eight, then 6-hourly to about eleven, so `hours=168` returns all of it,
around a hundred steps. These only decide how much of the forecast crosses the
wire, not how far ahead it reaches.

## Poll once a minute at most

The response is cached for 60 seconds, which is the station's cadence rather
than the model's: CWOP stations report every five minutes and METARs hourly,
while NBM runs once an hour. Polling faster than a minute gains nothing;
polling once a minute is the most a display can usefully do.

## Pass `units` explicitly

A response resolved from your country comes back `Cache-Control: private`.
Pass `units` explicitly for a response a CDN can cache. See
[Units](/docs/api/weather/#units).
