接口简介:
可查询国内2011年至今的历史天气信息。
请求地址:
https://cn.apihz.cn/api/tianqi/oldtqyb.php
请求方式:
POST或GET。
请求参数:
【名称】【参数】【必填】【说明】
【用户ID】【id】【是】【用户中心的数字ID,例:id=10000000】
【用户KEY】【key】【是】【用户中心通讯秘钥,例:key=15he5h15ty854j5sr152hs2】
【省份名称】【sheng】【否】【一级行政区,要查询的省份名称,直辖市也为一级行政区。可查询地区列表可调用接口【天气预报-天气预报1-7天-中国气象局-地址列表】https://www.apihz.cn/api/tianqitqyblist.html。例:sheng=北京,sheng=北京市,sheng=四川省,sheng=四川】
【地点】【place】【是】【要查询的地点,一般为市级名称或该市下的某地点名称。某些直辖市可查区级。部分地区暂无数据,可联系我们修复补充。可查询地点列表可调用接口【天气预报-天气预报1-7天-中国气象局-地址列表】https://www.apihz.cn/api/tianqitqyblist.html。例:place=大兴区,place=大兴,place=上海,place=重庆,place=广州,place=深圳】
【查询年】【y】【是】【可查询2011年-当前年。例:y=2026】
【查询月】【m】【是】【查询月份。例:m=1】
【查询日】【d】【否】【查询日。如不传该参数则返回整月天气数据集,查询整月天气需开通彩钻或炫钻或焱钻会员。例:d=1】
返回参数:
【名称】【参数】【说明】
【状态码】【code】【200成功,400错误】
【消息内容】【msg】【信息提示。】
【省级】【sheng】【查询地址省级。】
【市级】【shi】【查询地址市级或地区。】
【天气预报地址】【name】【天气预报地址。】
【天气数据集】【data】【天气数据集。】
【查询日】【data.d】【查询日。】
【当日白天天气】【data.weather1】【当日白天天气。】
【当日夜间天气】【data.weather2】【当日夜间天气。】
【当日白天温度】【data.wd1】【当日白天温度。】
【当日夜间温度】【data.wd2】【当日夜间温度。】
【当日白天风向】【data.winddirection1】【当日白天风向。2026年1月27日前的白天和夜间会组合在该字段返回。】
【当日夜间风向】【data.winddirection2】【当日夜间风向。】
【当日白天风力等级】【data.windleve1】【当日白天风力等级。】
【当日夜间风力等级】【data.windleve2】【当日夜间风力等级。】
【当日白天天气图标】【data.weather1img】【当日白天天气图标。】
【当日夜间天气图标】【data.weather2img】【当日夜间天气图标。】
【预警信息】【data.alarm】【2026年1月27日前该字段无数据。】
GET请求示例:
https://cn.apihz.cn/api/tianqi/oldtqyb.php?id=88888888&key=88888888&sheng=四川&place=绵阳&y=2026&m=1&d=1
注意:示例里的ID与KEY为公共ID与KEY,共享每分钟调用频次限制,接口本身免费,请使用自己的ID与KEY,独享每分钟调用频次。每日调用无上限。
POST请求示例:
请根据开发语言自行POST。
返回数据示例:
示例:{"code":400,"msg":"通讯秘钥错误。"}
示例:
{
"code": 200,
"sheng": "四川",
"shi": "绵阳",
"name": "绵阳",
"y": 2026,
"m": 1,
"datas": [{
"d": "1",
"weather1": "阴",
"weather2": "小雨",
"wd1": "9",
"wd2": "5",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": null
}, {
"d": "2",
"weather1": "阴",
"weather2": "小雨",
"wd1": "5",
"wd2": "3",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": null
}, {
"d": "3",
"weather1": "小雨",
"weather2": "阴",
"wd1": "5",
"wd2": "2",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": null
}, {
"d": "4",
"weather1": "小雨",
"weather2": "晴",
"wd1": "10",
"wd2": "2",
"winddirection1": "南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "5",
"weather1": "阴",
"weather2": "多云",
"wd1": "8",
"wd2": "0",
"winddirection1": "东风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "6",
"weather1": "晴",
"weather2": "阴",
"wd1": "12",
"wd2": "0",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": null
}, {
"d": "7",
"weather1": "阴",
"weather2": "多云",
"wd1": "13",
"wd2": "0",
"winddirection1": "南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "8",
"weather1": "雾",
"weather2": "晴",
"wd1": "12",
"wd2": "0",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/wu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "9",
"weather1": "多云",
"weather2": "多云",
"wd1": "13",
"wd2": "2",
"winddirection1": "西南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "10",
"weather1": "多云",
"weather2": "晴",
"wd1": "15",
"wd2": "2",
"winddirection1": "东北风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "11",
"weather1": "雾",
"weather2": "多云",
"wd1": "8",
"wd2": "2",
"winddirection1": "东风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/wu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "12",
"weather1": "多云",
"weather2": "晴",
"wd1": "15",
"wd2": "2",
"winddirection1": "西南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "13",
"weather1": "多云",
"weather2": "多云",
"wd1": "13",
"wd2": "5",
"winddirection1": "东北风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "14",
"weather1": "多云",
"weather2": "多云",
"wd1": "19",
"wd2": "3",
"winddirection1": "西北风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "15",
"weather1": "晴",
"weather2": "多云",
"wd1": "16",
"wd2": "3",
"winddirection1": "东风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "16",
"weather1": "雾",
"weather2": "晴",
"wd1": "17",
"wd2": "2",
"winddirection1": "西南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/wu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "17",
"weather1": "多云",
"weather2": "晴",
"wd1": "15",
"wd2": "6",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "18",
"weather1": "多云",
"weather2": "小雨",
"wd1": "16",
"wd2": "10",
"winddirection1": "东北风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": null
}, {
"d": "19",
"weather1": "小雨",
"weather2": "阴",
"wd1": "10",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": "{
"id": "51070041600000_20260119090021",
"title": "绵阳市气象台更新大风蓝色预警信号[IV级/一般]",
"signaltype": "大风",
"signallevel": "蓝色",
"effective": "2026/01/19 09:00",
"eventType": "11B06",
"severity": "BLUE",
"type": "p0007004"
}"
}, {
"d": "20",
"weather1": "阴",
"weather2": "阴",
"wd1": "5",
"wd2": "3",
"winddirection1": "东南风2级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": null
}, {
"d": "21",
"weather1": "阴",
"weather2": "晴",
"wd1": "7",
"wd2": "1",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": null
}, {
"d": "22",
"weather1": "多云",
"weather2": "多云",
"wd1": "6",
"wd2": "1",
"winddirection1": "东南风1级",
"winddirection2": null,
"windleve1": null,
"windleve2": null,
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": null
}, {
"d": "23",
"weather1": "多云",
"weather2": "阴",
"wd1": "6",
"wd2": "2",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": "null"
}, {
"d": "24",
"weather1": "多云",
"weather2": "晴",
"wd1": "7",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/qing.png",
"alarm": "null"
}, {
"d": "25",
"weather1": "阴",
"weather2": "多云",
"wd1": "6",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"alarm": "null"
}, {
"d": "26",
"weather1": "多云",
"weather2": "小雨",
"wd1": "10",
"wd2": "3",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/xiaoyu.png",
"alarm": "null"
}, {
"d": "27",
"weather1": "多云",
"weather2": "阴",
"wd1": "13",
"wd2": "5",
"winddirection1": "无持续风向",
"winddirection2": "无持续风向",
"windleve1": "微风",
"windleve2": "微风",
"weather1img": "https://rescdn.apihz.cn/resimg/tianqi/duoyun.png",
"weather2img": "https://rescdn.apihz.cn/resimg/tianqi/yin.png",
"alarm": "null"
}]
}
参考资料(版权):
https://www.apihz.cn/api/tianqioldtqyb.html