<!-- 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 -->

# 王者战力查询

> 王者荣耀全国战力查询，一接口聚合「英雄列表 + 区服战力分布」2 大功能。

• action=heroes — 返回 130+ 个英雄完整目录（中文名 / ename / 称号 / 头像 URL），优先腾讯官方源 https://pvp.qq.com/web201605/js/herolist.json，失败自动降级 yxsaoma.com

• action=query — 查询某英雄在某区服的全国战力分布数据，返回 90 条左右的省市区战力榜（含同地区相近排名）

支持 4 大区服：
  · aqq = Android QQ
  · awx = Android 微信
  · iqq = iOS QQ
  · iwx = iOS 微信

查询类型：
  · all = 完整 heroList（按 level 混合排列，约 90 项）
  · min = 各级（省/市/区）最低战力 + 相近排名（rank ≤ +100）
  · max = 各级（省/市/区）最高战力 + 相近排名

上游签名（warzoneSignKey20240515 + MD5 + timestamp）已在网关侧自动处理，调用方无需关心。英雄列表缓存 24 小时，战力数据缓存 1 小时。

## 1. 基本信息

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

## 2. 认证

匿名每日 50 次、QPS 2；登录用户每日 200 次、QPS 5（全部免费）。英雄列表缓存 24h、战力数据缓存 1h。

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

## 3. 请求参数

| 参数 | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `action` | `string` | 是 | 操作类型：heroes=英雄列表 / query=战力查询 | `query` |
| `hero` | `string` | 否 | 英雄中文名（如「赵云」）；action=query 时与 hero_id 二选一必传 | `赵云` |
| `hero_id` | `integer` | 否 | 英雄 ename（如赵云=107）；action=query 时与 hero 二选一必传，hero_id 优先级更高 | — |
| `zone` | `string` | 否 | 区服代码：aqq=Android QQ / awx=Android 微信 / iqq=iOS QQ / iwx=iOS 微信；action=query 必填 | `aqq` |
| `type` | `string` | 否 | 返回类型：all=完整列表（默认）/ min=最低战力 / max=最高战力 | `all` |

## 4. 请求头

| Header | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `Authorization` | `string` | 否 | API Key 鉴权头，格式 Bearer sk_live_xxx；匿名调用时可省略（每日 50 次免费） | `Bearer sk_live_xxxxxxxxxxxxxx` |

## 5. 请求示例 (cURL)

```bash
curl "https://v1.apizero.cn/api/wzry?action=query&hero=%E8%B5%B5%E4%BA%91&hero_id=&zone=aqq&type=all&key=YOUR_API_KEY"
```

## 6. 响应字段

| 字段 | 类型 | 说明 | 示例 |
| --- | --- | --- | --- |
| `action` | `string` | 回传 action 标识（heroes 或 query） | — |
| `count` | `number` | 英雄总数（heroes） | — |
| `list` | `array` | 英雄列表（heroes） | — |
| `list[].name` | `string` | 英雄中文名（heroes） | — |
| `list[].ename` | `string` | 英雄 ID（数字字符串，如 107）（heroes） | — |
| `list[].title` | `string` | 英雄称号，如「苍天翔龙」（heroes） | — |
| `list[].avatar` | `string` | 英雄头像 URL（gtimg.cn CDN）（heroes） | — |
| `hero` | `object` | 查询的英雄信息（query）；含 name/title/ename/avatar | — |
| `zone` | `object` | 区服信息（query）；含 code/system/platform | — |
| `type` | `string` | 查询类型显示名（全部/最低战力/最高战力）（query） | — |
| `type_code` | `string` | 查询类型代码（all/min/max）（query） | — |
| `syn_date` | `string` | 上游数据同步日期 YYYY-MM-DD（query） | — |
| `rank_data` | `object\|array` | 战力数据；type=all 时为数组（90 条），type=min/max 时为 {extreme, similar} 结构 | — |
| `rank_data[].address` | `string` | 地区名（如「浙江/金华市/磐安县」） | — |
| `rank_data[].level` | `string` | 层级：province=省 / city=市 / district=区县 | — |
| `rank_data[].rank` | `number` | 战力分数（数字越高战力越强） | — |
| `rank_data[].adcode` | `string` | 地区编码 | — |
| `rank_data.extreme` | `object` | type=min/max 时返回，含 province/city/district 各级第 1 名 | — |
| `rank_data.similar` | `object` | type=min/max 时返回，含与 extreme 排名差距 ≤100 的相近排名列表 | — |

## 7. 响应示例

```json
{
    "code": 0,
    "msg": "成功",
    "data": {
        "action": "query",
        "hero": {
            "name": "赵云",
            "title": "苍天翔龙",
            "ename": "107",
            "avatar": "https:\/\/game.gtimg.cn\/images\/yxzj\/img201606\/heroimg\/107\/107.jpg"
        },
        "zone": {
            "code": "aqq",
            "system": "Android",
            "platform": "QQ"
        },
        "type": "最低战力",
        "type_code": "min",
        "syn_date": "2026-05-06",
        "rank_data": {
            "extreme": {
                "province": {
                    "address": "云南",
                    "level": "province",
                    "rank": 4500,
                    "adcode": "..."
                },
                "city": {
                    "address": "海南\/三亚市",
                    "level": "city",
                    "rank": 1800,
                    "adcode": "..."
                },
                "district": {
                    "address": "北京\/朝阳区",
                    "level": "district",
                    "rank": 800,
                    "adcode": "..."
                }
            },
            "similar": {
                "province": [
                    {
                        "address": "云南",
                        "rank": 4500
                    },
                    {
                        "address": "甘肃",
                        "rank": 4520
                    }
                ],
                "city": [],
                "district": []
            }
        }
    },
    "request_id": "abc123def456"
}
```

## 8. 错误码

| code | status | 说明 |
| --- | --- | --- |
| `4000` | `—` | 参数错误：action/zone/type 非法 / 缺少 hero+hero_id / 英雄未找到 |
| `4015` | `—` | 匿名调用每日额度用完，需要 API Key |
| `4029` | `—` | QPS 超限 |
| `4030` | `—` | 今日额度用完 |
| `5020` | `—` | 上游 HTTP 失败 / 双源英雄列表均不可用 |
| `5021` | `—` | 上游响应格式异常 / 该英雄在该区服暂无战力数据 |

## 9. 变更日志

- **1.0.0** (2026-05-06)
  - 首次上线，聚合英雄列表 + 全国战力 2 个 action
  - 英雄列表双源容灾：腾讯官方失败自动降级 yxsaoma.com
  - 内置 MD5 签名（warzoneSignKey20240515 + timestamp + 字典序拼接）
  - 英雄列表缓存 24h、战力数据缓存 1h
  - type=min/max 时按 level（省/市/区）分组，输出 extreme + similar（rank 差距 ≤ +100 相近排名）
  - find_hero 同时支持 hero（中文名）和 hero_id（ename）两种定位方式

---

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

Source: `https://apizero.cn/aidocs/wzry/raw.md`
Last updated: 2026-05-13T15:28:07+08:00
