Weather History API
Weather History API
We provide hourly historical weather data for any location on the globe via Weather History API. Availability of hourly historical data depends on a type of your subscription.
You can also download this data in JSON or CSV format - please read History Bulk and History Forecast Bulk.
Call hourly historical data
https://history.openweathermap.org/data/2.5/history/city?lat={lat}&lon={lon}&type=hour&start={start}&end={end}&appid={API key}https://history.openweathermap.org/data/2.5/history/city?lat={lat}&lon={lon}&type=hour&start={start}&cnt={cnt}&appid={API key}Parameters | ||
|---|---|---|
| required | Latitude. If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API |
| required | Longitude. If you need the geocoder to automatic convert city names and zip-codes to geo coordinates and the other way around, please use our Geocoding API |
| required | Type of the call, keep this parameter in the API call as |
| required | Your unique API key (you can always find it on your account page under the "API key" tab) |
| optional | Start date (unix time, UTC time zone), e.g. start=1369728000 |
| optional | End date (unix time, UTC time zone), e.g. end=1369789200 |
| optional | A number of timestamps in response (one per hour, can be used instead of the parameter |
Please use Geocoder API if you need automatic convert city names and zip-codes to geo coordinates and the other way around.
Please note that built-in geocoder has been deprecated. Although it is still available for use, bug fixing and updates are no longer available for this functionality.
https://history.openweathermap.org/data/2.5/history/city?lat=41.85&lon=-87.65&appid={API key}To view the API response, expand the example by clicking the triangle.If you do not see some of the parameters in your API response it means that these weather phenomena are just not happened for the time of measurement for the city or location chosen. Only really measured or calculated data is displayed in API response.
List of all API parameters with units openweathermap.org/weather-data.
JSON
To view the API response, expand the example by clicking the triangle.message Internal parametercod Internal parametercity_id City ID. Please note that built-in geocoder functionality has been deprecated. Learn more herecalctime Internal parameterlistdt Time of data calculation, unix, UTCmainmain.temp Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. Learn moremain.feels_like This temperature parameter accounts for the human perception of weather. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. Learn moremain.pressure Atmospheric pressure on the sea level, hPamain.humidity Humidity, %main.temp_min Minimum temperature within a large city or a megalopolis (optional parameter). Please find more here. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. Learn moremain.temp_max Maximum temperature within a large city or a megalopolis (optional parameter). Please find more here. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. Learn moremain.sea_level Atmospheric pressure on the sea level, hPamain.grnd_level Atmospheric pressure on the ground level, hPawindwind.speed Wind speed. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour. Learn morewind.deg Wind direction, degrees (meteorological)cloudsclouds.all Cloudiness, %rainrain.1h Rain volume for the last 1 hour, mm. Please note that only mm as units of measurement are available for this parameterrain.3h Rain volume for the last 3 hours, mm. Please note that only mm as units of measurement are available for this parametersnowsnow.1h Snow volume for the last 1 hour, mm. Please note that only mm as units of measurement are available for this parametersnow.3h Snow volume for the last 3 hours, mm. Please note that only mm as units of measurement are available for this parameterweather (more info Weather condition codes)weather.id Weather condition idweather.main Group of weather parameters (Rain, Snow, Clouds etc.)weather.description Weather condition within the group. Please find more hereweather.icon Weather icon idWe provide a broad variety of products such as One Call API 3.0, Solar Irradiance & Energy Prediction service, Road Risk API, Air Pollution API and solutions for advanced weather parameters like solar irradiance data, UVI, dew point, government weather alerts, etc. Please review our product list page and find more info in the product documentation and pricing pages.
List of weather condition codes
List of weather condition codes with icons (range of thunderstorm, drizzle, rain, snow, clouds, atmosphere etc.)
Min/max temperature in historical weather API and forecast API
Please, do not confuse min/max parameters in hourly historical weather API and forecast API. In hourly historical weather API temp_min and temp_max are optional parameters mean min / max temperature in the city at the moment of calculation to show deviation from the average temperature just for your reference. For large cities and megalopolises geographically expanded it might be applicable. In most cases both temp_min and temp_max parameters have the same volume as 'temp'. Please, use temp_min and temp_max parameters optionally.
"main":{
"temp":306.15, // temperature at the moment of calculation
"pressure":1013,
"humidity":44,
"temp_min":306.15, //min temperature in the city at the moment of calculation
"temp_max":306.15 //max temperature in the city at the moment of calculation
},For comparison look at example of daily forecast weather API response
"dt":1406080800,
"temp":{
"day":297.77, //daily averaged temperature
"min":293.52, //daily min temperature
"max":297.77, //daily max temperature
"night":293.52, //night temperature
"eve":297.77, //evening temperature
"morn":297.77, //morning temperature
}Other features
Requesting API calls by geographical coordinates is the most accurate way to specify any location. If you need to convert city names and zip-codes to geo coordinates and the other way around automatically, please use our Geocoding API.
Please use Geocoder API if you need automatic convert city names and zip-codes to geo coordinates and the other way around.
Please note that API requests by city name and city id have been deprecated. Although they are still available for use, bug fixing and updates are no longer available for this functionality.
Call historical data by city name.
https://history.openweathermap.org/data/2.5/history/city?q={city name},{country code}&type=hour&start={start}&end={end}&appid={API key}https://history.openweathermap.org/data/2.5/history/city?q={city name},{country code}&type=hour&start={start}&cnt={cnt}&appid={API key}Parameters | ||
|---|---|---|
| required | City name, state code and country code divided by comma, please refer to ISO 3166 for the state codes or country codes. You can specify the parameter not only in English. In this case, the API response should be returned in the same language as the language of requested location name if the location is in our predefined list of more than 200,000 locations. |
| required | type of the call, keep this parameter in the API call as |
| required | Your unique API key (you can always find it on your account page under the "API key" tab) |
| optional | Start date (unix time, UTC time zone), e.g. start=1369728000 |
| optional | End date (unix time, UTC time zone), e.g. end=1369789200 |
| optional | A number of timestamps in response (one per hour, can be used instead of |
https://history.openweathermap.org/data/2.5/history/city?q=London,UK&appid={API key}To view the API response, expand the example by clicking the triangle.There is a possibility to receive a central district of the city/town with its own parameters (geographic coordinates/id/name) in API response. Please see the example below.
https://history.openweathermap.org/data/2.5/history/city?q=Munchen,DE&appid={API key}To view the API response, expand the example by clicking the triangle.Call historical data by city ID.
The list of city IDs can be downloaded here.
https://history.openweathermap.org/data/2.5/history/city?id={id}&type=hour&start={start}&end={end}&appid={API key}https://history.openweathermap.org/data/2.5/history/city?id={id}&type=hour&start={start}&cnt={cnt}&appid={API key}Parameters | ||
|---|---|---|
| required | City ID. The list of city IDs 'city.list.json.gz' can be downloaded here. |
| required | Type of the call, keep this parameter in the API call as |
| required | Your unique API key (you can always find it on your account page under the "API key" tab) |
| optional | Start date (unix time, UTC time zone), e.g. start=1369728000 |
| optional | End date (unix time, UTC time zone), e.g. end=1369789200 |
| optional | Amount of returned data (one per hour, can be used instead of |
https://history.openweathermap.org/data/2.5/history/city?id=2885679&type=hour&appid={API key}To view the API response, expand the example by clicking the triangle.Only for Professional and Expert plans: The maximum historical data depth in one API response is one week.
If you specify a historical data depth more than one week in the request, you will receive a historical data only for first week from start date in one API response.
If you want to get the historical data depth more than one week, then please use several queries.
standard, metric, and imperial units are available. List of all API parameters with available units.
Parameters | ||
|---|---|---|
| optional |
|
Standard (by default): temperature in Kelvin, wind speed in meter/sec
https://history.openweathermap.org/data/2.5/history/city?lat=41.85&lon=-87&type=hour&start=1643720400&end=1643806800&appid={API key}To view the API response, expand the example by clicking the triangle.Metric: temperature in Celsius, wind speed in meter/sec
https://history.openweathermap.org/data/2.5/history/city?lat=41.85&lon=-87&type=hour&start=1643720400&end=1643806800&units=metric&appid={API key}To view the API response, expand the example by clicking the triangle.Imperial: temperature in Fahrenheit, wind speed in miles/hour
https://history.openweathermap.org/data/2.5/history/city?lat=41.85&lon=-87&type=hour&start=1643720400&end=1643806800&units=imperial&appid={API key}To view the API response, expand the example by clicking the triangle.