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

# 短链还原

> 完整还原一个短链的全部跳转链路，输出每跳的状态码、跳转方式（Location/Meta-Refresh）和耗时。适合钓鱼链接溯源、推广短链分析、二维码内容核对。

## 1. 基本信息

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

## 2. 认证

匿名免登录可调每日 30 次；登录用户每日 200 次。

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

## 3. 请求参数

| 参数 | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `url` | `string` | 是 | 要展开的短链 | `https://t.cn/A6xxxx` |
| `max_hops` | `number` | 否 | 最大跳转次数（1-30，默认 10） | — |

## 5. 请求示例 (cURL)

```bash
curl "https://v1.apizero.cn/api/unshort?url=https%3A%2F%2Ft.cn%2FA6xxxx&max_hops=%3Cmax_hops%3E&key=YOUR_API_KEY"
```

## 6. 响应字段

| 字段 | 类型 | 说明 | 示例 |
| --- | --- | --- | --- |
| `original_url` | `string` | 原始 URL | — |
| `final_url` | `string` | 最终落地 URL | — |
| `hops` | `number` | 跳转次数（含最终页） | — |
| `total_time_ms` | `number` | 总耗时（毫秒） | — |
| `chain` | `array` | 每一跳的明细 {hop, url, status, method, duration_ms, next} | — |
| `is_redirect` | `bool` | 是否发生重定向 | — |

## 7. 响应示例

```json
{
    "code": 0,
    "msg": "成功",
    "data": {
        "original_url": "https:\/\/t.cn\/Aabc",
        "final_url": "https:\/\/example.com\/landing",
        "hops": 2,
        "total_time_ms": 412,
        "chain": [
            {
                "hop": 1,
                "url": "https:\/\/t.cn\/Aabc",
                "status": 302,
                "method": "Location",
                "duration_ms": 120,
                "next": "https:\/\/example.com\/landing"
            },
            {
                "hop": 2,
                "url": "https:\/\/example.com\/landing",
                "status": 200,
                "method": "final",
                "duration_ms": 292
            }
        ],
        "is_redirect": true
    }
}
```

## 8. 错误码

| code | status | 说明 |
| --- | --- | --- |
| `4000` | `—` | url 为空或不以 http/https 开头；max_hops 越界 |

## 9. 变更日志

- **1.0.0** (2026-05-07)
  - 首次上线 · 含 Meta-Refresh / JS location 识别

---

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

Source: `https://apizero.cn/aidocs/unshort/raw.md`
Last updated: 2026-05-11T16:16:07+08:00
