> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenWeather

> Current weather, 5-day/3-hour forecasts, One Call current/historical/daily summaries, air pollution and geocoding by coordinates.

![](https://mintcdn.com/webrouter/JBFYvcRI1PVnd4YX/logo/data-apis/openweather.svg?fit=max\&auto=format\&n=JBFYvcRI1PVnd4YX\&q=85\&s=48b28d078db6e6cbd823a4b744e8d62a)

[Web Catalog · Environment](https://docs.webrouter.net/data-apis.md?category=environment)

Needs&#x20;

`OPENWEATHER_API_KEY`

Endpoints

10

Auth

Key in query

[Vendor docs](https://openweathermap.org/api)

&#x20;·&#x20;

[Pricing](https://openweathermap.org/price)

## Setup

| Variable | | What it is |
| - | - | - |
| `OPENWEATHER_API_KEY` | required | An OpenWeather API key (home.openweathermap.org > API keys), sent as the appid query parameter. |

Put them in your environment or `.env`; [Data APIs](https://docs.webrouter.net/vendors.md) covers the other ways.

## Notes

* Temperatures are Kelvin unless units=metric or imperial is passed.
* Every weather call takes lat/lon; resolve a place name or ZIP first with openweather.geocoding.direct or openweather.geocoding.zip (the q/id/zip lookups on the weather endpoints are deprecated).
* One Call 3.0 endpoints need the separate One Call API subscription (1,000 calls/day free, then billed per call); the 2.5 endpoints work on the free plan.
* Times (dt) are Unix seconds UTC; the response's timezone field is the offset in seconds.

## Endpoints

GET

Geocode a place name

Coordinates, country and state for a city name.

[Open](#openweather-geocoding-direct)

GET

Geocode a ZIP or postal code

Coordinates and name for a postal code.

[Open](#openweather-geocoding-zip)

GET

Reverse geocode coordinates

Place names near a latitude/longitude.

[Open](#openweather-geocoding-reverse)

GET

Get current weather

Conditions, temperature, wind, clouds, visibility and sunrise/sunset now.

[Open](#openweather-weather-current)

GET

Get a 5-day forecast

Forecast in 3-hour steps for 5 days, with precipitation probability.

[Open](#openweather-forecast-get)

GET

Get current air pollution

AQI (1 good to 5 very poor) and pollutant concentrations in µg/m³.

[Open](#openweather-air-pollution-current)

GET

Get historical air pollution

Hourly AQI and pollutants between two Unix times.

[Open](#openweather-air-pollution-history)

GET

Get current weather and forecasts (One Call)

Current, minutely (1 h), hourly (48 h) and daily (8 days) weather plus government alerts.

[Open](#openweather-onecall-get)

GET

Get weather at a past or future time

Weather for one timestamp from 1979-01-01 up to 4 days ahead.

[Open](#openweather-onecall-timemachine)

GET

Get a daily weather summary

Aggregated weather for one date, 1979-01-02 to 1.5 years ahead.

[Open](#openweather-onecall-day-summary)

### Geocode a place name

GET

`/geo/1.0/direct`

`openweather.geocoding.direct`

Coordinates, country and state for a city name.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`q` required</td><td>string</td><td>query</td><td>City name, state code (US only) and ISO 3166 country code, comma-separated. Example `London,GB`</td></tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Results, up to 5.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/geocoding-api) · Same job: [Aviato](https://docs.webrouter.net/data-apis/aviato.md#aviato-geocoder-search), [CNPJá](https://docs.webrouter.net/data-apis/cnpja.md#cnpja-zip-get), [CompanyEnrich](https://docs.webrouter.net/data-apis/companyenrich.md#companyenrich-geo-regions), [Duffel](https://docs.webrouter.net/data-apis/duffel.md#duffel-places-suggestions), [Forager](https://docs.webrouter.net/data-apis/forager.md#forager-reference-locations), [IBGE](https://docs.webrouter.net/data-apis/ibge.md#ibge-aggregates-places)

```python Python theme={null}
router.call_data_api("openweather.geocoding.direct", {'q': 'London,GB'})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.geocoding.direct", params={"q": "London,GB"})
```

### Geocode a ZIP or postal code

GET

`/geo/1.0/zip`

`openweather.geocoding.zip`

Coordinates and name for a postal code.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`zip` required</td><td>string</td><td>query</td><td>Postal code and ISO 3166 country code, comma-separated. Example `E14,GB`</td></tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/geocoding-api) · Same job: [Aviato](https://docs.webrouter.net/data-apis/aviato.md#aviato-geocoder-search), [CNPJá](https://docs.webrouter.net/data-apis/cnpja.md#cnpja-zip-get), [CompanyEnrich](https://docs.webrouter.net/data-apis/companyenrich.md#companyenrich-geo-regions), [Duffel](https://docs.webrouter.net/data-apis/duffel.md#duffel-places-suggestions), [Forager](https://docs.webrouter.net/data-apis/forager.md#forager-reference-locations), [IBGE](https://docs.webrouter.net/data-apis/ibge.md#ibge-aggregates-places)

```python Python theme={null}
router.call_data_api("openweather.geocoding.zip", {'zip': 'E14,GB'})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.geocoding.zip", params={"zip": "E14,GB"})
```

### Reverse geocode coordinates

GET

`/geo/1.0/reverse`

`openweather.geocoding.reverse`

Place names near a latitude/longitude.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Number of names to return.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/geocoding-api) · Same job: [Aviato](https://docs.webrouter.net/data-apis/aviato.md#aviato-geocoder-search), [CNPJá](https://docs.webrouter.net/data-apis/cnpja.md#cnpja-zip-get), [CompanyEnrich](https://docs.webrouter.net/data-apis/companyenrich.md#companyenrich-geo-regions), [Duffel](https://docs.webrouter.net/data-apis/duffel.md#duffel-places-suggestions), [Forager](https://docs.webrouter.net/data-apis/forager.md#forager-reference-locations), [IBGE](https://docs.webrouter.net/data-apis/ibge.md#ibge-aggregates-places)

```python Python theme={null}
router.call_data_api("openweather.geocoding.reverse", {'lat': 51.5074, 'lon': -0.1278})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.geocoding.reverse", params={"lat": 51.5074, "lon": -0.1278})
```

### Get current weather

GET

`/data/2.5/weather`

`openweather.weather.current`

Conditions, temperature, wind, clouds, visibility and sunrise/sunset now.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>
    <tr><td>`units`</td><td>string</td><td>query</td><td>standard (default: Kelvin, m/s), metric (Celsius, m/s) or imperial (Fahrenheit, mph). One of `standard`, `metric`, `imperial`</td></tr>

    <tr>
      <td>
        `lang`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for city names and weather descriptions.
      </td>
    </tr>

    <tr><td>`mode`</td><td>string</td><td>query</td><td>JSON by default; xml or html. One of `xml`, `html`</td></tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/current) · Same job: [Amap (Gaode) Web Service](https://docs.webrouter.net/data-apis/amap.md#amap-weather), [FlightAware AeroAPI](https://docs.webrouter.net/data-apis/flightaware.md#flightaware-airports-weather), [US National Weather Service](https://docs.webrouter.net/data-apis/nws.md#nws-observations-latest), [Tomorrow.io](https://docs.webrouter.net/data-apis/tomorrow-io.md#tomorrow-io-weather-realtime), [WeatherAPI.com](https://docs.webrouter.net/data-apis/weatherapi.md#weatherapi-current)

```python Python theme={null}
router.call_data_api("openweather.weather.current", {'lat': 51.5074, 'lon': -0.1278})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.weather.current", params={"lat": 51.5074, "lon": -0.1278})
```

### Get a 5-day forecast

GET

`/data/2.5/forecast`

`openweather.forecast.get`

Forecast in 3-hour steps for 5 days, with precipitation probability.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>
    <tr><td>`units`</td><td>string</td><td>query</td><td>standard (default: Kelvin, m/s), metric (Celsius, m/s) or imperial (Fahrenheit, mph). One of `standard`, `metric`, `imperial`</td></tr>

    <tr>
      <td>
        `lang`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for city names and weather descriptions.
      </td>
    </tr>

    <tr>
      <td>
        `cnt`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Number of 3-hour timestamps to return.
      </td>
    </tr>

    <tr><td>`mode`</td><td>string</td><td>query</td><td>JSON by default; xml. One of `xml`</td></tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/forecast5) · Same job: [US National Weather Service](https://docs.webrouter.net/data-apis/nws.md#nws-forecast-get), [Open-Meteo](https://docs.webrouter.net/data-apis/openmeteo.md#openmeteo-forecast-get), [Precip](https://docs.webrouter.net/data-apis/precip.md#precip-forecast), [Tomorrow.io](https://docs.webrouter.net/data-apis/tomorrow-io.md#tomorrow-io-weather-forecast), [WeatherAPI.com](https://docs.webrouter.net/data-apis/weatherapi.md#weatherapi-forecast)

```python Python theme={null}
router.call_data_api("openweather.forecast.get", {'lat': 51.5074, 'lon': -0.1278})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.forecast.get", params={"lat": 51.5074, "lon": -0.1278})
```

### Get current air pollution

GET

`/data/2.5/air_pollution`

`openweather.air_pollution.current`

AQI (1 good to 5 very poor) and pollutant concentrations in µg/m³.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/air-pollution) · Same job: [Open-Meteo](https://docs.webrouter.net/data-apis/openmeteo.md#openmeteo-air-quality-get)

```python Python theme={null}
router.call_data_api("openweather.air_pollution.current", {'lat': 51.5074, 'lon': -0.1278})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.air_pollution.current", params={"lat": 51.5074, "lon": -0.1278})
```

### Get historical air pollution

GET

`/data/2.5/air_pollution/history`

`openweather.air_pollution.history`

Hourly AQI and pollutants between two Unix times.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>

    <tr>
      <td>
        `start`

        required
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Start, Unix seconds UTC.
      </td>
    </tr>

    <tr>
      <td>
        `end`

        required
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        End, Unix seconds UTC.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/air-pollution) · Same job: [Open-Meteo](https://docs.webrouter.net/data-apis/openmeteo.md#openmeteo-air-quality-get)

### Get current weather and forecasts (One Call)

GET

`/data/3.0/onecall`

`openweather.onecall.get`

Current, minutely (1 h), hourly (48 h) and daily (8 days) weather plus government alerts.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>

    <tr>
      <td>
        `exclude`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated parts to drop, no spaces: current, minutely, hourly, daily, alerts.
      </td>
    </tr>

    <tr><td>`units`</td><td>string</td><td>query</td><td>standard (default: Kelvin, m/s), metric (Celsius, m/s) or imperial (Fahrenheit, mph). One of `standard`, `metric`, `imperial`</td></tr>

    <tr>
      <td>
        `lang`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for city names and weather descriptions.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/one-call-3) · Same job: [US National Weather Service](https://docs.webrouter.net/data-apis/nws.md#nws-forecast-get), [Open-Meteo](https://docs.webrouter.net/data-apis/openmeteo.md#openmeteo-forecast-get), [Precip](https://docs.webrouter.net/data-apis/precip.md#precip-forecast), [Tomorrow.io](https://docs.webrouter.net/data-apis/tomorrow-io.md#tomorrow-io-weather-forecast), [WeatherAPI.com](https://docs.webrouter.net/data-apis/weatherapi.md#weatherapi-forecast)

```python Python theme={null}
router.call_data_api("openweather.onecall.get", {'lat': 51.5074, 'lon': -0.1278})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.onecall.get", params={"lat": 51.5074, "lon": -0.1278})
```

> [!NOTE]
>
> * Needs the One Call API subscription.

### Get weather at a past or future time

GET

`/data/3.0/onecall/timemachine`

`openweather.onecall.timemachine`

Weather for one timestamp from 1979-01-01 up to 4 days ahead.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>

    <tr>
      <td>
        `dt`

        required
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Unix seconds UTC.
      </td>
    </tr>

    <tr><td>`units`</td><td>string</td><td>query</td><td>standard (default: Kelvin, m/s), metric (Celsius, m/s) or imperial (Fahrenheit, mph). One of `standard`, `metric`, `imperial`</td></tr>

    <tr>
      <td>
        `lang`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for city names and weather descriptions.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/one-call-3) · Same job: [Environment and Climate Change Canada (GeoMet-OGC-API)](https://docs.webrouter.net/data-apis/eccc-geomet.md#eccc-geomet-climate-daily), [NASA POWER](https://docs.webrouter.net/data-apis/nasapower.md#nasapower-daily-point), [US National Weather Service](https://docs.webrouter.net/data-apis/nws.md#nws-observations-list), [Open-Meteo](https://docs.webrouter.net/data-apis/openmeteo.md#openmeteo-archive-get), [ACIS (NOAA Regional Climate Centers)](https://docs.webrouter.net/data-apis/rcc-acis.md#rcc-acis-station-data), [Tomorrow.io](https://docs.webrouter.net/data-apis/tomorrow-io.md#tomorrow-io-weather-recent-history)

> [!NOTE]
>
> * Needs the One Call API subscription.

### Get a daily weather summary

GET

`/data/3.0/onecall/day_summary`

`openweather.onecall.day_summary`

Aggregated weather for one date, 1979-01-02 to 1.5 years ahead.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`lat` required</td><td>number</td><td>query</td><td>Latitude. Example `51.5074`</td></tr>
    <tr><td>`lon` required</td><td>number</td><td>query</td><td>Longitude. Example `-0.1278`</td></tr>
    <tr><td>`date` required</td><td>string</td><td>query</td><td>YYYY-MM-DD. Example `2024-03-04`</td></tr>

    <tr>
      <td>
        `tz`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Timezone as ±XX:XX, when the detected one is wrong.
      </td>
    </tr>

    <tr><td>`units`</td><td>string</td><td>query</td><td>standard (default: Kelvin, m/s), metric (Celsius, m/s) or imperial (Fahrenheit, mph). One of `standard`, `metric`, `imperial`</td></tr>

    <tr>
      <td>
        `lang`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for city names and weather descriptions.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://openweathermap.org/api/one-call-3) · Same job: [Environment and Climate Change Canada (GeoMet-OGC-API)](https://docs.webrouter.net/data-apis/eccc-geomet.md#eccc-geomet-climate-daily), [NASA POWER](https://docs.webrouter.net/data-apis/nasapower.md#nasapower-daily-point), [US National Weather Service](https://docs.webrouter.net/data-apis/nws.md#nws-observations-list), [Open-Meteo](https://docs.webrouter.net/data-apis/openmeteo.md#openmeteo-archive-get), [ACIS (NOAA Regional Climate Centers)](https://docs.webrouter.net/data-apis/rcc-acis.md#rcc-acis-station-data), [Tomorrow.io](https://docs.webrouter.net/data-apis/tomorrow-io.md#tomorrow-io-weather-recent-history)

```python Python theme={null}
router.call_data_api("openweather.onecall.day_summary", {'lat': 51.5074, 'lon': -0.1278, 'date': '2024-03-04'})
```

```text MCP theme={null}
call_data_api(endpoint="openweather.onecall.day_summary", params={"lat": 51.5074, "lon": -0.1278, "date": "2024-03-04"})
```

> [!NOTE]
>
> * Needs the One Call API subscription.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.