空气质量实况

GETair/now

接口介绍

环保部1500+个监测站点实时空气质量(AQI)数据,以及目前唯一可提供的全国3240个城市的实时空气质量(AQI)数据 了解更多

环保部1500+个监测站点实况数据为免费数据,全国3240个城市实时空气质量指数为付费数据

普通用户仅可访问国控站点城市

请求URL

付费:https://api.heweather.com/s6/air/now?parameters

免费:https://free-api.heweather.com/s6/air/now?parameters

parameters代表请求参数,包括必选和可选参数。所有请求参数均使用&进行分隔,参数值存在中文或特殊字符的情况,需要对参数进行 url encode

请求参数

参数 描述 选择 示例值
location 需要查询的城市或地区,可输入以下值:
1. 城市ID:城市列表
2. 经纬度格式:经度,纬度(经度在前纬度在后,英文,分隔,十进制格式,北纬东经为正,南纬西经为负
3. 城市名称,支持中英文和汉语拼音
4. 城市名称,上级城市 或 省 或 国家,英文,分隔,此方式可以在重名的情况下只获取想要的地区的天气数据,例如 西安,陕西
5. IP
6. 根据请求自动判断,根据用户的请求获取IP,通过 IP 定位并获取城市数据
必选 1. location=CN101010100
2. location=116.40,39.9
3. location=北京、 location=北京市、 location=beijing
4. location=朝阳,北京、 location=chaoyang,beijing
5. location=60.194.130.1
6. location=auto_ip
lang 多语言,可以不使用该参数,默认为简体中文
详见多语言参数
可选 lang=en
unit 单位选择,公制(m)或英制(i),默认为公制单位
详见度量衡单位参数
可选 unit=i
key 用户认证key,登录控制台可查看
支持数字签名方式进行认证,推荐使用
必选 key=xxxxxxxxxxxxxx

字段和数值说明

basic 基础信息

参数 描述 示例值
location 地区/城市名称 北京
cid 地区/城市ID CN101010100
lat 地区/城市纬度 39.90999
lon 地区/城市经度 116.30999
parent_city 该地区/城市的上级城市 北京
admin_area 该地区/城市所属行政区域 北京
cnty 该地区/城市所属国家名称 中国
tz 该地区/城市所在时区 +8.0

update 接口更新时间

参数 描述 示例值
loc 当地时间,24小时制,格式yyyy-MM-dd HH:mm 2017-10-25 12:34
utc UTC时间,24小时制,格式yyyy-MM-dd HH:mm 2017-10-25 04:34

status 接口状态

参数 描述 示例
status 接口状态,具体含义请参考接口状态码及错误码 ok

air_now_city AQI城市实况

参数 描述 示例
pub_time 数据发布时间,格式yyyy-MM-dd HH:mm 2017-03-20 12:30
aqi 空气质量指数,AQI和PM25的关系 74
main 主要污染物 pm25
qlty 空气质量,取值范围:优,良,轻度污染,中度污染,重度污染,严重污染,查看计算方式
pm10 pm10 78
pm25 pm25 66
no2 二氧化氮 40
so2 二氧化硫 30
co 一氧化碳 33
o3 臭氧 20

air_now_station AQI站点实况

参数 描述 示例
pub_time 数据发布时间,格式yyyy-MM-dd HH:mm 2017-03-20 12:30
air_sta 站点名称 万寿西宫
asid 站点ID,请参考所有站点ID CNA110000
lat 站点纬度 116.405285
lon 站点经度 39.904989
aqi 空气质量指数,AQI和PM25的关系 74
main 主要污染物 pm25
qlty 空气质量,取值范围:优,良,轻度污染,中度污染,重度污染,严重污染,查看计算方式
pm10 pm10 78
pm25 pm25 66
no2 二氧化氮 40
so2 二氧化硫 30
co 一氧化碳 33
o3 臭氧 20

数据返回示例

{
    "HeWeather6": [
        {
            "air_now_city": {
                "aqi": "19",
                "co": "0",
                "main": "",
                "no2": "34",
                "o3": "31",
                "pm10": "18",
                "pm25": "8",
                "pub_time": "2017-11-07 22:00",
                "qlty": "优",
                "so2": "2"
            },
            "air_now_station": [
                {
                    "air_sta": "万寿西宫",
                    "aqi": "19",
                    "asid": "CNA1001",
                    "co": "0.4",
                    "lat": "39.8673",
                    "lon": "116.366",
                    "main": "-",
                    "no2": "37",
                    "o3": "29",
                    "pm10": "13",
                    "pm25": "5",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "3"
                },
                {
                    "air_sta": "定陵",
                    "aqi": "21",
                    "asid": "CNA1002",
                    "co": "0.4",
                    "lat": "40.2865",
                    "lon": "116.17",
                    "main": "-",
                    "no2": "7",
                    "o3": "66",
                    "pm10": "6",
                    "pm25": "1",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "3"
                },
                {
                    "air_sta": "东四",
                    "aqi": "16",
                    "asid": "CNA1003",
                    "co": "0.4",
                    "lat": "39.9522",
                    "lon": "116.434",
                    "main": "-",
                    "no2": "28",
                    "o3": "36",
                    "pm10": "16",
                    "pm25": "10",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "2"
                },
                {
                    "air_sta": "天坛",
                    "aqi": "22",
                    "asid": "CNA1004",
                    "co": "0.4",
                    "lat": "39.8745",
                    "lon": "116.434",
                    "main": "-",
                    "no2": "38",
                    "o3": "29",
                    "pm10": "22",
                    "pm25": "8",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "1"
                },
                {
                    "air_sta": "农展馆",
                    "aqi": "28",
                    "asid": "CNA1005",
                    "co": "0.6",
                    "lat": "39.9716",
                    "lon": "116.473",
                    "main": "-",
                    "no2": "56",
                    "o3": "15",
                    "pm10": "20",
                    "pm25": "12",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "2"
                },
                {
                    "air_sta": "官园",
                    "aqi": "25",
                    "asid": "CNA1006",
                    "co": "0.4",
                    "lat": "39.9425",
                    "lon": "116.361",
                    "main": "-",
                    "no2": "50",
                    "o3": "13",
                    "pm10": "15",
                    "pm25": "10",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "1"
                },
                {
                    "air_sta": "海淀区万柳",
                    "aqi": "31",
                    "asid": "CNA1007",
                    "co": "0.4",
                    "lat": "39.9934",
                    "lon": "116.315",
                    "main": "-",
                    "no2": "61",
                    "o3": "6",
                    "pm10": "28",
                    "pm25": "14",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "3"
                },
                {
                    "air_sta": "顺义新城",
                    "aqi": "16",
                    "asid": "CNA1008",
                    "co": "0.4",
                    "lat": "40.1438",
                    "lon": "116.72",
                    "main": "-",
                    "no2": "12",
                    "o3": "51",
                    "pm10": "16",
                    "pm25": "6",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "4"
                },
                {
                    "air_sta": "怀柔镇",
                    "aqi": "15",
                    "asid": "CNA1009",
                    "co": "0.3",
                    "lat": "40.3937",
                    "lon": "116.644",
                    "main": "-",
                    "no2": "21",
                    "o3": "48",
                    "pm10": "12",
                    "pm25": "5",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "3"
                },
                {
                    "air_sta": "昌平镇",
                    "aqi": "15",
                    "asid": "CNA1010",
                    "co": "0.5",
                    "lat": "40.1952",
                    "lon": "116.23",
                    "main": "-",
                    "no2": "20",
                    "o3": "48",
                    "pm10": "7",
                    "pm25": "3",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "2"
                },
                {
                    "air_sta": "奥体中心",
                    "aqi": "24",
                    "asid": "CNA1011",
                    "co": "0.4",
                    "lat": "40.0031",
                    "lon": "116.407",
                    "main": "-",
                    "no2": "48",
                    "o3": "21",
                    "pm10": "15",
                    "pm25": "9",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "3"
                },
                {
                    "air_sta": "古城",
                    "aqi": "32",
                    "asid": "CNA1012",
                    "co": "0.4",
                    "lat": "39.9279",
                    "lon": "116.225",
                    "main": "-",
                    "no2": "36",
                    "o3": "20",
                    "pm10": "32",
                    "pm25": "3",
                    "pub_time": "2017-11-07 22:00",
                    "qlty": "优",
                    "so2": "1"
                }
            ],
            "basic": {
                "cid": "CN101010100",
                "location": "北京",
                "parent_city": "北京",
                "admin_area": "北京",
                "cnty": "中国",
                "lat": "39.90498734",
                "lon": "116.40528870",
                "tz": "+8.0"
            },
            "status": "ok",
            "update": {
                "loc": "2017-11-07 22:46",
                "utc": "2017-11-07 14:46"
            }
        }
    ]
}