限行天气联动

traffic-weather-alertGET
GEThttps://v1.apizero.cn/api/traffic-weather-alert

概述

输入国内城市拼音(兼容中文),返回当天的限行尾号。如遇暴雨/台风等恶劣天气,附加居家办公建议。覆盖北京、天津、成都、杭州、贵阳、长春 6 个限行城市,天气支持所有国内主要城市。

调用约定

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

鉴权

匿名可调用:QPS 1 / 每日 50 次。登录用户:QPS 3 / 每日 100 次。

获取 API Key

请求头

Authorizationstring选填

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

限行查询(推荐)

GETURL QUERY·APPLICATION/JSON

查询指定城市当日限行尾号,并附带天气与恶劣天气居家建议。city 支持拼音(beijing)或中文(北京)。文档示例为北京真实查询。

https://v1.apizero.cn/api/traffic-weather-alert?action=restriction&city=beijing

action(操作)string选填

固定 restriction(默认)

例restriction

city(城市)string必填

城市拼音或中文(如 beijing / 北京)

例beijing

返回结果

citystring

城市拼音

city_cnstring

城市中文名

datestring

日期 YYYY-MM-DD

weekdaystring

星期

restricted_numbersstring

限行尾号(周末/不限行为 null)

restriction_activeboolean

今日是否限行

weatherobject

天气摘要:weather / temperature / is_severe

weatherstring

weather

temperaturestring

temperature

is_severeboolean

is_severe

severe_typestring

severe_type

work_from_home_advisorystring

恶劣天气居家建议(无则为 null)

messagestring

一句话摘要

tipsstring

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

{
  "code": 0,
  "msg": "成功",
  "data": {
    "city": "beijing",
    "city_cn": "北京",
    "date": "2026-07-31",
    "weekday": "周五",
    "restricted_numbers": "3,8",
    "restriction_active": true,
    "weather": {
      "weather": "Clear ",
      "temperature": "28°C",
      "is_severe": false,
      "severe_type": null
    },
    "work_from_home_advisory": null,
    "message": "今日北京(周五)限行尾号为 3,8"
  },
  "tips": "极数本源 · https://apizero.cn"
}

支持限行的城市

GETURL QUERY·APPLICATION/JSON

列出内置限行规则城市(北京/天津/成都/杭州/贵阳/长春)。天气查询另支持更多城市拼音。

https://v1.apizero.cn/api/traffic-weather-alert?action=cities

action(操作)string必填

固定 cities

例cities

返回结果

supported_citiesarray

城市列表:pinyin / name_cn

pinyinstring

pinyin

name_cnstring

name_cn

notestring

补充说明

tipsstring

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

{
  "code": 0,
  "msg": "成功",
  "data": {
    "supported_cities": [
      {
        "pinyin": "beijing",
        "name_cn": "北京"
      },
      {
        "pinyin": "tianjin",
        "name_cn": "天津"
      },
      {
        "pinyin": "chengdu",
        "name_cn": "成都"
      },
      {
        "pinyin": "hangzhou",
        "name_cn": "杭州"
      },
      {
        "pinyin": "guiyang",
        "name_cn": "贵阳"
      },
      {
        "pinyin": "changchun",
        "name_cn": "长春"
      }
    ],
    "note": "以上为有限行规则的城市;天气查询支持所有国内主要城市拼音"
  },
  "tips": "极数本源 · https://apizero.cn"
}

请求示例

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

curl -sS -H "Authorization: Bearer YOUR_API_KEY" "https://v1.apizero.cn/api/traffic-weather-alert?city=beijing&action=restriction"

错误码

先看业务 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
登录免费额度
10000 次(已认证)
匿名每日额度
5000 次(无 API Key)
黄金会员
每天 50,000 次 · QPS 10
钻石会员
每天 100,000 次 · QPS 30
企业会员
每天 1,000,000 次 · QPS 120

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

更新日志

  • 1.0.02026-05-10

    首次上线,6 城限行 + wttr.in 天气 + 恶劣天气联动

免责声明

限行规则可能因节假日临时调整,以官方通告为准。天气数据来自 wttr.in(默认)或和风天气(可选)。

限行天气联动 接入文档|极数本源