正在启动平台

短链还原 API 接入文档unshort

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

1. 基本信息

接口地址https://v1.apizero.cn/api/unshort
请求方法GET
分类dev
提供方极数本源
计费模式免费试用
单次消耗0 积分
起步价
QPS 限制5 req/s
每日免费额度2000 次(已认证用户)
匿名每日额度300 次(无 API Key)
VIP 免费
调用次数

2. 认证

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

获取 API Key:登录 https://apizero.cn/account/keys

3. 请求参数

参数名类型必填说明示例
urlstring要展开的短链https://t.cn/A6xxxx
max_hopsnumber最大跳转次数(1-30,默认 10)

5. 请求示例

以下 5 种语言示例都是可直接运行的,只需把 YOUR_API_KEY 替换为实际 Key。

cURL

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

Python

import requests

resp = requests.get(
    "https://v1.apizero.cn/api/unshort",
    params={
    "url": "https://t.cn/A6xxxx",
    "max_hops": "<max_hops>",
    "key": "YOUR_API_KEY",
},
    timeout=15,
)
resp.raise_for_status()
print(resp.json())

JavaScript (Node.js)

// Node.js 18+ / 浏览器原生 fetch
const params = new URLSearchParams({
  "url": "https://t.cn/A6xxxx",
  "max_hops": "<max_hops>",
  "key": "YOUR_API_KEY",
});

const res = await fetch(`https://v1.apizero.cn/api/unshort?${params}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);

Go

package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://v1.apizero.cn/api/unshort", nil)
	q := req.URL.Query()
	q.Set("url", "https://t.cn/A6xxxx")
	q.Set("max_hops", "<max_hops>")
	q.Set("key", "YOUR_API_KEY")
	req.URL.RawQuery = q.Encode()

	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}

PHP

<?php
$url = "https://v1.apizero.cn/api/unshort?" . http_build_query([
    "url" => "https://t.cn/A6xxxx",
    "max_hops" => "<max_hops>",
    "key" => "YOUR_API_KEY",
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$body = curl_exec($ch);
curl_close($ch);

$data = json_decode($body, true);
print_r($data);

6. 响应字段

字段类型说明示例
original_urlstring原始 URL
final_urlstring最终落地 URL
hopsnumber跳转次数(含最终页)
total_time_msnumber总耗时(毫秒)
chainarray每一跳的明细 {hop, url, status, method, duration_ms, next}
is_redirectbool是否发生重定向

7. 响应示例

{
    "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. 错误码

codestatus说明
4000url 为空或不以 http/https 开头;max_hops 越界

9. 变更日志

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

常见问题

短链还原 接口怎么免费使用?

未登录用户每个 IP 每天 300 次免费。登录用户创建 API Key 后每天 2000 次免费,超额部分按点数计费(0 点/次)。

短链还原 支持哪些调用方式?

接口使用 GET 请求。文档提供 cURL、Python、JavaScript (Node.js)、Go、PHP 五种语言的可运行示例。也可以下载 /openapi.json 导入 Postman / Insomnia / Apifox 反向生成 SDK。

调用不限额么? QPS 是多少?

本接口 QPS 限制 5 req/s,每个 API Key 每日免费 2000 次。需要更高额度可升级 VIP 套餐或联系售后提高 QPS。

这个接口跟自己直连上游有什么区别?

极数本源 作为中间层提供:统一鉴权(一个 Key 调所有接口)、统一计费(点数制)、统一限流、统一错误码、多上游自动切换。免去逐个对接上游、维护 Key、统计调用量的运维成本。