实况天气 API

currentconditions/v1 实时实况接口:温度、湿度、风力、天气现象与体感温度,需 Location Key,支持 details=true 与公制/英制。

产品概述

华风爱科实况天气 API 提供全球地点的实时气象数据,分为标准能力与进阶能力。调用前需通过 定位搜索 API 获取 Location Key。标准能力返回当前温度、天气状况、风力、体感温度等;进阶能力支持查询过去 6 小时(逐小时)或 24 小时的实况历史记录。由中国气象局授权品牌与 AccuWeather 全球数据能力提供支撑。

  • ✓标准能力: /currentconditions/v1/{locationkey}.json 获取当前实况
  • ✓进阶能力: 历史路径 historical / historical/24 查询过往实况
  • ✓完整字段: details=true 返回 RealFeel、UV、降水摘要等扩展要素
  • ✓单位兼容: 温度/风速等同时提供 Metric(公制)与 Imperial(英制)
产品展示

通过当前天气API可以构建的应用示例

Web/PC华风爱科实况天气 API PC 端网站实时温湿度展示示例

PC端天气网站

桌面浏览器端的天气预报网站,提供实时的详细天气数据展示,包含趋势图表、温湿度等多种可视化内容

响应式布局实时更新多维度展示
iOS/Android华风爱科 currentconditions 实况天气移动端 APP 示例

移动端APP

原生/混合移动应用,提供贴靠随身浏览的突发天气预防的用户界面

触控优化极速加载推送通知
Widget实况天气 API 桌面小组件实时刷新示例

桌面小组件

简洁直观的桌面天气小组件,快速浏览当前核心气象指标,提供沉浸式的使用体验

轻量化实时刷新系统原生
Car System车载系统实况天气与驾驶安全辅助界面示例

车载系统展示图

专为车载智能终端优化的实时天气界面,提供实时天气预警与安全驾驶辅助

精准实时车载适配安全辅助

快速开始

  1. 免费注册并完成开发者认证,获取 API Key(标准测试 Key 每日 500 次免费调用,5 QPS)。
  2. 通过 定位搜索 API 获取目标地点的 Location Key(示例:101924 北京)。
  3. 请求 GET /currentconditions/v1/{locationkey}.json,建议携带 language=zh-cn 与 details=true 获取完整实况字段。

标准能力接口

GET 调取当前实况天气数据
https://openapi.weathercn.com/currentconditions/v1/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true

进阶能力接口

⚠️ 进阶接口(历史实况)需单独申请开通权限。标准测试 Key 无法调用,会返回 401/403。如需开通,请注册账号后联系商务咨询,或在开发者后台提交权限申请。
GET 调取过往实况(前6小时) 进阶
https://openapi.weathercn.com/currentconditions/v1/101924/historical.json?apikey=YOUR_API_KEY&language=zh-cn&details=true
GET 调取过往实况(前24小时) 进阶
https://openapi.weathercn.com/currentconditions/v1/101924/historical/24.json?apikey=YOUR_API_KEY&language=zh-cn&details=true

请求参数

URL 路径中的 {locationkey} 为定位 API 返回的 Location Key;下表为查询参数。进阶历史接口路径不同(historical / historical/24),查询参数与标准能力一致。

参数名 类型 必填 默认值 说明 示例
apikey String 是 - 用以在API里验证与授权使用的用户密钥 YOUR_API_KEY
version String 是 v1 当前API版本 v1
locationkey String 是 - 用以搜索指定地点的特定ID 101924
format String 否 JSON 响应格式 JSON
language String 否 en-us 指定响应数据语言的字符串 zh-cn
details String 否 false 用以判断返回缩短版或完整版的当前天气状况 details = true

返回字段

参数 类型 说明 数据形式示例
LocalObservationDateTime
String 本地观测时间(ISO 8601格式) 2026-07-27T13:48:09+08:00
EpochTime
Int 观测时间的 UNIX 时间戳 1785131289
WeatherIcon
Int 天气图标编号 7
WeatherText
String 天气状况描述文本 多云
HasPrecipitation
Boolean 是否有降水 false
PrecipitationType
String 降水类型(雨/雪/冰等) null
LocalSource ▶
Object 本地数据源信息 -
└─ Id
Int 源 ID 7
└─ Name
String 源名称 Huafeng
└─ WeatherCode
String 天气代码 01
└─ WindLevel
Int 风力等级 4
└─ WindDirectionCode
String 风向代码 5
└─ Temperature
String 温度字符串 32.0
IsDayTime
Boolean 是否为白天 true
Temperature ▶
Object 温度 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 32
└─ Unit
String 单位 C
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 89.6
└─ Unit
String 单位 F
RelativeHumidity
Int 相对湿度(%) 57
MobileLink
String 移动端链接 http://m.weathercn.com/zh/cn/beijing/101924/current-weather/101924?lang=zh-cn
Link
String 网页端链接 http://m.weathercn.com/zh/cn/beijing/101924/current-weather/101924?lang=zh-cn
RealFeelTemperature ▶
Object 体感温度 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 37.1
└─ Unit
String 单位 C
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 98.8
└─ Unit
String 单位 F
Wind ▶
Object 风力信息 -
└─ Direction ▶
Object 风向 -
└─ Degrees
Int 角度 225
└─ Localized
String 本地化方向 西南
└─ English
String 英文方向 SW
└─ Speed ▶
Object 风速 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 23.4
└─ Unit
String 单位 km/h
└─ UnitType
Int 单位类型 7
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 14.5
└─ Unit
String 单位 mi/h
└─ UnitType
Int 单位类型 9
WindGust ▶
Object 阵风信息 -
└─ Speed ▶
Object 阵风风速 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 23.4
└─ Unit
String 单位 km/h
└─ UnitType
Int 单位类型 7
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 14.5
└─ Unit
String 单位 mi/h
└─ UnitType
Int 单位类型 9
PrecipitationSummary ▶
Object 降水总结 -
└─ Precipitation ▶
Object 当前降水 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 0
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
└─ PastHour ▶
Object 过去1小时 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 0
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
└─ Past3Hours ▶
Object 过去3小时 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 0
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
└─ Past6Hours ▶
Object 过去6小时 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 1.7
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0.06
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
└─ Past9Hours ▶
Object 过去9小时 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 2.7
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0.1
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
└─ Past12Hours ▶
Object 过去12小时 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 2.7
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0.1
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
└─ Past18Hours ▶
Object 过去18小时 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 3.8
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0.15
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
└─ Past24Hours ▶
Object 过去24小时 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 3.8
└─ Unit
String 单位 mm
└─ UnitType
Int 单位类型 3
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 0.15
└─ Unit
String 单位 in
└─ UnitType
Int 单位类型 1
TemperatureSummary ▶
Object 温度总结 -
└─ Past6HourRange ▶
Object 过去6小时范围 -
└─ Minimum ▶
Object 最低 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 26.4
└─ Unit
String 单位 C
└─ UnitType
Int 单位类型 17
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 79
└─ Unit
String 单位 F
└─ UnitType
Int 单位类型 18
└─ Maximum ▶
Object 最高 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 32.3
└─ Unit
String 单位 C
└─ UnitType
Int 单位类型 17
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 90
└─ Unit
String 单位 F
└─ UnitType
Int 单位类型 18
└─ Past12HourRange ▶
Object 过去12小时范围 -
└─ Minimum ▶
Object 最低 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 23.5
└─ Unit
String 单位 C
└─ UnitType
Int 单位类型 17
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 74
└─ Unit
String 单位 F
└─ UnitType
Int 单位类型 18
└─ Maximum ▶
Object 最高 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 32.3
└─ Unit
String 单位 C
└─ UnitType
Int 单位类型 17
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 90
└─ Unit
String 单位 F
└─ UnitType
Int 单位类型 18
└─ Past24HourRange ▶
Object 过去24小时范围 -
└─ Minimum ▶
Object 最低 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 23.5
└─ Unit
String 单位 C
└─ UnitType
Int 单位类型 17
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 74
└─ Unit
String 单位 F
└─ UnitType
Int 单位类型 18
└─ Maximum ▶
Object 最高 -
└─ Metric ▶
Object 公制 -
└─ Value
Float 数值 32.9
└─ Unit
String 单位 C
└─ UnitType
Int 单位类型 17
└─ Imperial ▶
Object 英制 -
└─ Value
Float 数值 91
└─ Unit
String 单位 F
└─ UnitType
Int 单位类型 18
>_ 代码示例
# 调取当前实况天气数据(标准能力)
curl "https://openapi.weathercn.com/currentconditions/v1/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true"
// 调取当前实况天气数据(标准能力)
fetch('https://openapi.weathercn.com/currentconditions/v1/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true')
  .then(response => response.json())
  .then(data => console.log(data));
import requests

# 调取当前实况天气数据(标准能力)
url = "https://openapi.weathercn.com/currentconditions/v1/101924.json"
params = {'apikey': 'YOUR_API_KEY', 'language': 'zh-cn', 'details': 'true'}
response = requests.get(url, params=params)
print(response.json())
// 调取当前实况天气数据(标准能力)
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://openapi.weathercn.com/currentconditions/v1/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true"))
    .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
// 调取当前实况天气数据(标准能力)
$url = 'https://openapi.weathercn.com/currentconditions/v1/101924.json';
$params = http_build_query(['apikey' => 'YOUR_API_KEY', 'language' => 'zh-cn', 'details' => 'true']);
$response = file_get_contents($url . '?' . $params);
print_r(json_decode($response, true));
?>
package main
import (
  "fmt"
  "io"
  "net/http"
)
func main() {
  url := "https://openapi.weathercn.com/currentconditions/v1/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true"
  resp, _ := http.Get(url)
  defer resp.Body.Close()
  body, _ := io.ReadAll(resp.Body)
  fmt.Println(string(body))
}
require 'net/http'
require 'json'

url = URI("https://openapi.weathercn.com/currentconditions/v1/101924.json")
params = {apikey: 'YOUR_API_KEY', language: 'zh-cn', details: 'true'}
url.query = URI.encode_www_form(params)
response = Net::HTTP.get_response(url)
puts JSON.parse(response.body)
let url = URL(string: "https://openapi.weathercn.com/currentconditions/v1/101924.json?apikey=YOUR_API_KEY&language=zh-cn&details=true")!
let task = URLSession.shared.dataTask(with: url) { data, response, error in
    if let data = data { print(try? JSONSerialization.jsonObject(with: data)) }
}
task.resume()
[
  {
    "LocalObservationDateTime": "2026-03-10T10:50:09+08:00",
    "EpochTime": 1773111009,
    "WeatherIcon": 7,
    "WeatherText": "多云",
    "HasPrecipitation": false,
    "PrecipitationType": null,
    "LocalSource": {
      "Id": 7,
      "Name": "Huafeng",
      "WeatherCode": "01",
      "WindLevel": 2,
      "WindDirectionCode": "4",
      "WindGustDirectionCode": "4",
      "Temperature": "6.0"
    },
    "IsDayTime": true,
    "Temperature": {
      "Metric": { "Value": 6.0, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": 42.8, "Unit": "F", "UnitType": 18 }
    },
    "RelativeHumidity": 39,
    "MobileLink": "http://m.weathercn.com/zh/cn/beijing/101924/current-weather/101924?lang=zh-cn",
    "Link": "http://m.weathercn.com/zh/cn/beijing/101924/current-weather/101924?lang=zh-cn",
    "RealFeelTemperature": {
      "Metric": { "Value": 3.3, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": 37.9, "Unit": "F", "UnitType": 18 }
    },
    "RealFeelTemperatureShade": {
      "Metric": { "Value": 1.3, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": 34.3, "Unit": "F", "UnitType": 18 }
    },
    "IndoorRelativeHumidity": 33,
    "DewPoint": {
      "Metric": { "Value": -4.9, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": 23.0, "Unit": "F", "UnitType": 18 }
    },
    "Wind": {
      "Direction": { "Degrees": 180, "Localized": "南", "English": "S" },
      "Speed": {
        "Metric": { "Value": 10.4, "Unit": "km/h", "UnitType": 7 },
        "Imperial": { "Value": 6.5, "Unit": "mi/h", "UnitType": 9 }
      }
    },
    "WindGust": {
      "Speed": {
        "Metric": { "Value": 10.4, "Unit": "km/h", "UnitType": 7 },
        "Imperial": { "Value": 6.5, "Unit": "mi/h", "UnitType": 9 }
      }
    },
    "UVIndex": 3,
    "UVIndexText": "弱",
    "Visibility": {
      "Metric": { "Value": 11.4, "Unit": "km", "UnitType": 6 },
      "Imperial": { "Value": 7.1, "Unit": "mi", "UnitType": 2 }
    },
    "ObstructionsToVisibility": "",
    "CloudCover": 10,
    "Ceiling": {
      "Metric": { "Value": 8961.0, "Unit": "m", "UnitType": 5 },
      "Imperial": { "Value": 29400.0, "Unit": "ft", "UnitType": 0 }
    },
    "Pressure": {
      "Metric": { "Value": 1017.0, "Unit": "mb", "UnitType": 14 },
      "Imperial": { "Value": 30.03, "Unit": "inHg", "UnitType": 12 }
    },
    "PressureTendency": { "LocalizedText": "下降", "Code": "F" },
    "Past24HourTemperatureDeparture": {
      "Metric": { "Value": -1.7, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": -3.0, "Unit": "F", "UnitType": 18 }
    },
    "ApparentTemperature": {
      "Metric": { "Value": 5.0, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": 41.0, "Unit": "F", "UnitType": 18 }
    },
    "WindChillTemperature": {
      "Metric": { "Value": 1.7, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": 35.0, "Unit": "F", "UnitType": 18 }
    },
    "WetBulbTemperature": {
      "Metric": { "Value": 0.8, "Unit": "C", "UnitType": 17 },
      "Imperial": { "Value": 33.0, "Unit": "F", "UnitType": 18 }
    },
    "Precip1hr": {
      "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 },
      "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 }
    },
    "PrecipitationSummary": {
      "Precipitation": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } },
      "PastHour": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } },
      "Past3Hours": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } },
      "Past6Hours": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } },
      "Past9Hours": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } },
      "Past12Hours": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } },
      "Past18Hours": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } },
      "Past24Hours": { "Metric": { "Value": 0.0, "Unit": "mm", "UnitType": 3 }, "Imperial": { "Value": 0.0, "Unit": "in", "UnitType": 1 } }
    },
    "TemperatureSummary": {
      "Past6HourRange": {
        "Minimum": { "Metric": { "Value": -0.9, "Unit": "C", "UnitType": 17 }, "Imperial": { "Value": 30.0, "Unit": "F", "UnitType": 18 } },
        "Maximum": { "Metric": { "Value": 4.2, "Unit": "C", "UnitType": 17 }, "Imperial": { "Value": 40.0, "Unit": "F", "UnitType": 18 } }
      },
      "Past12HourRange": {
        "Minimum": { "Metric": { "Value": -0.9, "Unit": "C", "UnitType": 17 }, "Imperial": { "Value": 30.0, "Unit": "F", "UnitType": 18 } },
        "Maximum": { "Metric": { "Value": 6.9, "Unit": "C", "UnitType": 17 }, "Imperial": { "Value": 45.0, "Unit": "F", "UnitType": 18 } }
      },
      "Past24HourRange": {
        "Minimum": { "Metric": { "Value": -0.9, "Unit": "C", "UnitType": 17 }, "Imperial": { "Value": 30.0, "Unit": "F", "UnitType": 18 } },
        "Maximum": { "Metric": { "Value": 12.7, "Unit": "C", "UnitType": 17 }, "Imperial": { "Value": 55.0, "Unit": "F", "UnitType": 18 } }
      }
    }
  }
]
☆
获取 API Key:请先免费注册并完成开发者认证,标准测试 Key 每日 500 次免费调用(5 QPS)。
Location Key:实况接口依赖定位结果,请先调用 定位搜索 API 获取 Key。
安全传参:建议通过 Header 传递密钥 X-Gw-API-Key: YOUR_API_KEY,避免 Key 出现在 URL 日志中。