Skip to content

Daily Forecast

The daily forecast endpoint returns day-by-day forecasts for the requested location, including full-day/daytime/nighttime variables, air quality, life indices, and sunrise/sunset times.

Update Frequency and Spatial Resolution

Daily forecast data is cycle-based (typically 2-4 runs/day), has ~9-13 km spatial scale (aggregated from hourly data), and covers the next fifteen days daily. Life index data covers the next fifteen days daily. For details, see Variable Coverage.

Request

GET https://api.caiyunapp.com/v2.6/{token}/{longitude},{latitude}/daily

Path Parameters

ParameterDescription
tokenAPI token
longitudeLongitude of the target location
latitudeLatitude of the target location

Note: in the URL path, longitude comes first, latitude second (e.g. -74,40.7); the location field in the response is in [latitude, longitude] order (e.g. [40.7, -74.0]).

Query Parameters

NameRequiredDefaultRangeDescription
langNozh_CNzh_CN/zh_TW/en_US/en_GB/jaLanguage of natural-language descriptions; falls back to zh_CN when unmatched. See Languages
unitNometricmetric/metric:v1/metric:v2/SI/imperialUnit system; any other value returns 422. See Units
alertNofalsetrue/falseWith alert=true and an alert-enabled token, the response includes result.alert. See Weather Alerts
callbackNo--JSONP callback name
dailystepsNo51~16Number of days to return; normally 1~15, and dailysteps=16 requires dailystart=-1. The effective limit depends on your plan, and requests beyond it are truncated to the plan's limit
dailystartNo0-1/0Only -1 and 0 are supported (-1 goes back one day); any other value returns 422

Request Example

bash
curl "https://api.caiyunapp.com/v2.6/TAkhjf8d1nlSlspN/101.6656,39.2072/daily?dailysteps=1"
json
{
  "status": "ok",
  "api_version": "v2.6",
  "api_status": "active",
  "lang": "zh_CN",
  "unit": "metric",
  "tzshift": 28800,
  "timezone": "Asia/Shanghai",
  "server_time": 1653552787,
  "location": [
    39.2072,
    101.6656
  ],
  "result": {
    "daily": {
      "status": "ok",
      "astro": [
        {
          "date": "2022-05-26T00:00+08:00",
          "sunrise": {
            "time": "05:51"
          },
          "sunset": {
            "time": "20:28"
          }
        }
      ],
      "precipitation_08h_20h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 0,
          "min": 0,
          "avg": 0,
          "probability": 0
        }
      ],
      "precipitation_20h_32h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 0,
          "min": 0,
          "avg": 0,
          "probability": 0
        }
      ],
      "precipitation": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 0,
          "min": 0,
          "avg": 0,
          "probability": 0
        }
      ],
      "temperature": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 27,
          "min": 18,
          "avg": 23.75
        }
      ],
      "temperature_08h_20h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 27,
          "min": 18,
          "avg": 24.57
        }
      ],
      "temperature_20h_32h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 24.8,
          "min": 18,
          "avg": 20.02
        }
      ],
      "wind": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": {
            "speed": 28.24,
            "direction": 122.62
          },
          "min": {
            "speed": 9,
            "direction": 104
          },
          "avg": {
            "speed": 21.61,
            "direction": 118.02
          }
        }
      ],
      "wind_08h_20h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": {
            "speed": 28.24,
            "direction": 122.62
          },
          "min": {
            "speed": 9,
            "direction": 104
          },
          "avg": {
            "speed": 22.74,
            "direction": 115.78
          }
        }
      ],
      "wind_20h_32h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": {
            "speed": 22.39,
            "direction": 97.46
          },
          "min": {
            "speed": 9.73,
            "direction": 125.93
          },
          "avg": {
            "speed": 16,
            "direction": 121.62
          }
        }
      ],
      "humidity": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 0.18,
          "min": 0.08,
          "avg": 0.09
        }
      ],
      "cloudrate": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 1,
          "min": 0,
          "avg": 0.75
        }
      ],
      "pressure": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 84500.84,
          "min": 83940.84,
          "avg": 83991.97
        }
      ],
      "visibility": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 25,
          "min": 24.13,
          "avg": 25
        }
      ],
      "dswrf": [
        {
          "date": "2022-05-26T00:00+08:00",
          "max": 741.9,
          "min": 0,
          "avg": 368.6
        }
      ],
      "air_quality": {
        "aqi": [
          {
            "date": "2022-05-26T00:00+08:00",
            "max": {
              "chn": 183,
              "usa": 160
            },
            "avg": {
              "chn": 29,
              "usa": 57
            },
            "min": {
              "chn": 20,
              "usa": 42
            }
          }
        ],
        "pm25": [
          {
            "date": "2022-05-26T00:00+08:00",
            "max": 74,
            "avg": 15,
            "min": 10
          }
        ]
      },
      "skycon": [
        {
          "date": "2022-05-26T00:00+08:00",
          "value": "PARTLY_CLOUDY_DAY"
        }
      ],
      "skycon_08h_20h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "value": "PARTLY_CLOUDY_DAY"
        }
      ],
      "skycon_20h_32h": [
        {
          "date": "2022-05-26T00:00+08:00",
          "value": "CLOUDY"
        }
      ],
      "life_index": {
        "ultraviolet": [
          {
            "date": "2022-05-26T00:00+08:00",
            "index": "1",
            "desc": "Lowest"
          }
        ],
        "carWashing": [
          {
            "date": "2022-05-26T00:00+08:00",
            "index": "1",
            "desc": "Ideal"
          }
        ],
        "dressing": [
          {
            "date": "2022-05-26T00:00+08:00",
            "index": "4",
            "desc": "Warm"
          }
        ],
        "comfort": [
          {
            "date": "2022-05-26T00:00+08:00",
            "index": "4",
            "desc": "Warm"
          }
        ],
        "coldRisk": [
          {
            "date": "2022-05-26T00:00+08:00",
            "index": "4",
            "desc": "Highly Probable"
          }
        ]
      }
    },
    "primary": 0
  }
}

Response Fields

JSONPath $.result.daily.Description
temperature[max,min,avg]Surface 2 m air temperature (whole day)
temperature_08h_20h[max,min,avg]Surface 2 m air temperature (daytime)
temperature_20h_32h[max,min,avg]Surface 2 m air temperature (nighttime)
pressure[max,min,avg]Surface pressure
humidity[max,min,avg]Surface 2 m relative humidity (0-1)
wind[max,min,avg]Surface 10 m wind (whole day); each of max/min/avg contains speed and direction
wind_08h_20h[max,min,avg]Surface 10 m wind (daytime); same structure as above
wind_20h_32h[max,min,avg]Surface 10 m wind (nighttime); same structure as above
precipitation_08h_20h[max,min,avg,probability]Precipitation (daytime)
precipitation_20h_32h[max,min,avg,probability]Precipitation (nighttime)
precipitation[max,min,avg,probability]Precipitation (whole day)
cloudrate[max,min,avg]Cloud cover (0.0-1.0)
dswrf[max,min,avg]Downward shortwave radiation flux (W/M2)
visibility[max,min,avg]Surface horizontal visibility
skycon.valueDominant sky condition (whole day)
skycon_08h_20h.valueDominant sky condition (daytime)
skycon_20h_32h.valueDominant sky condition (nighttime)
life_index.ultraviolet[index,desc]Ultraviolet index; index is a string from "0" to "5" (including "0" = none, at night); see Life Index for desc
life_index.comfort[index,desc]Comfort index; index is a string from "0" to "13"; see Life Index for desc
life_index.carWashing[index,desc]Car-washing index; index is a string from "1" to "4"; see Life Index for desc
life_index.coldRisk[index,desc]Cold-risk index; index is a string from "1" to "4"; see Life Index for desc
life_index.dressing[index,desc]Dressing index; index is a string from "0" to "8"; see Life Index for desc
air_quality.pm25[max,min,avg]PM2.5 concentration (μg/m3)
air_quality.aqi[max,min,avg]AQI; each of max/min/avg contains chn and usa
astro[sunrise,sunset]Sunrise/sunset times (local time of the location)

For xxx, xxx_08h_20h, xxx_20h_32h:

  • xxx means the whole day, 00:00-24:00
  • xxx_08h_20h means 08:00-20:00 of the day
  • xxx_20h_32h means 20:00 of the day to 08:00 of the next day

Notes:

  • For full-day variables, xxx.avg on the current day is the average from the current whole hour to the end of the day, not the average of the whole day; the exception is wind.avg (including direction), which is always the 24-hour average of the whole day.
  • xxx_08h_20h.avg and xxx_20h_32h.avg are always averages over the full 12-hour window; max/min are always extremes over the corresponding full time window.

Errors

Error responses have the following structure. See Error Messages for HTTP status codes and their meanings.

{
  "status": "failed",
  "error": "token is invalid",
  "api_version": "2.6"
}