Skip to main content

Current weather endpoint

Returns current weather observations for a geographic coordinate pair (lat and lon).

For implementation workflows, see Use geographic coordinates and Get current weather by city.

Endpoint​

GET https://api.openweathermap.org/data/2.5/weather

Query parameters​

ParameterTypeRequiredDefaultDescription
latnumberYes—Latitude in decimal degrees, ranging from -90 to 90 (positive for north, negative for south).
lonnumberYes—Longitude in decimal degrees, ranging from -180 to 180 (positive for east, negative for west).
appidstringYes—32-character hexadecimal API key. See Authentication.
unitsstringNostandardMeasurement system for temperature and wind speed: standard (Kelvin, m/s), metric (Celsius, m/s), or imperial (Fahrenheit, mph). See Unit systems and conversions.
langstringNoenLanguage code for the localized weather[].description value (such as es, fr, de, ja, or pt_br).
modestringNojsonResponse payload format: json, xml, or html.

Legacy location parameters (deprecated)​

Built-in geocoding deprecation

OpenWeatherMap deprecated built-in city-name, city-ID, and postal-code lookups on weather endpoints. Although q, id, and zip remain functional for backward compatibility, resolve place names and postal codes to coordinates first through the Geocoding endpoints and pass lat and lon to this endpoint.

Supply one legacy identifier only when omitting lat and lon:

ParameterTypeRequiredDefaultDescription
qstringConditional—Deprecated. Comma-separated city name, state code (US locations only), and ISO 3166-1 alpha-2 country code formatted as {city},{state},{country} (for example, London,GB or Portland,OR,US). URL-encode spaces and special characters.
idnumberConditional—Deprecated. OpenWeatherMap numeric city identifier (for example, 2643743 for London).
zipstringConditional—Deprecated. Postal or ZIP code and ISO 3166-1 alpha-2 country code formatted as {zip},{country} (for example, 94040,US or EC1A,GB). Defaults to US when the country code is omitted.

Request examples​

By coordinates​

curl --get "https://api.openweathermap.org/data/2.5/weather" \
--data-urlencode "lat=51.5085" \
--data-urlencode "lon=-0.1257" \
--data-urlencode "units=metric" \
--data-urlencode "appid=$OPENWEATHER_API_KEY"

By city name (legacy)​

curl --get "https://api.openweathermap.org/data/2.5/weather" \
--data-urlencode "q=London,GB" \
--data-urlencode "units=metric" \
--data-urlencode "appid=$OPENWEATHER_API_KEY"

Response​

Example 200 OK JSON payload requested with units=metric:

{
"coord": {
"lon": -0.1257,
"lat": 51.5085
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10d"
}
],
"base": "stations",
"main": {
"temp": 12.3,
"feels_like": 11.7,
"temp_min": 10.8,
"temp_max": 13.4,
"pressure": 1015,
"sea_level": 1015,
"grnd_level": 1011,
"humidity": 84
},
"visibility": 10000,
"wind": {
"speed": 5.2,
"deg": 230,
"gust": 8.1
},
"rain": {
"1h": 0.65
},
"clouds": {
"all": 90
},
"dt": 1715270400,
"sys": {
"type": 2,
"id": 2075535,
"country": "GB",
"sunrise": 1715230800,
"sunset": 1715284800
},
"timezone": 3600,
"id": 2643743,
"name": "London",
"cod": 200
}

Response fields​

FieldTypeUnitDescription
coord.lonnumberDecimal degreesLongitude of the matched location (-180 to 180).
coord.latnumberDecimal degreesLatitude of the matched location (-90 to 90).
weatherarray—List of weather condition objects. The first element (weather[0]) represents the primary condition.
weather[].idnumber—Numeric weather condition code. See OpenWeatherMap weather condition codes.
weather[].mainstring—Weather condition category: Thunderstorm, Drizzle, Rain, Snow, Atmosphere (serialized as specific 7xx phenomenon names such as Mist, Smoke, Haze, Dust, Fog, Sand, Ash, Squall, or Tornado), Clear, or Clouds.
weather[].descriptionstring—Localized condition description within the category, controlled by lang.
weather[].iconstring—Icon identifier (such as 10d for day or 10n for night). See OpenWeatherMap weather condition codes.
basestring—Internal OpenWeatherMap parameter indicating the observation source (such as stations).
main.tempnumberK, °C, or °FCurrent air temperature (Kelvin for standard, Celsius for metric, Fahrenheit for imperial).
main.feels_likenumberK, °C, or °FHuman-perceived temperature accounting for wind chill and relative humidity.
main.temp_minnumberK, °C, or °FLowest currently observed temperature across stations within a large metropolitan or extended area. Represents instantaneous spatial spread rather than a 24-hour daily low.
main.temp_maxnumberK, °C, or °FHighest currently observed temperature across stations within a large metropolitan or extended area. Represents instantaneous spatial spread rather than a 24-hour daily high.
main.pressurenumberhPaAtmospheric pressure at sea level (when sea_level and grnd_level are absent) or station reference pressure.
main.sea_levelnumberhPaOptional. Atmospheric pressure adjusted to mean sea level.
main.grnd_levelnumberhPaOptional. Atmospheric pressure measured at local ground elevation.
main.humiditynumber%Relative humidity percentage (0–100).
visibilitynumbermHorizontal visibility distance in meters, capped at a maximum of 10000 (10 km).
wind.speednumberm/s or mphSustained wind speed (m/s for standard and metric; mph for imperial).
wind.degnumberDegreesMeteorological wind direction (0–360, indicating the direction from which wind blows).
wind.gustnumberm/s or mphOptional. Peak wind gust speed (m/s for standard and metric; mph for imperial). Omitted when unavailable.
clouds.allnumber%Cloudiness percentage (0–100).
rain.1hnumbermmOptional. Liquid precipitation volume for the past 1 hour. Omitted when no rain occurred.
snow.1hnumbermmOptional. Snow liquid-equivalent precipitation volume for the past 1 hour. Omitted when no snow occurred.
dtnumberUnix UTC (s)Observation calculation timestamp in Unix epoch seconds (UTC).
sys.typenumber—Optional. Internal OpenWeatherMap system parameter.
sys.idnumber—Optional. Internal OpenWeatherMap station identifier.
sys.countrystring—ISO 3166-1 alpha-2 country code (for example, GB or US).
sys.sunrisenumberUnix UTC (s)Sunrise time in Unix epoch seconds (UTC).
sys.sunsetnumberUnix UTC (s)Sunset time in Unix epoch seconds (UTC).
timezonenumbersOffset in seconds from UTC for the local time zone (for example, 3600 for UTC+1).
idnumber—Deprecated OpenWeatherMap city identifier.
namestring—Deprecated matched locality name (returns an empty string for unpopulated or open-ocean coordinates).
codnumber—Internal status code (200 as a JSON number on success).

Status codes​

Status codeMeaningDescription
200OKCurrent weather payload returned (cod is 200).
400Bad RequestMissing location parameters or out-of-range coordinates (cod is "400").
401UnauthorizedMissing, invalid, inactive, or unauthorized appid (cod is 401).
404Not FoundLegacy q, id, or zip lookup matched no record (cod is "404").
429Too Many RequestsAccount rate limit exceeded (cod is 429).
5xxServer ErrorUpstream OpenWeatherMap server or gateway error.

For full error payload schemas and cod type behavior, see Error codes.