空气质量时光机

平台: API iOS Android

获取最近10天的中国空气质量历史再分析数据。

例如今天是12月30日,最多可获取12月20日至12月29日的空气质量历史数据。

请求URL

https://api.qweather.com/v7/historical/air

请求参数

请求参数包括必选和可选参数,参数之间使用&进行分隔。

  • location(必选)需要查询的地区,仅支持LocationID,LocationID可通过GeoAPI获取。例如 location=101010100
  • date(必选)选择日期,最多可选择最近10天(不包含今天)的数据。日期格式为yyyyMMdd,例如 date=20200531
  • lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。

请求示例

curl -X GET --compressed \
-H 'Authorization: Bearer your_token' \
'https://api.qweather.com/v7/historical/air?location=101010100&date=20200725'

请将your_token替换为你的JWT或了解身份认证

返回数据

返回数据是JSON格式并进行了Gzip压缩

{
  "code": "200",
  "fxLink": "http://hfx.link/2ax6",
  "airHourly": [
    {
      "pubTime": "2020-07-25 00:00",
      "aqi": "52",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "54",
      "pm2p5": "22",
      "no2": "31",
      "so2": "2",
      "co": "0.5",
      "o3": "85"
    },
    {
      "pubTime": "2020-07-25 01:00",
      "aqi": "52",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "54",
      "pm2p5": "22",
      "no2": "45",
      "so2": "2",
      "co": "0.5",
      "o3": "59"
    },
    {
      "pubTime": "2020-07-25 02:00",
      "aqi": "52",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "53",
      "pm2p5": "22",
      "no2": "48",
      "so2": "3",
      "co": "0.5",
      "o3": "53"
    },
    {
      "pubTime": "2020-07-25 03:00",
      "aqi": "49",
      "level": "1",
      "category": "优",
      "primary": "NA",
      "pm10": "49",
      "pm2p5": "23",
      "no2": "48",
      "so2": "3",
      "co": "0.5",
      "o3": "48"
    },
    {
      "pubTime": "2020-07-25 04:00",
      "aqi": "51",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "51",
      "pm2p5": "23",
      "no2": "56",
      "so2": "3",
      "co": "0.5",
      "o3": "38"
    },
    {
      "pubTime": "2020-07-25 05:00",
      "aqi": "52",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "53",
      "pm2p5": "24",
      "no2": "57",
      "so2": "3",
      "co": "0.5",
      "o3": "32"
    },
    {
      "pubTime": "2020-07-25 06:00",
      "aqi": "51",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "52",
      "pm2p5": "22",
      "no2": "52",
      "so2": "3",
      "co": "0.5",
      "o3": "35"
    },
    {
      "pubTime": "2020-07-25 07:00",
      "aqi": "55",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "59",
      "pm2p5": "25",
      "no2": "47",
      "so2": "2",
      "co": "0.6",
      "o3": "41"
    },
    {
      "pubTime": "2020-07-25 08:00",
      "aqi": "60",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "69",
      "pm2p5": "27",
      "no2": "41",
      "so2": "3",
      "co": "0.6",
      "o3": "59"
    },
    {
      "pubTime": "2020-07-25 09:00",
      "aqi": "61",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "72",
      "pm2p5": "30",
      "no2": "36",
      "so2": "4",
      "co": "0.7",
      "o3": "88"
    },
    {
      "pubTime": "2020-07-25 10:00",
      "aqi": "62",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "74",
      "pm2p5": "29",
      "no2": "32",
      "so2": "4",
      "co": "0.8",
      "o3": "125"
    },
    {
      "pubTime": "2020-07-25 11:00",
      "aqi": "58",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "66",
      "pm2p5": "30",
      "no2": "25",
      "so2": "4",
      "co": "0.8",
      "o3": "164"
    },
    {
      "pubTime": "2020-07-25 12:00",
      "aqi": "68",
      "level": "2",
      "category": "良",
      "primary": "O3",
      "pm10": "61",
      "pm2p5": "29",
      "no2": "23",
      "so2": "3",
      "co": "0.7",
      "o3": "174"
    },
    {
      "pubTime": "2020-07-25 13:00",
      "aqi": "83",
      "level": "2",
      "category": "良",
      "primary": "O3",
      "pm10": "52",
      "pm2p5": "27",
      "no2": "22",
      "so2": "3",
      "co": "0.7",
      "o3": "186"
    },
    {
      "pubTime": "2020-07-25 14:00",
      "aqi": "97",
      "level": "2",
      "category": "良",
      "primary": "O3",
      "pm10": "41",
      "pm2p5": "25",
      "no2": "18",
      "so2": "3",
      "co": "0.6",
      "o3": "197"
    },
    {
      "pubTime": "2020-07-25 15:00",
      "aqi": "98",
      "level": "2",
      "category": "良",
      "primary": "O3",
      "pm10": "51",
      "pm2p5": "24",
      "no2": "19",
      "so2": "2",
      "co": "0.5",
      "o3": "198"
    },
    {
      "pubTime": "2020-07-25 16:00",
      "aqi": "83",
      "level": "2",
      "category": "良",
      "primary": "O3",
      "pm10": "54",
      "pm2p5": "24",
      "no2": "20",
      "so2": "2",
      "co": "0.5",
      "o3": "186"
    },
    {
      "pubTime": "2020-07-25 17:00",
      "aqi": "74",
      "level": "2",
      "category": "良",
      "primary": "O3",
      "pm10": "59",
      "pm2p5": "24",
      "no2": "21",
      "so2": "2",
      "co": "0.6",
      "o3": "179"
    },
    {
      "pubTime": "2020-07-25 18:00",
      "aqi": "73",
      "level": "2",
      "category": "良",
      "primary": "O3",
      "pm10": "62",
      "pm2p5": "24",
      "no2": "22",
      "so2": "2",
      "co": "0.6",
      "o3": "178"
    },
    {
      "pubTime": "2020-07-25 19:00",
      "aqi": "58",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "66",
      "pm2p5": "25",
      "no2": "24",
      "so2": "3",
      "co": "0.6",
      "o3": "166"
    },
    {
      "pubTime": "2020-07-25 20:00",
      "aqi": "58",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "66",
      "pm2p5": "27",
      "no2": "28",
      "so2": "3",
      "co": "0.6",
      "o3": "147"
    },
    {
      "pubTime": "2020-07-25 21:00",
      "aqi": "66",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "82",
      "pm2p5": "31",
      "no2": "29",
      "so2": "3",
      "co": "0.7",
      "o3": "127"
    },
    {
      "pubTime": "2020-07-25 22:00",
      "aqi": "67",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "83",
      "pm2p5": "32",
      "no2": "26",
      "so2": "4",
      "co": "0.8",
      "o3": "125"
    },
    {
      "pubTime": "2020-07-25 23:00",
      "aqi": "70",
      "level": "2",
      "category": "良",
      "primary": "PM10",
      "pm10": "89",
      "pm2p5": "37",
      "no2": "28",
      "so2": "4",
      "co": "0.9",
      "o3": "120"
    }
  ],
  "refer": {
    "sources": [
      "QWeather"
    ],
    "license": [
      "QWeather Developers License"
    ]
  }
}
  • code 请参考状态码
  • fxLink 当前数据的响应式页面,便于嵌入网站或应用
  • airHourly.pubTime 空气质量数据发布时间
  • airHourly.aqi 空气质量指数
  • airHourly.level 空气质量指数等级
  • airHourly.category 空气质量指数级别
  • airHourly.primary 空气质量的主要污染物,空气质量为优时,返回值为NA
  • airHourly.pm10 PM10
  • airHourly.pm2p5 PM2.5
  • airHourly.no2 二氧化氮
  • airHourly.so2 二氧化硫
  • airHourly.co 一氧化碳
  • airHourly.o3 臭氧
  • refer.sources 原始数据来源,或数据源说明,可能为空
  • refer.license 数据许可或版权声明,可能为空