OpenWeatherMap API

⭐ Beginner's Pick Weather / API Key Beginner HTTPS
60 calls/minute

Overview

OpenWeatherMap is one of the most popular weather APIs, providing current conditions, forecasts, and historical data for millions of locations worldwide. It offers a generous free tier with 1,000 API calls per day, making it ideal for hobby projects and prototypes. Beginners can quickly display current temperature, humidity, and weather descriptions with just a city name or coordinates.

💡

Beginner Tip

Sign up at openweathermap.org to get a free API key instantly. Use the units=metric or units=imperial parameter to get temperatures in Celsius or Fahrenheit without any conversion.

Available Data

Temperature
Conditions
Humidity
wind speed
forecast data
Response fields: main temp, weather, main humidity

Example Response

JSON Response
{
  "location": "Tokyo",
  "temperature": {
    "current": 22,
    "feels_like": 24,
    "min": 18,
    "max": 26
  },
  "condition": "Partly Cloudy",
  "humidity": 65,
  "wind": {
    "speed": 12,
    "direction": "NE"
  },
  "forecast": [
    {
      "date": "2025-01-16",
      "high": 25,
      "low": 17,
      "condition": "Sunny"
    }
  ]
}

Field Reference

main.temp Current temperature in the unit specified by the units parameter (default Kelvin)
main.humidity Current relative humidity as a percentage (0-100)
weather[0].description Human-readable weather condition description such as "light rain" or "clear sky"
wind.speed Wind speed in meters per second (or mph if units=imperial)
dt Unix timestamp of the data calculation time in UTC
sys.country Two-letter country code (ISO 3166) for the location

Implementation Example

// Get current weather by coordinates
const url = "https://api.openweathermap.org/data/2.5/weather?lat=44.34&lon=10.99&appid=YOUR_API_KEY&units=metric";

const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();

console.log(`Temperature: ${data.main.temp}°C`);
console.log(`Conditions: ${data.weather[0].description}`);
console.log(`Humidity: ${data.main.humidity}%`);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized API key is invalid or not yet activated
New API keys take up to 2 hours to activate after registration; double-check for typos in your appid parameter
404 Not Found City name is misspelled or not recognized
Use coordinates (lat/lon) instead of city names for reliable results, or use the Geocoding API first to resolve a city name to coordinates
429 Too Many Requests Exceeded the free plan limit of 60 calls per minute
Cache API responses for at least 10 minutes since weather data does not change second by second

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Weather
Difficulty Beginner
Verified: 2026-04-04

Alternatives to OpenWeatherMap

Technical alternatives for different use cases.

More affordable with larger free tier

Better For

Minute-by-minute precipitation forecasts

Trade-off

Budget projects needing decent weather data

Includes air pollution API alongside weather data

Better For

Dedicated air quality monitoring with detailed pollutant data

Trade-off

Apps that need both weather and air quality in one API

Fully open-source, no API key required for non-commercial use

Better For

Open-source projects and non-commercial use

Trade-off

Commercial applications needing SLA guarantees

Strong historical weather data going back decades

Better For

Historical weather analysis and climate research

Trade-off

Real-time weather alerts and push notifications

Comparable coverage with more generous free tier (1M calls/month vs 1K)

Better For

Developers who need higher free tier limits

Trade-off

Legacy integrations already using OpenWeatherMap

Simpler API with focus on current weather and historical data

Better For

Simple current-weather lookups with minimal setup

Trade-off

Forecast accuracy and granular hourly predictions

Recipes Using OpenWeatherMap

Build something with this API. Each recipe includes step-by-step instructions and code outlines.

Similar APIs

View All →