WeatherAPI

Weather API with other stuff like Astronomy and Geolocation API

WeatherAPI provides current weather, forecasts (up to 14 days), historical weather, astronomy data (sunrise/sunset/moon phase), time zone lookups, and IP-based geolocation — all through a single API key. It supports location lookup by city name, coordinates, IP address, or postal code, making it very flexible. For OpenClaw agents, WeatherAPI stands out for bundling weather with astronomy and timezone data. Your agent can get weather, sunrise/sunset times, and moon phases in a single integration — useful for daily briefings, photography planning, or outdoor activity scheduling. The free tier is generous for personal use.

Tags: forecast, weather

Category: Weather

Use Cases

  • Build morning briefings with weather, AQI, and sunrise/sunset times in one API call
  • Plan outdoor activities using combined weather and astronomy data
  • Use IP-based geolocation to auto-detect location for weather lookups

Tips

  • The free tier's 1M calls/month is the most generous of any weather API — ideal for frequent polling
  • Use &aqi=yes for air quality data at no extra cost
  • The astronomy endpoint is unique — sunrise, sunset, moonrise, moon phase in one call

Known Issues & Gotchas

  • Free tier is limited to 3-day forecast — 14-day requires Pro ($9/mo)
  • Historical weather and weather alerts are paid-only features
  • API key is passed as a query parameter, not a header — be careful with logging

Frequently Asked Questions

Why choose WeatherAPI over OpenWeatherMap or Open-Meteo?

WeatherAPI has the most generous free tier (1M calls/month), bundles astronomy data, and supports the most location input types (city, coords, IP, postal code). Open-Meteo has more variables; OpenWeatherMap has more community support.

Does the free tier include air quality data?

Yes. Add &aqi=yes to any request to get air quality data including PM2.5, PM10, and EPA index — all on the free tier.

Can I get historical weather data?

Historical data requires the Pro plan ($9/mo). The free tier covers current weather and 3-day forecasts only.