OpenWeatherMap API

Get the current weather, daily forecast for 16 days, and a three-hour-interval forecast for 5 days for your city. Helpful stats, graphics, and this day in history charts are available for your reference. Interactive maps show precipitation, clouds, pressure, wind around your location stations. Data is available in JSON, XML, or HTML format. Note: This sample Swagger file covers the current endpoint only from the OpenWeatherMap API.

Note: All parameters are optional, but you must select at least one parameter. Calling the API by city ID (using the id parameter) will provide the most precise location results.
More information: https://openweathermap.org/api
Contact Info: [email protected]
Version: 2.5.3
BasePath:/data/2.5/
CC Attribution-ShareAlike 4.0 (CC BY-SA 4.0)
https://openweathermap.org/price

Access

  1. APIKey KeyParamName:appid KeyInQuery:true KeyInHeader:false

Methods

[ Jump to Models ]

Table of Contents

CurrentWeatherData

CurrentWeatherData

Up
get /weather
Call current weather data for one location (currentWeatherData)
Access current weather data for any location on Earth including over 200,000 cities! Current weather is frequently updated based on global models and data from more than 40,000 weather stations.

Query parameters

q (optional)
Query Parameter — <strong>City name</strong>. <em>Example: London</em>. You can call by city name, or by city name and country code. The API responds with a list of results that match a searching word. For the query value, type the city name and optionally the country code divided by a comma; use ISO 3166 country codes.
id (optional)
Query Parameter — <strong>City ID</strong>. <em>Example: <code>2172797</code></em>. You can call by city ID. The API responds with the exact result. The List of city IDs can be downloaded <a href="http://bulk.openweathermap.org/sample/">here</a>. You can include multiple cities in parameter — just separate them by commas. The limit of locations is 20. <em>Note: A single ID counts as a one API call. So, if you have city IDs. it's treated as 3 API calls.</em>
lat (optional)
Query Parameter — <strong>Latitude</strong>. <em>Example: 35</em>. The latitude coordinate of the location of your interest. Must use with <code>lon</code>.
lon (optional)
Query Parameter — <strong>Longitude</strong>. <em>Example: 139</em>. Longitude coordinate of the location of your interest. Must use with <code>lat</code>.
zip (optional)
Query Parameter — <strong>Zip code</strong>. Search by zip code. <em>Example: 95050,us</em>. Please note that if the country is not specified, the search uses USA as a default.
units (optional)
Query Parameter — <strong>Units</strong>. <em>Example: imperial</em>. Possible values: <code>standard</code>, <code>metric</code>, and <code>imperial</code>. When you do not use units parameter, format is <code>standard</code> by default.
lang (optional)
Query Parameter — <strong>Language</strong>. <em>Example: en</em>. You can use lang parameter to get the output in your language. We support the following languages that you can use with the corresponded lang values: Arabic - <code>ar</code>, Bulgarian - <code>bg</code>, Catalan - <code>ca</code>, Czech - <code>cz</code>, German - <code>de</code>, Greek - <code>el</code>, English - <code>en</code>, Persian (Farsi) - <code>fa</code>, Finnish - <code>fi</code>, French - <code>fr</code>, Galician - <code>gl</code>, Croatian - <code>hr</code>, Hungarian - <code>hu</code>, Italian - <code>it</code>, Japanese - <code>ja</code>, Korean - <code>kr</code>, Latvian - <code>la</code>, Lithuanian - <code>lt</code>, Macedonian - <code>mk</code>, Dutch - <code>nl</code>, Polish - <code>pl</code>, Portuguese - <code>pt</code>, Romanian - <code>ro</code>, Russian - <code>ru</code>, Swedish - <code>se</code>, Slovak - <code>sk</code>, Slovenian - <code>sl</code>, Spanish - <code>es</code>, Turkish - <code>tr</code>, Ukrainian - <code>ua</code>, Vietnamese - <code>vi</code>, Chinese Simplified - <code>zh_cn</code>, Chinese Traditional - <code>zh_tw</code>.
mode (optional)
Query Parameter — <strong>Mode</strong>. <em>Example: html</em>. Determines format of response. Possible values are <code>xml</code> and <code>html</code>. If mode parameter is empty the format is <code>json</code> by default.

Return type

200

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.

Responses

200

Successful response 200

404

Not found response String

Models

[ Jump to Methods ]

Table of Contents

  1. 200 - Successful response
  2. Clouds - Clouds
  3. Coord - Coord
  4. Main - Main
  5. Rain - Rain
  6. Snow - Snow
  7. Sys - Sys
  8. Weather - Weather
  9. Wind - Wind

200 - Successful response Up

coord (optional)
weather (optional)
array[Weather] (more info Weather condition codes)
base (optional)
String Internal parameter
main (optional)
visibility (optional)
Integer Visibility, meter format: int32
wind (optional)
clouds (optional)
rain (optional)
snow (optional)
dt (optional)
Integer Time of data calculation, unix, UTC format: int32
sys (optional)
id (optional)
Integer City ID format: int32
name (optional)
cod (optional)
Integer Internal parameter format: int32

Clouds - Clouds Up

all (optional)
Integer Cloudiness, % format: int32

Coord - Coord Up

lon (optional)
BigDecimal City geo location, longitude
lat (optional)
BigDecimal City geo location, latitude

Main - Main Up

temp (optional)
BigDecimal Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
pressure (optional)
Integer Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa format: int32
humidity (optional)
Integer Humidity, % format: int32
temp_min (optional)
BigDecimal Minimum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
temp_max (optional)
BigDecimal Maximum temperature at the moment. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded (use these parameter optionally). Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
sea_level (optional)
BigDecimal Atmospheric pressure on the sea level, hPa
grnd_level (optional)
BigDecimal Atmospheric pressure on the ground level, hPa

Rain - Rain Up

3h (optional)
Integer Rain volume for the last 3 hours format: int32

Snow - Snow Up

3h (optional)
BigDecimal Snow volume for the last 3 hours

Sys - Sys Up

type (optional)
Integer Internal parameter format: int32
id (optional)
Integer Internal parameter format: int32
message (optional)
BigDecimal Internal parameter
country (optional)
String Country code (GB, JP etc.)
sunrise (optional)
Integer Sunrise time, unix, UTC format: int32
sunset (optional)
Integer Sunset time, unix, UTC format: int32

Weather - Weather Up

id (optional)
Integer Weather condition id format: int32
main (optional)
String Group of weather parameters (Rain, Snow, Extreme etc.)
description (optional)
String Weather condition within the group
icon (optional)
String Weather icon id

Wind - Wind Up

speed (optional)
BigDecimal Wind speed. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.
deg (optional)
Integer Wind direction, degrees (meteorological) format: int32