API Directory › 🌦 Weather › WeatherAPI
API KeyHTTPSCORS

WeatherAPI

Real-time weather, forecasts, air quality, astronomy and historical weather with a generous free tier.

Category
Auth
API Key
HTTPS
Yes
CORS
Yes
Open WeatherAPI docs ↗

What it does

WeatherAPI.com offers current weather, forecasts up to 14 days, history, marine and astronomy data, air quality, weather alerts, time zone lookup, sports fixtures and IP/location search — all as JSON or XML from one keyed endpoint.

Base URL

https://api.weatherapi.com/v1

Authentication

Sign up for a free API key and pass it as ?key=YOUR_KEY with a q= location (city name, lat,lon, postcode, IATA code, IP, or auto:ip).

Code examples

curl
curl -s "https://api.weatherapi.com/v1/current.json?key=$WAPI_KEY&q=Nairobi&aqi=no"
Python
import requests

r = requests.get("https://api.weatherapi.com/v1/forecast.json", params={
    "key": KEY, "q": "Lisbon", "days": 3, "alerts": "yes"}, timeout=10)
fc = r.json()["forecast"]["forecastday"]
for d in fc:
    print(d["date"], d["day"]["maxtemp_c"], d["day"]["condition"]["text"])

Rate limits & quotas

Free plan: about 1,000,000 calls/month, with current conditions and a 3-day forecast, plus 7 days of history; longer forecasts, bulk requests and more history are paid. Over the quota you get HTTP 403 with error code 2007/2008.

Key response fields

current.temp_c / temp_fCurrent temperature
current.condition.text / .iconDescription and icon URL
forecast.forecastday[].day.maxtemp_c / mintemp_cDaily extremes
forecast.forecastday[].astroSunrise, sunset, moon phase
location.tz_id / localtimeTime zone and local time of the location

Common errors

401 / code 1002API key not provided.
403 / code 2006API key invalid.
403 / code 2007Monthly call quota exceeded.
400 / code 1006No location found matching q.

When to use it (and alternatives)

A great free commercial-friendly all-rounder when the 3-day forecast limit is acceptable — the huge monthly quota suits high-traffic sites. For longer free forecasts and history without a key, Open-Meteo wins; for richer data layers see Tomorrow.io.

FAQ

How many forecast days does the free plan give?

Three. The API accepts days up to 14, but free keys are capped at 3 — asking for more silently returns 3.

What can I put in the q parameter?

City name, "lat,lon", UK/US/Canada postcode, IATA airport code, an IP address, or auto:ip to use the caller’s IP.

Is air quality included for free?

Yes — add aqi=yes to current.json/forecast.json and the response includes an air_quality block.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

Weather Checker

Related Weather APIs

← Back

More Weather APIs · All 196 APIs