Free Public Weather APIs, How to use it

Dec 14, 2024

explores several free public weather APIs and provides guidance on how to utilize them. Note that "free" often implies limitations on usage, such as daily call limits or restrictions on commercial use.

Free Public Weather APIs, How to use it

Free Public Weather APIs: How to Use Them

This article explores several free public weather APIs and provides guidance on how to utilize them. Note that "free" often implies limitations on usage, such as daily call limits or restrictions on commercial use. Always check the specific API's terms of service.

Open-Meteo.com: Free Open-Source Weather API

Open-Meteo provides a free open-source weather API for non-commercial use. No API key is required to get started.

Key Features:

  • High Resolution: Leverages global (11 km) and mesoscale (1 km) weather models for precise forecasts.
  • Rapid Updates: Local weather models update hourly, incorporating data from rain radars and various sources (airplanes, buoys, radar, satellites).
  • 80 Years Historical Data: Access hourly weather data at a 10-kilometer resolution going back over 80 years via their Historical Weather API. Recent data is also archived at 1-kilometer resolution.
  • Open-Source: The entire codebase is available on GitHub under the AGPLv3 license. You can even set up your own API instances for virtually unlimited calls.
  • Data License: Data is licensed under Attribution 4.0 International (CC BY 4.0), allowing sharing and adaptation, even commercially.

How to Use:

The API uses simple HTTP requests and returns data in JSON format. Here are examples using curl:

Current Weather:

$ curl "https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&current=temperature_2m,wind_speed_10m&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m"

This returns JSON like this (truncated):

{
  "current": {
    "time": "2022-01-01T15:00",
    "temperature_2m": 2.4,
    "wind_speed_10m": 11.9,
  },
  "hourly": {
    "time": ["2022-07-01T00:00","2022-07-01T01:00", ...],
    "wind_speed_10m": [3.16, 3.02, 3.3, 3.14, 3.2, 2.95, ...],
    "temperature_2m": [13.7, 13.3, 12.8, 12.3, 11.8, ...],
    "relative_humidity_2m": [82, 83, 86, 85, 88, 88, 84, 76, ...],
  }
}

Past Weather:

$ curl "https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&past_days=10&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m"

Historical Data:

$ curl "https://archive-api.open-meteo.com/v1/era5?latitude=52.52&longitude=13.41&start_date=2021-01-01&end_date=2021-12-31&hourly=temperature_2m"

Remember to replace latitude and longitude with your desired coordinates. Consult the Open-Meteo documentation for a complete list of parameters and data variables.

National Weather Service API (weather.gov)

The National Weather Service API (api.weather.gov) offers access to forecasts, alerts, observations, and other weather data. It's free to use for any purpose.

Key Features:

  • Open Data: All data is open and free.
  • JSON-LD: Uses JSON-LD for machine data discovery.
  • Content Negotiation: Uses headers to specify response version and format (GeoJSON, JSON-LD, DWML, OXML, CAP, ATOM).
  • Authentication: Requires a User-Agent header to identify your application (an API key will be implemented in the future).
  • Feature Flags: Uses feature flags to enable new features.

How to Use:

The API is located at https://api.weather.gov. Examples:

  • Forecast: https://api.weather.gov/gridpoints/{office}/{gridX},{gridY}/forecast (replace placeholders)
  • Points: https://api.weather.gov/points/{latitude},{longitude} (replace placeholders)
  • Alerts: https://api.weather.gov/alerts/active?area={state} (replace placeholders)
National Weather Service Important Notice

OpenWeatherMap.org API

OpenWeatherMap (openweathermap.org/api) offers a range of weather APIs, including the popular One Call API 3.0. It has a freemium model with a free tier and paid plans for increased usage and features.

Key Features:

  • One Call API 3.0: Provides current weather, minute-by-minute forecasts, historical data, and future predictions.
  • Historical Data: Accesses weather data back to 01-01-1979.
  • Global Weather Maps: Offers various weather map layers.
  • Air Pollution Data: Includes air quality information.
  • Freemium Model: 1000 free API calls per day; paid plans for higher usage.

How to Use:

Requires an API key (APPID) obtained after signing up. The API key is included in all API calls. See their How to Start guide for detailed instructions and examples.

OpenWeatherMap Android App Banner

Weatherbit (Reddit Recommendation)

A Reddit user recommends Weatherbit, noting its free plan and trial version with many features. Further details would require visiting their website. This API is not further detailed here due to lack of provided information.

This information should help you get started with free public weather APIs. Remember to always review the terms of service and documentation for each specific API before use.

Recent Posts