DEV Community

Alex Spinov
Alex Spinov

Posted on

Open-Meteo Has a Free API — Get Weather Data for Any Location Without an API Key

Weather data is one of the most common API needs — from dashboards to travel apps to IoT projects. But most weather APIs require registration, API keys, and have restrictive free tiers.

Open-Meteo is completely free, open-source, and requires no API key. Just send a request and get weather data.

What You Get

One HTTP request returns:

  • Current temperature, wind speed, wind direction
  • Hourly forecasts (up to 16 days)
  • Daily min/max temperature, precipitation, sunrise/sunset
  • Historical weather data (back to 1940)
  • Air quality index
  • Marine and flood forecasts

Try It Right Now

curl "https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41&current_weather=true"
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "latitude": 52.52,
  "longitude": 13.42,
  "current_weather": {
    "temperature": 15.3,
    "windspeed": 12.4,
    "winddirection": 210,
    "weathercode": 3,
    "is_day": 1,
    "time": "2026-03-26T10:00"
  }
}
Enter fullscreen mode Exit fullscreen mode

That's Berlin right now — 15.3°C with moderate wind. No key needed.

Python Example: 7-Day Forecast

import requests

def get_forecast(city_lat, city_lon, city_name=""):
    url = "https://api.open-meteo.com/v1/forecast"
    params = {
        "latitude": city_lat,
        "longitude": city_lon,
        "daily": "temperature_2m_max,temperature_2m_min,precipitation_sum",
        "timezone": "auto",
        "forecast_days": 7
    }
    response = requests.get(url, params=params)
    data = response.json()

    print(f"7-Day Forecast for {city_name} ({city_lat}, {city_lon})")
    print("-" * 50)

    for i, date in enumerate(data["daily"]["time"]):
        max_t = data["daily"]["temperature_2m_max"][i]
        min_t = data["daily"]["temperature_2m_min"][i]
        rain = data["daily"]["precipitation_sum"][i]
        print(f"{date}: {min_t}°C — {max_t}°C | Rain: {rain}mm")

# Try it
get_forecast(48.8566, 2.3522, "Paris")
get_forecast(40.7128, -74.0060, "New York")
get_forecast(35.6762, 139.6503, "Tokyo")
Enter fullscreen mode Exit fullscreen mode

JavaScript (Node.js) Example

async function getWeather(lat, lon, city) {
  const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current_weather=true&hourly=temperature_2m&timezone=auto`;

  const res = await fetch(url);
  const data = await res.json();

  const current = data.current_weather;
  console.log(`${city}: ${current.temperature}°C, wind ${current.windspeed} km/h`);

  // Next 6 hours
  const now = new Date();
  const hourIndex = now.getHours();
  const next6 = data.hourly.temperature_2m.slice(hourIndex, hourIndex + 6);
  console.log(`Next 6 hours: ${next6.map(t => t + "°C").join(", ")}`);
}

getWeather(51.5074, -0.1278, "London");
Enter fullscreen mode Exit fullscreen mode

Historical Weather Data (Back to 1940!)

This is where Open-Meteo really shines. Most APIs charge premium for historical data:

import requests

def historical_weather(lat, lon, start, end):
    url = "https://archive-api.open-meteo.com/v1/archive"
    params = {
        "latitude": lat,
        "longitude": lon,
        "start_date": start,
        "end_date": end,
        "daily": "temperature_2m_max,temperature_2m_min,precipitation_sum",
        "timezone": "auto"
    }
    response = requests.get(url, params=params)
    return response.json()

# What was the weather in London on D-Day?
data = historical_weather(51.5074, -0.1278, "1944-06-06", "1944-06-06")
print(data["daily"])
# Real historical weather data — no API key, completely free
Enter fullscreen mode Exit fullscreen mode

Air Quality Index

curl "https://air-quality-api.open-meteo.com/v1/air-quality?latitude=52.52&longitude=13.41&current=pm10,pm2_5,carbon_monoxide,nitrogen_dioxide"
Enter fullscreen mode Exit fullscreen mode

Get real-time air quality data for any location — PM2.5, PM10, CO, NO2 levels.

Compared to Alternatives

Service Free Tier Key Required Historical Data Open Source
Open-Meteo 10K req/day No Yes (1940+) Yes
OpenWeatherMap 1K req/day Yes Paid No
WeatherAPI 1M req/month Yes Paid No
Visual Crossing 1K req/day Yes Yes No
Tomorrow.io 500 req/day Yes No No

Open-Meteo wins on every metric: more requests, no key, free historical data, AND it's open source.

Real-World Use Cases

1. Travel planning app — A developer I know built a trip planner that shows weather forecasts for each destination. Open-Meteo made it possible without any API costs.

2. Agricultural monitoring — Farmers use historical precipitation data to plan irrigation schedules. 80+ years of rainfall data, completely free.

3. Smart home dashboards — Display current weather on your Raspberry Pi dashboard. One fetch() call, no token management.

4. Climate research — Compare temperature trends across decades. Historical data back to 1940 makes this trivial.

Pro Tips

  1. Use the geocoding API to find coordinates by city name:
curl "https://geocoding-api.open-meteo.com/v1/search?name=Tokyo"
Enter fullscreen mode Exit fullscreen mode
  1. Combine with IP-API for auto-location:
import requests

# Get user location from IP
loc = requests.get("http://ip-api.com/json/").json()
# Get weather for that location
weather = requests.get(f"https://api.open-meteo.com/v1/forecast?latitude={loc['lat']}&longitude={loc['lon']}&current_weather=true").json()
print(f"Weather in {loc['city']}: {weather['current_weather']['temperature']}°C")
Enter fullscreen mode Exit fullscreen mode
  1. Hourly data for charts:
curl "https://api.open-meteo.com/v1/forecast?latitude=40.71&longitude=-74.01&hourly=temperature_2m,precipitation&forecast_days=3"
Enter fullscreen mode Exit fullscreen mode

More Free APIs (No Key Required)

Combine all three: detect location → show local weather → display prices in local currency. Zero API keys needed.

Need to collect weather data at scale for thousands of locations? I've built production-grade data extraction tools that handle batch API calls, scheduling, and data storage.

Need a custom weather data pipeline? Email me at spinov001@gmail.com


What's the most creative thing you've built with weather data? Share in the comments!


Need data from the web without writing scrapers? Check my *Apify actors** — ready-made scrapers for HN, Reddit, LinkedIn, and 75+ more sites. Or email: spinov001@gmail.com*

Top comments (0)