“Test” rate
Use this request to get the current weather and forecast for the specified locality.
Request format
The locality is indicated using the latitude (lat parameter) and longitude (lon parameter). If these parameters are set incorrectly, the response will contain a 404 error code.
GET https://api.weather.yandex.ru/v2/forecast?
lat=<latitude>
& lon=<longitude>
& [lang=<response language>]
& [limit=<forecast period>]
& [hours=<hourly forecast>]
& [extra=<detailed precipitation forecast>]
X-Yandex-API-Key: <key value>
Request headers:
X-Yandex-API-Key
The key you received when enabling the Yandex Weather API.
Request parameters:
lat
The latitude in degrees. Required field.
lon
The longitude in degrees. Required field.
lang
The combination of language and country that weather information will be returned for. Possible values:
- “ru_RU” — Russian for the Russia locale.
- “be_BY” — Belarusian for the Belarus locale.
- “kk_KZ” — Kazakh for the Kazakhstan locale.
- “tr_TR” — Turkish for the Turkey locale.
- “en_US” — International English.
limit
The number of days in the forecast, including the current day.
For the “Test” rate, the maximum value is 7.
hours
For each day, the response will contain the hourly weather forecast. Possible values:
- “true” — Default value. Returns the hourly forecast.
- “false” — Does not return the hourly forecast.
extra
Extra information about precipitation. Possible values:
— Returns detailed information about precipitation. — Default value. Does not return detailed information about precipitation.
Response format
The response to the request is returned in JSON format. The information in the response contains:
Field |
Description |
Format |
|
The time on the server in Unix time. |
Number |
|
The time on the server in UTC. |
String |
|
Object |
|
|
Object |
|
|
Object |
info object
This object contains information about the locality.
Field |
Description |
Format |
|
The latitude (in degrees). |
Number |
|
The longitude (in degrees). |
Number |
|
Information about the time zone. Contains the fields offset, name, abbr and dst. |
Object |
|
Time zone in seconds from UTC. |
Number |
|
Name of the time zone. |
String |
|
Abbreviated name of the time zone. |
String |
|
Daylight saving time. |
Boolean |
|
The normal pressure for the given coordinates (mm Hg). |
Number |
|
The normal pressure for the given coordinates (hPa). |
Number |
|
Locality page on Yandex Weather. |
String |
fact object
This object contains information about the current weather.
Field |
Description |
Format |
|
Temperature (°C). |
Number |
|
What the temperature feels like (°C). |
Number |
|
The water temperature (°C). This parameter is returned for localities where this information is relevant. |
Number |
|
The code of the weather icon. The icon is available at https://yastatic.net/weather/i/icons/funky/dark/<value from the icon field>.svg. |
String |
|
The code for the weather description. Possible values:
|
String |
|
Wind speed (meters per second). |
Number |
|
Speed of wind gusts (meters per second). |
Number |
|
Wind direction. Possible values:
|
String |
|
Atmospheric pressure (mm Hg). |
Number |
|
Atmospheric pressure (hPa). |
Number |
|
Humidity (percent). |
Number |
|
Light or dark time of the day. Possible values:
|
String |
|
Indicates that the time of day specified in the |
Boolean |
|
Time of year in this locality. Possible values:
|
String |
|
The time when weather data was measured, in Unix time. |
Number |
|
Indicates a thunderstorm. Possible values:
|
Boolean |
|
Type of precipitation. Possible values:
|
Number |
|
Intensity of precipitation. Possible values:
|
Number |
|
Cloud cover. Possible values:
|
String |
|
The code for an additional weather event icon. Handled similarly as |
String |
|
The code for an additional weather description. Handled similarly as
|
String |
forecasts object
This object contains weather forecast data.
Field |
Description |
Format |
|
Date of the forecast, in the format YYYY-MM-DD. |
String |
|
The date of the forecast in Unix time. |
Number |
|
Week number. |
Number |
|
Time of the sunrise in local time (may be omitted for polar regions). |
String |
|
Time of the sunset in local time (may be omitted for polar regions). |
String |
|
Code of the lunar phase. Possible values:
|
Number |
|
Text code for the lunar phase. Possible values:
|
String |
|
Forecasts by time of day and 12-hour forecasts.Contains fields that differ by type of forecast:
All weather forecasts for a certain time of day have the same set of fields. All 12-hour forecasts have the same set of fields. Note For the last day returned in the forecast, some of the parts might be missing. |
Object |
|
Object with the weather forecast for the night. Contains the following fields:
Alert The beginning of the nighttime period corresponds to the beginning of the 24-hour period. To specify the upcoming night temperatures, use the object for the nighttime forecast for the next day. |
Object |
|
Minimum temperature for the time of day (°C). |
Number |
|
Maximum temperature for the time of day (°C). |
Number |
|
Average temperature for the time of day (°C). |
Number |
|
What the temperature feels like (°C). |
Number |
|
The code of the weather icon. The icon is available at https://yastatic.net/weather/i/icons/funky/dark/<value from the icon field>.svg. |
String |
|
The code for the weather description. Possible values:
|
String |
|
Light or dark time of the day. Possible values:
|
String |
|
Indicates that the time of day specified in the |
Boolean |
|
Wind speed (meters per second). |
Number |
|
Speed of wind gusts (meters per second). |
Number |
|
Wind direction. Possible values:
|
String |
|
Atmospheric pressure (mm Hg). |
Number |
|
Atmospheric pressure (hPa). |
Number |
|
Humidity (percent). |
Number |
|
Predicted amount of precipitation (mm). |
Number |
|
Predicted duration of precipitation (minutes). |
Number |
|
Type of precipitation. Possible values:
|
Number |
|
Intensity of precipitation. Possible values:
|
Number |
|
Cloud cover. Possible values:
|
Number |
|
Object with a 12-hour forecast for the day. Contains the following fields:
|
Object |
|
Highest daytime or lowest nighttime temperature (°C). |
Number |
|
Object for the hourly forecast. Consists of 24 parts (hours) for the first 2-3 days, then an empty string is returned. Each part contains the following fields:
|
Object |
|
The hour the forecast is for (0-23) using the local time. |
String |
|
The time of the forecast in Unix time. |
Number |
Example
Request:
GET https://api.weather.yandex.ru/v2/forecast?lat=55.75396&lon=37.620393&extra=true
X-Yandex-API-Key: 4pa...3
Response:
{
"now": 1470220206,
"now_dt": "2016-08-03T10:30:06.238Z",
"info": {
"lat": 55.833333,
"lon": 37.616667,
"tzinfo": {
"offset": 10800,
"name": "Europe/Moscow",
"abbr": "MSK",
"dst": false
},
"def_pressure_mm": 746,
"def_pressure_pa": 994,
"url": "https://yandex.ru/pogoda/moscow"
},
"fact": {
"temp": 20,
"feels_like": 21,
"icon": "ovc",
"condition": "overcast",
"wind_speed": 2,
"wind_gust": 5.9,
"wind_dir": "n",
"pressure_mm": 745,
"pressure_pa": 994,
"humidity": 83,
"daytime": "d",
"polar": false,
"season": "summer",
"prec_type": 1,
"prec_strength": 0.25,
"is_thunder": false,
"cloudness": 1,
"obs_time": 1470214800
"phenom_icon": "ovm",
"phenom-condition": "fog"
},
"forecasts": [
{
"date": "2016-08-03",
"date_ts": 1470171600,
"week": 32,
"sunrise": "04:38",
"sunset": "20:31",
"moon_code": 8,
"moon_text": "moon-code-8",
"parts": {
"night": {
"temp_min": 20,
"temp_max": 21,
"temp_avg": 21,
"feels_like": 23,
"icon": "bkn_n",
"condition": "cloudy",
"daytime": "n",
"polar": false,
"wind_speed": 0.9,
"wind_gust": 4,
"wind_dir": "nw",
"pressure_mm": 746,
"pressure_pa": 995,
"humidity": 81,
"prec_mm": 0,
"prec_period": 360,
"prec_type": 0,
"prec_strength": 0,
"cloudness": 0.75
},
...
"evening": {
"temp_min": 17,
"temp_max": 19,
"temp_avg": 18,
"feels_like": 19,
"icon": "bkn_ra",
"condition": "rain",
"daytime": "d",
"polar": false,
"wind_speed": 1.8,
"wind_dir": "nw",
"pressure_mm": 745,
"pressure_pa": 994,
"humidity": 99,
"prec_mm": 17.95,
"prec_period": 360,
"prec_type": 1,
"prec_strength": 0.5,
"cloudness": 0.75,
},
"day_short": {
"temp": 20,
"temp_min": 18,
"feels_like": 21,
"icon": "ovc_-ra",
"condition": "light-rain",
"wind_speed": 1.9,
"wind_gust": 5.9,
"wind_dir": "nw",
"pressure_mm": 745,
"pressure_pa": 994,
"humidity": 88,
"prec_type": 1,
"prec_strength": 0.25,
"cloudness": 1,
},
"night_short": {
"temp": 20,
"feels_like": 22,
"icon": "bkn_n",
"condition": "cloudy",
"wind_speed": 0.9,
"wind_gust": 5.9,
"wind_dir": "nw",
"pressure_mm": 746,
"pressure_pa": 995,
"humidity": 81,
"prec_type": 0,
"prec_strength": 0,
"cloudness": 0.75,
}
},
"hours": [
{
"hour": "0",
"hour_ts": 1470171600,
"temp": 21,
"feels_like": 23,
"icon": "bkn_n",
"condition": "partly-cloudy",
"wind_speed": 0.3,
"wind_gust": 4,
"wind_dir": "nw",
"pressure_mm": 746,
"pressure_pa": 995,
"humidity": 80,
"prec_mm": 0,
"prec_period": 60,
"prec_type": 0,
"prec_strength": 0,
"is_thunder": false,
"cloudness": 0.25,
},
...
{
"hour": "23",
"hour_ts": 1470254400,
"temp": 17,
"feels_like": 19,
"icon": "ovc_-ra",
"condition": "light-rain",
"wind_speed": 0.9,
"wind_gust": 3.6,
"wind_dir": "nw",
"pressure_mm": 745,
"pressure_pa": 994,
"humidity": 100,
"prec_mm": 0.05,
"prec_period": 60,
"prec_type": 1,
"prec_strength": 0.25,
"is_thunder": false,
"cloudness": 1,
}
]
},
...
{
"date": "2016-08-10",
"date_ts": 1471035600,
"week": 33,
"sunrise": "04:57",
"sunset": "20:09",
"moon_code": 13,
"moon_text": "moon-code-13",
"parts": {
"night": {...},
"morning": {...},
"day": {...},
"evening": {...},
"day_short": {...},
"night_short": {...}
},
"hours": [...]
}
]
}
Description
Chance of precipitation.
Format
Number
Description
Minimum temperature for the time of day (°C).
Format
Number
Description
Maximum temperature for the time of day (°C).
Format
Number
Description
Average temperature for the time of day (°C).
Format
Number
Description
What the temperature feels like (°C).
Format
Number
Description
The code of the weather icon. The icon is available at https://yastatic.net/weather/i/icons/funky/dark/<value from the icon field>.svg.
Format
String
Description
Indicates that the time of day specified in the daytime
field is polar.
Format
Boolean
Description
Wind speed (meters per second).
Format
Number
Description
Speed of wind gusts (meters per second).
Format
Number
Description
Atmospheric pressure (mm Hg).
Format
Number
Description
Atmospheric pressure (hPa).
Format
Number
Description
Humidity (percent).
Format
Number
Description
Predicted amount of precipitation (mm).
Format
Number
Description
Predicted duration of precipitation (minutes).
Format
Number
Description
Name of the time of day. Possible values:
night
— Night.morning
— Morning.day
— Day.evening
— Evening.
Format
String
Description
The code for the weather description. Possible values:
clear
— Clear.partly-cloudy
— Partly cloudy.cloudy
— Cloudy.-overcast
— Overcast.drizzle
— Drizzle.light-rain
— Light rain.rain
— Rain.moderate-rain
— Moderate rain.heavy-rain
— Heavy rain.continuous-heavy-rain
— Continuous heavy rain.showers
— Showers.-wet-snow
— Sleet.light-snow
— Light snow.snow
— Snow.snow-showers
— Snowfall.hail
— Hail.thunderstorm
— Thunderstorm.thunderstorm-with-rain
— Rain, thunderstorm.thunderstorm-with-hail
— Thunderstorm, hail.
Format
String
Description
Light or dark time of the day. Possible values:
- “d” — Light time of day.
- “n” — Dark time of day.
Format
String
Description
Wind direction. Possible values:
- “nw” — Northwest.
- “n” — North.
- “ne” — Northeast.
- “e” — East.
- “se” — Southeast.
- “s” — South.
- “sw” — Southwest.
- “w” — West.
- “c” — Calm.
Format
String
The latitude in degrees. Required field.
The longitude in degrees. Required field.
Description
The latitude (in degrees).
Format
Number
Description
The longitude (in degrees).
Format
Number
The combination of language and country that weather information will be returned for. Possible values:
- “ru_RU” — Russian for the Russia locale.
- “be_BY” — Belarusian for the Belarus locale.
- “kk_KZ” — Kazakh for the Kazakhstan locale.
- “tr_TR” — Turkish for the Turkey locale.
- “en_US” — International English.
The key you received when enabling the Yandex.Weather API.
Description
The time on the server in Unix time.
Format
Number
Description
The time on the server in UTC.
Format
String
Description
Locality page on Yandex Weather.
Format
String
Description
Temperature (°C).
Format
Number
Description
Time of year in this locality. Possible values:
- “summer” — Summer.
- “autumn” — Autumn.
- “winter” — Winter.
- “spring” — Spring.
Format
String
Description
The time when weather data was measured, in Unix time.
Format
Number
Description
Date of the forecast, in the format YYYY-MM-DD.
Format
String
Description
The date of the forecast in Unix time.
Format
Number
Description
Week number.
Format
Number
Description
Time of the sunrise in local time (may be omitted for polar regions).
Format
String
Description
Time of the sunset in local time (may be omitted for polar regions).
Format
String
Description
Code of the lunar phase. Possible values:
- 0 — Full moon.
- 1-3 — Waning crescent.
- 4 — Last quarter.
- 5-7 — Waning gibbous.
- 8 — New moon.
- 9-11 — Waxing gibbous.
- 12 — First quarter.
- 13-15 — Waxing crescent.
Format
Number
Description
Text code for the lunar phase. Possible values:
moon-code-0
— Full moon.moon-code-1
— Waning moon.moon-code-2
— Waning moon.moon-code-3
— Waning moon.moon-code-4
— Last quarter.moon-code-5
— Waning moon.moon-code-6
— Waning moon.moon-code-7
— Waning moon.moon-code-8
— New moon.moon-code-9
— Waxing moon.moon-code-10
— Waxing moon.moon-code-11
— Waxing moon.moon-code-12
— First quarter.moon-code-13
— Waxing moon.moon-code-14
— Waxing moon.moon-code-15
— Waxing moon.
Format
String
Description
Predicted duration of precipitation (minutes).
Format
Number
Description
The number of days in the forecast, including the current day.
For the “Test” rate, the maximum value is 7.
Format
Number
For each day, the response will contain the hourly weather forecast. Possible values:
- “true” — Default value. Returns the hourly forecast.
- “false” — Does not return the hourly forecast.
Description
Extra information about precipitation. Possible values:
— Returns detailed information about precipitation. — Default value. Does not return detailed information about precipitation.
Format
Number
Description
Time zone in seconds from UTC.
Format
Number
Description
Name of the time zone.
Format
String
Description
Abbreviated name of the time zone.
Format
String
Description
Daylight saving time.
Format
Boolean
Description
Object with the weather forecast for the night. Contains the following fields:
temp_min
temp_max
temp_avg
feels_like
icon
condition
daytime
polar
wind_speed
wind_gust
wind_dir
pressure_mm
pressure_pa
humidity
prec_mm
prec_period
prec_type
prec_strength
cloudness
Alert
The beginning of the nighttime period corresponds to the beginning of the 24-hour period. To specify the upcoming night temperatures, use the object for the nighttime forecast for the next day.
Format
Object
Description
Object with a 12-hour forecast for the day. Contains the following fields:
temp
temp_min
feels_like
icon
condition
wind_speed
wind_gust
wind_dir
pressure_mm
pressure_pa
humidity
prec_type
prec_strength
cloudness
Format
Object
Description
Type of precipitation. Possible values:
- 0 — No precipitation.
- 1 — Rain.
- 2 — Sleet.
- 3 — Snow.
Format
Number
Description
Intensity of precipitation. Possible values:
- 0 — No precipitation.
- 0.25 — Light rain or snow.
- 0.5 — Rain or snow.
- 0.75 — Heavy rain or snowfall
- 1 — Heavy downpour or snowstorm.
Format
Number
Description
Cloud cover. Possible values:
- 0 — Clear.
- 0.25 — Partly cloudy.
- 0.5 — Cloudy.
- 0.75 — Cloudy.
- 1 — Overcast.
Format
Number
Description
The hour the forecast is for (0-23) using the local time.
Format
String
Description
The time of the forecast in Unix time.
Format
Number
Description
Indicates a thunderstorm. Possible values:
- true — Thunderstorm.
- false — No thunderstorm.
Format
Boolean
Description
Information about the time zone. Contains the fields offset
, name
, abbr
and dst
.
Format
Object
Description
The normal pressure for the given coordinates (mm Hg).
Format
Number
Description
The normal pressure for the given coordinates (hPa).
Format
Number
Description
The code for an additional weather event icon. Handled similarly as icon
.
Format
String
Description
The code for an additional weather event icon. Handled similarly as icon
.
Format
String
Description
Forecasts by time of day and 12-hour forecasts.
Contains fields that differ by type of forecast:
- night — Nighttime forecast.
- morning — Morning forecast.
- day — Afternoon forecast.
- evening — Evening forecast.
- day_short — 12-hour forecast for the day.
- night_short — Nighttime forecast with the
temp_min
andtemp_max
fields excluded and thetemp
field showing - the lowest nighttime temperature.
All weather forecasts for a certain time of day have the same set of fields.
All 12-hour forecasts have the same set of fields.
Note
For the last day returned in the forecast, some of the parts might be missing.
Format
Object
Description
The time of the forecast in Unix time.
Format
Number
Description
Object for the hourly forecast. Consists of 24 parts (hours) for the first 2-3 days, then an empty string is returned. Each part contains the following fields:
- hour
- hour_ts
- temp
- feels_like
- icon
- condition
- wind_speed
- wind_gust
- wind_dir
- pressure_mm
- pressure_pa
- humidity
- prec_mm
- prec_period
- prec_type
- prec_strength
- is_thunder
- cloudness
Format
Object