Misc

Query Weather

0calls
2 credits / call

Checking the weather before heading out is always a good habit. This endpoint provides accurate, real-time weather data for both domestic and international cities.

Overview

Three query modes are supported:

  • Pass adcode to query by administrative district code (highest priority).
  • Pass city to query by city name. Both Chinese (北京) and English (Tokyo) are accepted.
  • Pass neither and the API will auto-locate using the client IP.

The lang parameter accepts zh (default) and en. City-name translations cover 7000+ cities.

Optional modules

  • extended=true: extended meteorological fields (apparent temperature, visibility, pressure, UV, air quality, and pollutant breakdown).
  • forecast=true: multi-day forecast (up to 7 days), with daily high/low temperature, sunrise/sunset, wind speed, and other detailed data.
  • hourly=true: hourly forecast (24 hours).
  • minutely=true: minute-level precipitation forecast (domestic cities only, 2-minute resolution).
  • indices=true: 18 lifestyle indices (clothing, UV, car wash, sports, pollen, and more).

Notes on the weather field

weather is a free-form weather description, not a fixed enum.

Common Chinese values returned by the API include: 晴 (sunny), 多云 (cloudy), 阴 (overcast), 小雨 (light rain), 中雨 (moderate rain), 大雨 (heavy rain), 雷阵雨 (thunderstorm), 小雪 (light snow), 中雪 (moderate snow), 大雪 (heavy snow), 雨夹雪 (sleet), 雾 (fog), 霾 (haze), 沙尘 (sand).

If your application needs a stable weather classification, map against weather_code instead. See the weather icon code table for all possible values.

Query parameters

city
stringoptional

City name. Accepts both Chinese (北京) and English (Tokyo). Optional — when omitted, the API attempts to auto-locate by IP.

adcode
stringoptional

Administrative district code (e.g. 110000). Higher priority than city. Optional — when omitted, the API attempts to auto-locate by IP.

extended
booleanoptional

Return extended meteorological fields (apparent temperature, visibility, pressure, UV, precipitation, cloud cover, air quality index, and pollutant breakdown).

forecast
booleanoptional

Return multi-day forecast data (up to 7 days), including daily high and low temperatures, day/night weather, wind direction and force, sunrise/sunset, and more.

hourly
booleanoptional

Return an hourly forecast (24 hours), including temperature, weather, wind direction and speed, humidity, precipitation probability, and more.

minutely
booleanoptional

Return minute-level precipitation forecast (domestic cities only), 2-minute resolution.

indices
booleanoptional

Return 18 lifestyle indices (clothing, UV, car wash, drying, AC, cold-and-flu, sports, comfort, travel, fishing, allergy, sun protection, mood, beer, umbrella, traffic, air purifier, pollen).

lang
stringoptional

Response language. zh returns Chinese (default), en returns English. City-name translations cover 7000+ cities. Lifestyle indices (indices) currently support Chinese only.

Response

200 / OK

Lookup succeeded. Returns the real-time weather for the area.

JSON

400 / Bad Request

Invalid parameter. Common causes: malformed adcode, invalid lang (only zh/en are supported), wrong parameter type, or invalid parameter combination.

JSON

404 / Not Found

City not found.

JSON

500 / Internal Server Error

Internal server error.

JSON

503 / Service Unavailable

Weather service temporarily unavailable.

JSON