> ## 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.

# WeatherAPI.com

> Worldwide current weather, forecasts up to 14 days, historical weather back to 2010, long-range future weather, alerts, marine and astronomy data, plus location search.

![](https://mintcdn.com/webrouter/8QP9EZc8V07Kl-0I/logo/data-apis/weatherapi.webp?fit=max\&auto=format\&n=8QP9EZc8V07Kl-0I\&q=85\&s=5e1744acf94227567146677cf2f68d41)

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

Needs&#x20;

`WEATHERAPI_API_KEY`

Endpoints

9

Auth

Key in query

[Vendor docs](https://www.weatherapi.com/docs/)

&#x20;·&#x20;

[Pricing](https://www.weatherapi.com/pricing.aspx)

## Setup

| Variable | | What it is |
| - | - | - |
| `WEATHERAPI_API_KEY` | required | A WeatherAPI.com API key (account dashboard). Sent as the key query parameter. |

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

## Notes

* Plan gates: forecast is 3-14 days depending on plan; future.json (14-300 days ahead) is Pro+; history end\_dt ranges are Pro+; minutely rain is Starter+; alerts are limited on Free.
* Dates are yyyy-MM-dd; unixdt/unixend\_dt are the Unix-timestamp alternatives (never send both forms).

## Endpoints

GET

Get current weather

Current conditions for a location.

[Open](#weatherapi-current)

GET

Get a forecast

Daily and hourly forecast up to 14 days, with optional alerts and air quality.

[Open](#weatherapi-forecast)

GET

Get historical weather

Daily and hourly observed weather for a past date (2010-01-01 on).

[Open](#weatherapi-history)

GET

Get long-range future weather

3-hourly weather 14 to 300 days ahead.

[Open](#weatherapi-future)

GET

Search locations

Matching cities and towns with ids, coordinates and country.

[Open](#weatherapi-search)

GET

Get weather alerts

Government weather alerts for a location.

[Open](#weatherapi-alerts)

GET

Get a marine forecast

Marine weather forecast for up to 7 days, with tides on Pro+.

[Open](#weatherapi-marine)

GET

Get astronomy data

Sun and moon times and moon phase for a location.

[Open](#weatherapi-astronomy)

GET

Get a location's time zone

Time zone id and local time.

[Open](#weatherapi-timezone)

### Get current weather

GET

`/current.json`

`weatherapi.current`

Current conditions for a location.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>

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

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for condition text, e.g. fr.
      </td>
    </tr>

    <tr><td>`pollen`</td><td>string</td><td>query</td><td>Include pollen data. One of `yes`, `no`</td></tr>

    <tr>
      <td>
        `current_fields`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated fields to keep, e.g. temp\_c,wind\_mph.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/) · 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), [OpenWeather](https://docs.webrouter.net/data-apis/openweather.md#openweather-weather-current), [Tomorrow.io](https://docs.webrouter.net/data-apis/tomorrow-io.md#tomorrow-io-weather-realtime)

```python Python theme={null}
router.call_data_api("weatherapi.current", {'q': 'London'})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.current", params={"q": "London"})
```

### Get a forecast

GET

`/forecast.json`

`weatherapi.forecast`

Daily and hourly forecast up to 14 days, with optional alerts and air quality.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>
    <tr><td>`days`</td><td>integer</td><td>query</td><td>1-14 (capped by plan); omitted returns today only. Example `3`</td></tr>

    <tr>
      <td>
        `dt`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        One date within the next 14 days, yyyy-MM-dd.
      </td>
    </tr>

    <tr>
      <td>
        `hour`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Only this hour, 0-23.
      </td>
    </tr>

    <tr><td>`alerts`</td><td>string</td><td>query</td><td>Include weather alerts. One of `yes`, `no`</td></tr>
    <tr><td>`aqi`</td><td>string</td><td>query</td><td>Include air quality. One of `yes`, `no`</td></tr>
    <tr><td>`pollen`</td><td>string</td><td>query</td><td>Include pollen data. One of `yes`, `no`</td></tr>

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

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for condition text, e.g. fr.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/) · 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), [OpenWeather](https://docs.webrouter.net/data-apis/openweather.md#openweather-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)

```python Python theme={null}
router.call_data_api("weatherapi.forecast", {'q': 'London', 'days': 3})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.forecast", params={"q": "London", "days": 3})
```

### Get historical weather

GET

`/history.json`

`weatherapi.history`

Daily and hourly observed weather for a past date (2010-01-01 on).

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>
    <tr><td>`dt` required</td><td>string</td><td>query</td><td>Date, yyyy-MM-dd, on or after 2010-01-01. Example `2025-01-15`</td></tr>

    <tr>
      <td>
        `end_dt`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        End date, after dt and at most 30 days later; Pro+ only.
      </td>
    </tr>

    <tr>
      <td>
        `hour`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Only this hour, 0-23.
      </td>
    </tr>

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

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for condition text, e.g. fr.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/) · 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), [OpenWeather](https://docs.webrouter.net/data-apis/openweather.md#openweather-onecall-timemachine), [ACIS (NOAA Regional Climate Centers)](https://docs.webrouter.net/data-apis/rcc-acis.md#rcc-acis-station-data)

```python Python theme={null}
router.call_data_api("weatherapi.history", {'q': 'London', 'dt': '2025-01-15'})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.history", params={"q": "London", "dt": "2025-01-15"})
```

> [!NOTE]
>
> * How far back a plan reaches varies; older dates need a higher plan.

### Get long-range future weather

GET

`/future.json`

`weatherapi.future`

3-hourly weather 14 to 300 days ahead.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>

    <tr>
      <td>
        `dt`

        required
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Date 14-300 days from today, yyyy-MM-dd.
      </td>
    </tr>

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

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Language code for condition text, e.g. fr.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/) · 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), [OpenWeather](https://docs.webrouter.net/data-apis/openweather.md#openweather-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)

> [!NOTE]
>
> * Pro+ plan only.

### Search locations

GET

`/search.json`

`weatherapi.search`

Matching cities and towns with ids, coordinates and country.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/) · Same job: [US National Weather Service](https://docs.webrouter.net/data-apis/nws.md#nws-points-get)

```python Python theme={null}
router.call_data_api("weatherapi.search", {'q': 'London'})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.search", params={"q": "London"})
```

> [!NOTE]
>
> * Pass a result's id as q=id:\<id> to other calls.

### Get weather alerts

GET

`/alerts.json`

`weatherapi.alerts`

Government weather alerts for a location.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/) · Same job: [Environment and Climate Change Canada (GeoMet-OGC-API)](https://docs.webrouter.net/data-apis/eccc-geomet.md#eccc-geomet-alerts-list), [US National Weather Service](https://docs.webrouter.net/data-apis/nws.md#nws-alerts-active)

```python Python theme={null}
router.call_data_api("weatherapi.alerts", {'q': 'London'})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.alerts", params={"q": "London"})
```

> [!NOTE]
>
> * Limited on the Free plan.

### Get a marine forecast

GET

`/marine.json`

`weatherapi.marine`

Marine weather forecast for up to 7 days, with tides on Pro+.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>

    <tr>
      <td>
        `days`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Days of forecast, 1-7.
      </td>
    </tr>

    <tr><td>`tides`</td><td>string</td><td>query</td><td>Include tide data (Pro+). One of `yes`, `no`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/) · Same job: [Open-Meteo](https://docs.webrouter.net/data-apis/openmeteo.md#openmeteo-marine-get)

```python Python theme={null}
router.call_data_api("weatherapi.marine", {'q': 'London'})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.marine", params={"q": "London"})
```

### Get astronomy data

GET

`/astronomy.json`

`weatherapi.astronomy`

Sun and moon times and moon phase for a location.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/)

```python Python theme={null}
router.call_data_api("weatherapi.astronomy", {'q': 'London'})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.astronomy", params={"q": "London"})
```

### Get a location's time zone

GET

`/timezone.json`

`weatherapi.timezone`

Time zone id and local time.

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>Location: city name, 'lat,lon' decimals, US zip, UK or Canada postcode, metar:\<code>, iata:\<code>, auto:ip, an IP address, or id:\<id> from search. Example `London`</td></tr>
  </tbody>
</table>

[Vendor docs](https://www.weatherapi.com/docs/)

```python Python theme={null}
router.call_data_api("weatherapi.timezone", {'q': 'London'})
```

```text MCP theme={null}
call_data_api(endpoint="weatherapi.timezone", params={"q": "London"})
```


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