Historical data

Through our API we provide hourly historical weather data for cities and historical data from weather stations. Find more about historical data availability in price-list.

Hourly historical data for cities

Availbility of hourly historical data archive depends on a type of your account. For more information please refer to the price.

By city ID

Description:

Call historical data by city ID. API responds with exact result.

List of city ID city.list.json.gz can be downloaded here http://bulk.openweathermap.org/sample/

API call:

http://api.openweathermap.org/data/2.5/history/city?id={id}&type=hour&start={start}&end={end}

http://api.openweathermap.org/data/2.5/history/city?id={id}&type=hour&start={start}&cnt={cnt}

Parameters:

id city ID

type type of the call, keep this parameter in the API call as 'hour'

start start date (unix time, UTC time zone), e.g. start=1369728000

end end date (unix time, UTC time zone), e.g. end=1369789200

cnt amount of returned data (one per hour, can be used instead of 'end')

Examples of API calls:
http://api.openweathermap.org/data/2.5/history/city?id=2885679&type=hour

By city name

Description:
Call historical data by city name.
API call:

http://api.openweathermap.org/data/2.5/history/city?q={city ID},{country code}&type=hour&start={start}&end={end}

http://api.openweathermap.org/data/2.5/history/city?q={city ID},{country code}&type=hour&start={start}&cnt={cnt}

Parameters:

q city name and country code divided by comma, use ISO 3166 country codes

type type of the call, keep this parameter in the API call as 'hour'

start start date (unix time, UTC time zone), e.g. start=1369728000

end end date (unix time, UTC time zone), e.g. end=1369789200

cnt amount of returned data (one per hour, can be used instead of 'end')

Exmaples of API calls:
http://api.openweathermap.org/data/2.5/history/city?q=London,UK

By geographic coordinates

Description:
Call historical data by city name.
API call:

http://api.openweathermap.org/data/2.5/history/city?lat={lat}&lon={lon}&type=hour&start={start}&end={end}

http://api.openweathermap.org/data/2.5/history/city?lat={lat}&lon={lon}&type=hour&start={start}&cnt={cnt}

Parameters:

lat, lon coordinates of the location of your interest

type type of the call, keep this parameter in the API call as 'hour'

start start date (unix time, UTC time zone), e.g. start=1369728000

end end date (unix time, UTC time zone), e.g. end=1369789200

cnt amount of returned data (one per hour, can be used instead of 'end')

Examples of API calls:
http://api.openweathermap.org/data/2.5/history/city?lat=41.85&lon=-87.65

Weather parameters in API respond for hourly historical data for cities

If you do not see some of the parameters in your API respond 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 respond.

JSON

Example of API response:

{"coord":
{"lon":145.77,"lat":-16.92},
"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04n"}],
"base":"cmc stations",
"main":{"temp":293.25,"pressure":1019,"humidity":83,"temp_min":289.82,"temp_max":295.37},
"wind":{"speed":5.1,"deg":150},
"clouds":{"all":75},
"rain":{"3h":3},
"dt":1435658272,
"sys":{"type":1,"id":8166,"message":0.0166,"country":"AU","sunrise":1435610796,"sunset":1435650870},
"id":2172797,
"name":"Cairns",
"cod":200}

Parameters:
  • coord
    • coord.lon City geo location, longitude
    • coord.lat City geo location, latitude
  • weather (more info Weather condition codes)
    • weather.id Weather condition id
    • weather.main Group of weather parameters (Rain, Snow, Extreme etc.)
    • weather.description Weather condition within the group
    • weather.icon Weather icon id
  • base Internal parameter
  • main
    • main.temp Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
    • main.pressure Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa
    • main.humidity Humidity, %
    • main.temp_min Minimum temperature at the moment. This is deviation from temperature that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
    • main.temp_max Maximum temperature at the moment. This is deviation from temperature that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
    • main.sea_level Atmospheric pressure on the sea level, hPa
    • main.grnd_level Atmospheric pressure on the ground level, hPa
  • wind
    • wind.speed Wind speed. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.
    • wind.deg Wind direction, degrees (meteorological)
  • clouds
    • clouds.all Cloudiness, %
  • rain
    • rain.3h Rain volume for the last 3 hours
  • snow
    • snow.3h Snow volume for the last 3 hours
  • dt Time of data calculation, unix, UTC
  • id City ID
  • name City name
  • cod Internal parameter

List of weather condition codes

List of weather condition codes with icons (range of thunderstorm, drizzle, rain, snow, clouds, atmosphere including extreme conditions like tornado, hurricane 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.

Example of historical weather for cities API response:
"main":{
"temp":306.15, // temperature at the moment of calculation
"pressure":1013,
"humidity":44,
"temp_min":306, //min  temperature in the city at the moment of calculation
"temp_max":306 //max  temperature in the city at the moment of calculation
},
For comparison look at example of daily forecast weather API respond:
"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