腾讯天气

tencent-weatherPOST
POSThttps://v1.apizero.cn/api/tencent-weather

概述

腾讯天气官方数据源,中文省市名直接查询全国天气,无需经纬度。 输入省 + 市(可选区县)即可获取:实时天气、空气质量(AQI/PM2.5/PM10)、未来 7 天预报、24 小时逐时预报、23 项生活指数、日出日落与机动车限行信息。数据来自腾讯天气,权威稳定。完全免费:未登录每日 500 次,登录用户每日 1000 次。

调用约定

  • 网关 · https://v1.apizero.cn
  • 鉴权 · Authorization: Bearer <API Key>
  • 回包 · JSON {code, msg, data}。成功看 code === 0,不要只看 HTTP 200。
/aidocs/tencent-weather/raw.md
打开 Markdown

鉴权

完全免费。未登录每日 500 次;携带 API Key(Authorization: Bearer <key>)登录用户每日 1000 次。

获取 API Key

请求头

Authorizationstring选填

推荐:Bearer <API Key>。兼容请求头 X-API-Key,以及 Query api_key / apikey / key(key 仅当值为 sk_live_/sk_test_/sk_stag_ 形态时生效)。匿名可不传,受每日免费额度限制。

请求参数

POST · APPLICATION/JSON

province(省)string必填

省 / 直辖市(中文名)

例广东

city(城市)string必填

市(中文名)

例深圳

county(区县)string选填

区 / 县(中文名),可提升定位精度与限行准确度

例南山

{
  "province": "广东",
  "city": "深圳",
  "county": "南山"
}

返回结果

顶层固定为 code / msg / data。下表一般是 data 内字段。 code · msg · data · tips · request_id

locationobject

查询位置 { province, city, county? }

provincestring

province

citystring

城市

countystring

county

observeobject

实时天气(weather/temperature/humidity/wind_direction/wind_power/update_time 等)

weatherstring

weather

temperaturenumber

temperature

humiditynumber

humidity

wind_directionstring

wind_direction

wind_powerstring

wind_power

update_timestring

update_time

airobject

空气质量(aqi/level/quality/pm25/pm10/so2/no2/o3/co)

aqinumber

aqi

levelnumber

level

qualitystring

清晰度

pm25number

pm25

pm10number

pm10

daily_forecastarray

未来 7 天预报(含昼夜天气、风向风力、最高/最低温)

datestring

date

temperatureobject

temperature

minnumber

min

maxnumber

max

hourly_forecastarray

未来 24 小时逐时预报

timestring

时间

temperaturenumber

temperature

weatherstring

weather

life_indexarray

生活指数(穿衣/舒适/感冒/运动/紫外线等 23 项)

keystring

key

namestring

名称

levelstring

level

detailstring

detail

sunrise_sunsetarray

未来数日日出日落时间

datestring

date

sunrisestring

sunrise

sunsetstring

sunset

alarmarray

气象预警列表(无预警时为空数组)

alarm[]string

alarm 的一项

limitobject

机动车尾号限行(无则为 null)

tail_numberstring

tail_number

datestring

date

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

返回示例

{
  "code": 0,
  "msg": "成功",
  "data": {
    "location": {
      "province": "广东",
      "city": "深圳",
      "county": "南山"
    },
    "observe": {
      "weather": "多云",
      "temperature": 30,
      "humidity": 77,
      "wind_direction": "北风",
      "wind_power": "3-4",
      "update_time": "2026-07-01 10:15"
    },
    "air": {
      "aqi": 13,
      "level": 1,
      "quality": "优",
      "pm25": 4,
      "pm10": 12
    },
    "daily_forecast": [
      {
        "date": "2026-07-01",
        "temperature": {
          "min": 26,
          "max": 33
        }
      }
    ],
    "hourly_forecast": [
      {
        "time": "07-01 10:00",
        "temperature": 30,
        "weather": "多云"
      }
    ],
    "life_index": [
      {
        "key": "clothes",
        "name": "穿衣",
        "level": "炎热",
        "detail": "..."
      }
    ],
    "sunrise_sunset": [
      {
        "date": "2026-07-01",
        "sunrise": "05:43",
        "sunset": "19:12"
      }
    ],
    "alarm": [],
    "limit": {
      "tail_number": "3和8",
      "date": "2026-07-01"
    }
  },
  "request_id": "abc123",
  "tips": "极数本源 · https://apizero.cn"
}

请求示例

示例都是服务端写法。Python / JavaScript 各有常规写法和官方库。

curl -sS -X POST "https://v1.apizero.cn/api/tencent-weather" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "province": "广东",
  "city": "深圳",
  "county": "南山"
}'

错误码

先看业务 code。HTTP 也可能不是 200。

0200

成功

4000400

参数错误

4011401

API Key 无效

4013403

API Key 已暂停

4014403

当前 IP 不在 Key 白名单

4015401

此接口需要 API Key

4022402

余额不足

4029429

调用过快(QPS)

4030429

今日免费额度已用完

4040503

接口已下线

4041404

接口不存在

5000500

服务器内部错误

5020502

上游暂时不可用

5021502

上游返回格式异常

5030502

暂无可用节点

调用限制

计费模式
完全免费
QPS 限制
QPS 3
登录免费额度
1000 次(已认证)
匿名每日额度
500 次(无 API Key)
黄金会员
每天 50,000 次 · QPS 10
钻石会员
每天 100,000 次 · QPS 30
企业会员
每天 1,000,000 次 · QPS 120

购买套餐、看评价请走商城详情。 购买 / 调试

更新日志

  • v1.02026-07-01

    首次上线,支持实时/7天/24小时/空气质量/生活指数/日出日落/预警/限行。