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

Request
// 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.

Visual Guide

Getting Your API Key — Step by Step

Step 1: Create a free account

OpenWeatherMap signup form with numbered annotations: 1 the Username field, 2 the Email field, 3 the Password field, and 4 the Create Account button
Screenshot of openweathermap.org (July 2026), annotated by APIs Score
  • 1 Choose a username — this is just your display name on the platform.
  • 2 Enter your email address — you will need to verify it, so use a real inbox.
  • 3 Set a password for your new account.
  • 4 Tick the reCAPTCHA checkbox, then click Create Account. Verify your email; your API key is activated automatically, but activation can take up to two hours.

Step 2: Use the key in your request

OpenWeatherMap documentation showing an example API call URL, with annotation 1 highlighting the appid={API key} query parameter at the end of the URL
Screenshot of openweathermap.org (July 2026), annotated by APIs Score
  • 1 Pass your key as the appid query parameter — replace {API key} with your own key to authenticate the request. Never commit your key to a public repository; keep it in an environment variable instead.

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

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

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 →