OpenWeatherMap
Weather
- Authentication
- API Key
- HTTPS
- Yes
- CORS
- Unknown
- Category
- Weather
- Documentation / URL
- https://openweathermap.org/api
Overview
OpenWeatherMap is one of the most widely used weather APIs. It provides current weather, 5-day/3-hour forecasts, and — on paid tiers — historical weather, minutely precipitation, and air pollution data for any location on earth.
You need a free API key to get started. The free tier covers current weather and the 5-day forecast, which is enough for most hobby and prototype projects.
Quick Start
Get current weather by city name (replace YOUR_API_KEY):
curl "https://api.openweathermap.org/data/2.5/weather?q=London&units=metric&appid=YOUR_API_KEY"
5-day / 3-hour forecast:
curl "https://api.openweathermap.org/data/2.5/forecast?q=London&units=metric&appid=YOUR_API_KEY"
Key parameters:
| Parameter | Purpose |
|---|---|
q |
city name (London, London,uk) — or use lat/lon instead |
units=metric |
Celsius; imperial for Fahrenheit (default is Kelvin!) |
lang=zh_cn |
localized descriptions |
appid |
your API key |
Note: responses use Kelvin by default — pass
units=metricunless you really want Kelvin.
Authentication
- Create a free account at openweathermap.org and generate an API key (takes a couple of minutes to activate after signup).
- Send the key as the
appidquery parameter on every request. - Keep the key server-side; never expose it in client-side code.
Rate Limits & Notes
- Free tier: around 1,000 calls/day for current weather + forecast (exact quota on the pricing page).
- Requests over the limit return a
429; the hourly/daily counters reset on a rolling basis. - Historical, minutely-precipitation and air-pollution endpoints require paid subscriptions.
- Data coverage is global, but update frequency and accuracy vary by region.
FAQ
Is OpenWeatherMap free? There is a free tier (roughly 1,000 calls/day) covering current weather and the 5-day forecast. Higher limits and extra endpoints are paid.
Why is the temperature number so large?
OpenWeatherMap returns Kelvin by default — add units=metric for Celsius.
How do I get an API key? Register at openweathermap.org, go to the API keys section, and generate one. Keys usually activate within minutes.
Can I call it from the browser? CORS is not guaranteed — call it from a server or a small proxy to be safe.