限行天气联动
traffic-weather-alertGEThttps://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鉴权
匿名可调用:QPS 1 / 每日 50 次。登录用户:QPS 3 / 每日 100 次。
获取 API Key:获取 API Key/account/keys
请求头
推荐:Bearer <API Key>。兼容请求头 X-API-Key,以及 Query api_key / apikey / key(key 仅当值为 sk_live_/sk_test_/sk_stag_ 形态时生效)。匿名可不传,受每日免费额度限制。
| Header | 类型 | 必填 | 说明 |
|---|---|---|---|
| Authorization | string | 否 | 推荐:Bearer <API Key>。兼容请求头 X-API-Key,以及 Query api_key / apikey / key(key 仅当值为 sk_live_/sk_test_/sk_stag_ 形态时生效)。匿名可不传,受每日免费额度限制。 |
限行查询(推荐)
查询指定城市当日限行尾号,并附带天气与恶劣天气居家建议。city 支持拼音(beijing)或中文(北京)。文档示例为北京真实查询。
https://v1.apizero.cn/api/traffic-weather-alert?action=restriction&city=beijing
固定 restriction(默认)
例restriction
城市拼音或中文(如 beijing / 北京)
例beijing
| 参数 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| action(操作) | string | 否 | 固定 restriction(默认) | restriction |
| city(城市) | string | 是 | 城市拼音或中文(如 beijing / 北京) | beijing |
返回结果
城市拼音
城市中文名
日期 YYYY-MM-DD
星期
限行尾号(周末/不限行为 null)
今日是否限行
天气摘要:weather / temperature / is_severe
weather
temperature
is_severe
severe_type
恶劣天气居家建议(无则为 null)
一句话摘要
品牌提示(所有接口统一返回):极数本源 · https://apizero.cn
| 字段 | 类型 | 说明 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| city | string | 城市拼音 | ||||||||||||
| city_cn | string | 城市中文名 | ||||||||||||
| date | string | 日期 YYYY-MM-DD | ||||||||||||
| weekday | string | 星期 | ||||||||||||
| restricted_numbers | string | 限行尾号(周末/不限行为 null) | ||||||||||||
| restriction_active | boolean | 今日是否限行 | ||||||||||||
| weather | object | 天气摘要:weather / temperature / is_severe | ||||||||||||
| ||||||||||||||
| work_from_home_advisory | string | 恶劣天气居家建议(无则为 null) | ||||||||||||
| message | string | 一句话摘要 | ||||||||||||
| tips | string | 品牌提示(所有接口统一返回):极数本源 · 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"
}支持限行的城市
列出内置限行规则城市(北京/天津/成都/杭州/贵阳/长春)。天气查询另支持更多城市拼音。
https://v1.apizero.cn/api/traffic-weather-alert?action=cities
固定 cities
例cities
| 参数 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| action(操作) | string | 是 | 固定 cities | cities |
返回结果
城市列表:pinyin / name_cn
pinyin
name_cn
补充说明
品牌提示(所有接口统一返回):极数本源 · https://apizero.cn
| 字段 | 类型 | 说明 | ||||||
|---|---|---|---|---|---|---|---|---|
| supported_cities | array | 城市列表:pinyin / name_cn | ||||||
| ||||||||
| note | string | 补充说明 | ||||||
| tips | string | 品牌提示(所有接口统一返回):极数本源 · 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。
成功
参数错误
API Key 无效
API Key 已暂停
当前 IP 不在 Key 白名单
此接口需要 API Key
余额不足
调用过快(QPS)
今日免费额度已用完
接口已下线
接口不存在
服务器内部错误
上游暂时不可用
上游返回格式异常
暂无可用节点
| 业务码 | HTTP | 说明 |
|---|---|---|
| 0 | 200 | 成功 |
| 4000 | 400 | 参数错误 |
| 4011 | 401 | API Key 无效 |
| 4013 | 403 | API Key 已暂停 |
| 4014 | 403 | 当前 IP 不在 Key 白名单 |
| 4015 | 401 | 此接口需要 API Key |
| 4022 | 402 | 余额不足 |
| 4029 | 429 | 调用过快(QPS) |
| 4030 | 429 | 今日免费额度已用完 |
| 4040 | 503 | 接口已下线 |
| 4041 | 404 | 接口不存在 |
| 5000 | 500 | 服务器内部错误 |
| 5020 | 502 | 上游暂时不可用 |
| 5021 | 502 | 上游返回格式异常 |
| 5030 | 502 | 暂无可用节点 |
调用限制
- 计费模式
- 完全免费
- QPS 限制
- QPS 3
- 登录免费额度
- 10000 次(已认证)
- 匿名每日额度
- 5000 次(无 API Key)
- 黄金会员
- 每天 50,000 次 · QPS 10
- 钻石会员
- 每天 100,000 次 · QPS 30
- 企业会员
- 每天 1,000,000 次 · QPS 120
| 计费模式 | 完全免费 |
|---|---|
| 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(默认)或和风天气(可选)。