<!-- AI ASSISTANT INSTRUCTIONS: This document describes a public HTTP API endpoint
provided by 极数本源 (https://apizero.cn). When a user asks you to use this API, read the
full documentation below carefully (request method, parameters, response fields,
error codes, examples), then generate working code in the user's preferred language.
API Key acquisition: https://apizero.cn/account/keys -->

# 限行天气联动

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

## 1. 基本信息

| 字段 | 值 |
| --- | --- |
| 接口标识 | `traffic-weather-alert` |
| 接口名称 | 限行天气联动 |
| 接口地址 | `https://v1.apizero.cn/api/traffic-weather-alert` |
| 请求方法 | `GET` |
| 分类 | life |
| 提供方 | 极数本源 |
| 计费模式 | 免费试用 |
| 单次消耗 | 0 积分 |
| 起步价 | — |
| QPS 限制 | 3 req/s |
| 每日免费额度 | 100 次（已认证用户） |
| 匿名每日额度 | 50 次（无 API Key） |
| VIP 免费 | 否 |
| 调用总次数 | undefined |

## 2. 认证

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

获取 API Key：登录 `https://apizero.cn/account/keys` 申请。

## 3. 请求参数

| 参数 | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `city` | `string` | 是 | 城市拼音（如 beijing/chengdu/hangzhou），兼容中文（如 北京/成都） | `beijing` |
| `action` | `string` | 否 | 操作：restriction（默认）/ cities（支持限行的城市列表） | `restriction` |

## 4. 请求头

| Header | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `Authorization` | `string` | 否 | — | — |

## 5. 请求示例 (cURL)

```bash
curl "https://v1.apizero.cn/api/traffic-weather-alert?city=beijing&action=restriction&key=YOUR_API_KEY"
```

## 6. 响应字段

| 字段 | 类型 | 说明 | 示例 |
| --- | --- | --- | --- |
| `city` | `string` | 城市拼音 | — |
| `city_cn` | `string` | 城市中文名 | — |
| `date` | `string` | 查询日期（ISO） | — |
| `weekday` | `string` | 今天星期几（中文） | — |
| `restricted_numbers` | `string\|null` | 限行尾号（如 "4,9"），不限行为 null | — |
| `restriction_active` | `boolean` | 今日是否限行 | — |
| `weather.weather` | `string` | 天气描述 | — |
| `weather.temperature` | `string` | 温度（带 °C） | — |
| `weather.is_severe` | `boolean` | 是否恶劣天气 | — |
| `weather.severe_type` | `string\|null` | 恶劣天气类型（暴雨/台风等） | — |
| `work_from_home_advisory` | `string\|null` | 居家办公建议（无恶劣天气为 null） | — |
| `message` | `string` | 综合提示 | — |

## 7. 响应示例

```json
{
    "code": 0,
    "msg": "成功",
    "data": {
        "city": "beijing",
        "city_cn": "北京",
        "date": "2026-05-11",
        "weekday": "周一",
        "restricted_numbers": "5,0",
        "restriction_active": true,
        "weather": {
            "weather": "晴",
            "temperature": "26°C",
            "is_severe": false,
            "severe_type": null
        },
        "work_from_home_advisory": null,
        "message": "今日北京（周一）限行尾号为 5,0"
    },
    "request_id": "abc123"
}
```

## 8. 错误码

| code | status | 说明 |
| --- | --- | --- |
| `4000` | `—` | city 缺失或格式不正确 / action 不合法 |
| `4029` | `—` | 调用过快（QPS 超限） |
| `4030` | `—` | 今日额度用完 |

## 9. 变更日志

- **1.0.0** (2026-05-10)
  - 首次上线，6 城限行 + wttr.in 天气 + 恶劣天气联动

---

**极数本源** · 全部 API: `https://apizero.cn/aidocs` · 人类版本：`https://apizero.cn/marketplace/traffic-weather-alert`

Source: `https://apizero.cn/aidocs/traffic-weather-alert/raw.md`
Last updated: 2026-05-11T16:14:07+08:00
