实时空气质量(beta)

平台: API

全球空气质量实时数据,我们提供了基于各个国家或地区当地规则的AQI以及污染物浓度值,你可以查询指定城市的当前小时实时数据。

注意:全新的实时空气质量目前处于beta阶段,标准订阅暂不收取费用。数据内容在正式发布后可能会有所不同。

提示:推荐阅读空气质量信息文档,以便了解指数类型、污染物、支持的国家等信息。

请求URL

https://api.qweather.com/airquality/v1/now/{LocationID}?{查询参数}

如果是免费订阅,将上述API Host更改为devapi.qweather.com。参考免费订阅可用的数据

路径参数

  • LocationID(必选)所需查询城市的LocationID,LocationID可通过GeoAPI获取。例如 101010100

查询参数

  • key(必选)用户认证key,请参考如何获取你的KEY。支持数字签名方式进行认证。例如 key=123456789ABC
  • lang多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。

请求示例

上海实时空气质量

curl -L -X GET --compressed 'https://api.qweather.com/airquality/v1/now/101020100?key=YOUR_KEY'

返回数据

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

{
  "code": "200",
  "updateTime": "2023-07-14T21:20+08:00",
  "fxLink": "https://www.qweather.com/air/shanghai-101020100.html",
  "aqi": [
    {
      "code": "cn-mee-1h",
      "name": "AQI-1h (CN)",
      "value": "53",
      "level": "2",
      "category": "良",
      "color": "255,255,0",
      "primaryPollutant": {
        "code": "pm2p5",
        "name": "PM 2.5",
        "fullName": "颗粒物(粒径小于等于2.5µm)"
      }
    },
    {
      "code": "cn-mee",
      "name": "AQI (CN)",
      "value": "79",
      "level": "2",
      "category": "良",
      "color": "255,255,0",
      "primaryPollutant": {
        "code": "pm2p5",
        "name": "PM 2.5",
        "fullName": "颗粒物(粒径小于等于2.5µm)"
      }
    }
  ],
  "pollutant": [
    {
      "code": "pm2p5",
      "name": "PM 2.5",
      "fullName": "颗粒物(粒径小于等于2.5µm)",
      "concentration": {
        "value": "37",
        "unit": "μg/m3"
      },
      "subIndex": {
        "value": "53",
        "category": "良"
      }
    },
    {
      "code": "pm10",
      "name": "PM 10",
      "fullName": "颗粒物(粒径小于等于10µm)",
      "concentration": {
        "value": "54",
        "unit": "μg/m3"
      },
      "subIndex": {
        "value": "53",
        "category": "良"
      }
    },
    {
      "code": "no2",
      "name": "NO2",
      "fullName": "二氧化氮",
      "concentration": {
        "value": "62",
        "unit": "μg/m3"
      },
      "subIndex": {
        "value": "32",
        "category": "优"
      }
    },
    {
      "code": "o3",
      "name": "O3",
      "fullName": "臭氧",
      "concentration": {
        "value": "26",
        "unit": "μg/m3"
      },
      "subIndex": {
        "value": "9",
        "category": "优"
      }
    },
    {
      "code": "so2",
      "name": "SO2",
      "fullName": "二氧化硫",
      "concentration": {
        "value": "5",
        "unit": "μg/m3"
      },
      "subIndex": {
        "value": "2",
        "category": "优"
      }
    },
    {
      "code": "co",
      "name": "CO",
      "fullName": "一氧化碳",
      "concentration": {
        "value": "0.6",
        "unit": "mg/m3"
      },
      "subIndex": {
        "value": "7",
        "category": "优"
      }
    }
  ],
  "station": [
    {
      "id": "P5697",
      "name": "普陀"
    },
    {
      "id": "P54852",
      "name": "十五厂"
    },
    {
      "id": "P57823",
      "name": "虹口"
    },
    {
      "id": "P55605",
      "name": "徐汇上师大"
    },
    {
      "id": "P53057",
      "name": "杨浦四漂"
    },
    {
      "id": "P5663",
      "name": "静安监测站"
    },
    {
      "id": "P53991",
      "name": "浦东川沙"
    },
    {
      "id": "P53763",
      "name": "浦东新区监测站"
    },
    {
      "id": "P5659",
      "name": "浦东张江"
    },
    {
      "id": "P54024",
      "name": "宝山庙行"
    },
    {
      "id": "P59043",
      "name": "嘉定南翔"
    },
    {
      "id": "P5991",
      "name": "金山新城"
    },
    {
      "id": "P56226",
      "name": "闵行浦江"
    },
    {
      "id": "P56748",
      "name": "青浦徐泾"
    },
    {
      "id": "P56697",
      "name": "松江图书馆"
    },
    {
      "id": "P56700",
      "name": "长宁仙霞"
    },
    {
      "id": "P52014",
      "name": "浦东惠南"
    },
    {
      "id": "P51966",
      "name": "奉贤南桥新城"
    }
  ],
  "source": [
    "中国环境监测总站 (CNEMC)。1小时实时数据仅供参考,未经过完整的审核程序进行修订和确认。"
  ]
}
  • code 请参考状态码
  • updateTime 当前API的最近更新时间
  • fxLink 当前数据的响应式页面,便于嵌入网站或应用
  • aqi.code 空气质量指数Code
  • aqi.name 空气质量指数的名字
  • aqi.value 空气质量指数的值
  • aqi.level 空气质量指数等级,可能为空
  • aqi.category 空气质量指数类别,可能为空
  • aqi.color 空气质量指数的颜色,RGB格式
  • aqi.primaryPollutant.code 首要污染物的Code,可能为空
  • aqi.primaryPollutant.name 首要污染物的名字,可能为空
  • aqi.primaryPollutant.fullName 首要污染物的全称,可能为空
  • pollutant.code 污染物的Code
  • pollutant.name 污染物的名字
  • pollutant.fullName 污染物的全称
  • pollutant.concentration.value 污染物的浓度值
  • pollutant.concentration.unit 污染物的浓度值的单位
  • pollutant.subIndex.value 污染物的分指数,可能为空
  • pollutant.subIndex.level 污染物的分指数等级,可能为空
  • pollutant.subIndex.category 污染物的分指数类别,可能为空
  • station.id AQI相关联的监测站Location ID,可能为空
  • station.name AQI相关联的监测站名称
  • source 数据来源或提供商名字以及他们的声明,必须与空气质量数据一起展示。可能为空