> **ITAPI 开发文档** · 来源：https://itapi.top/developer/
> 导出时间：2026-10-18 10:13:54
> 由 https://itapi.top/developer/export 自动生成

---

# 开发文档

本站提供四个「站点级接口」，让开发者可以程序化地获取接口清单、搜索接口、查看接口详情和站点统计数据。

## 站点概况

| 项目 | 说明 |
| --- | --- |
| 接口总数 | 468 个（实时） |
| 分类 | 数据查询、图片壁纸、视频影视、社交平台、游戏娱乐、文案语录、实用工具、音乐音频、文本工具、AI 对话、图片处理 |
| 是否需要注册 | 不需要，全部免费直接调用 |
| 协议 | 同时支持 HTTP 和 HTTPS |
| 请求方式 | 以 GET 为主，POST 也支持 |
| 返回格式 | {"code":200,"msg":"success","data":{...}} |
| 跨域 | 接口已开启 CORS，浏览器里可直接 fetch |
| 限流 | 60 次/分钟 · 1000 次/小时（按 IP） |

## 通用错误码

| code | 说明 |
| --- | --- |
| 200 | 成功 |
| 400 | 参数缺失或格式不对 |
| 401 | 缺少或无效的密钥（该接口需要密钥时） |
| 403 | 密钥已停用 / IP 被封禁 / 密钥无权调用该接口 |
| 404 | 接口不存在 |
| 429 | 请求太频繁，触发了限流 |
| 500 | 接口执行失败 |
| 502 / 503 / 504 | 上游无响应 / 接口维护中 / 上游超时 |

## ① 获取接口清单

拿到本站全部接口的名字和请求地址，用来拼出你真正要调用的那个接口。

      GET
        **复制

```
https://itapi.top/openapi/list
```

### 请求参数

| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| n | int | 可选 | 页码，从 1 开始，默认 1 |
| size | int | 可选 | 每页条数，默认 50，最大 500 |
| cat | string | 可选 | 按分类筛选，如 文案语录 |
| simple | int | 可选 | 传 1 只返回名字+地址 |

### 返回字段

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| total | int | 当前筛选条件下的接口总数 |
| site_total | int | 全站接口总数（不受筛选影响） |
| n / size / pages | int | 当前页码 / 每页条数 / 总页数 |
| categories[] | array | 每个分类的名字和数量 |
| apis[].slug | string | 接口标识（查详情、拼地址都用它） |
| apis[].name | string | 接口名字 |
| apis[].url | string | 接口请求地址，拿到就能直接调 |
| apis[].method | string | 请求方法 |

### 响应示例

      200 OK
        复制

```
{
    "code": 200,
    "msg": "success",
    "data": {
        "total": 468,
        "site_total": 468,
        "n": 1,
        "size": 50,
        "pages": 10,
        "categories": [
            {"name": "数据查询", "count": 27},
            {"name": "音乐音频", "count": 23}
        ],
        "apis": [
            {
                "slug": "demo",
                "name": "示例接口",
                "category": "实用工具",
                "method": "GET",
                "path": "/api/demo",
                "url": "https://itapi.top/api/demo",
                "type": "proxy",
                "need_key": false,
                "description": "示例接口的说明",
                "docs": "https://itapi.top/docs/demo/"
            }
        ]
    }
}
```

### 代码示例

      cURL

```
curl "https://itapi.top/openapi/list?n=1&size=200"
```

      JavaScript

```
const res  = await fetch("https://itapi.top/openapi/list?n=1&size=200");
const data = (await res.json()).data;

console.log(`本站共 ${data.total} 个接口`);
data.apis.forEach(a => console.log(a.name, "->", a.url));
```

      Python

```
import requests

r = requests.get("https://itapi.top/openapi/list", params={"n": 1, "size": 200}, timeout=10)
data = r.json()["data"]

print(f"本站共 {data['total']} 个接口")
for api in data["apis"]:
    print(api["name"], "->", api["url"])
```

## ② 搜索接口

按关键词搜索接口，返回格式与「获取接口清单」完全一致**，可以直接拿结果里的 slug 去调「获取接口详情」。

      GET
        **复制

```
https://itapi.top/openapi/search?q=关键词
```

### 请求参数

| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| q | string | 必填 | 搜索关键词。匹配接口名、标识、说明、分类；也支持 keywords / keyword / kw / s |
| n / size / cat / simple | — | 可选 | 与「获取接口清单」相同 |

### 响应示例

与「获取接口清单」完全相同，只多一个 keyword 字段回显你搜的词。

### 代码示例

      JavaScript

```
/* 1. 搜索 */
const list = (await (await fetch("https://itapi.top/openapi/search?q=" + encodeURIComponent("语录"))).json()).data;
console.log(`搜到 ${list.total} 个接口`);
list.apis.forEach(a => console.log(a.name, a.url));

/* 2. 拿第一个的 slug 去查详情 */
const info = (await (await fetch("https://itapi.top/openapi/info?slug=" + list.apis[0].slug)).json()).data;
console.log(info.name, info.method, info.request_example);
```

## ③ 获取接口详情

用 slug 或名字，拿到某个接口的请求地址、请求参数、返回信息、请求方法**。

      GET
        **复制

```
https://itapi.top/openapi/info?slug=demo
```

### 请求参数

| 参数名 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| slug | string | 三选一 | 接口标识（最准确） |
| name | string | 三选一 | 接口名字，支持模糊 |
| s | string | 三选一 | slug 的简写别名 |

### 返回字段

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| name / slug / category | string | 名字 / 标识 / 分类 |
| method | string | 请求方法（GET / POST / ANY） |
| url | string | 请求地址 |
| need_key | bool | 是否需要密钥 |
| description | string | 接口说明 |
| params[] | array | 请求参数：name / type / required / desc / sample |
| request_example | string | 用示例值拼好的可直接请求的地址 |
| response_fields[] | array | 返回字段说明（部分接口未填，则为空数组） |
| response_example | string | 真实返回示例 |
| docs | string | 该接口的网页版详情页地址 |

### 响应示例

      200 OK
        复制

```
{
    "code": 200,
    "msg": "success",
    "data": {
        "slug": "demo",
        "name": "示例接口",
        "category": "实用工具",
        "method": "GET",
        "type": "proxy",
        "url": "https://itapi.top/api/demo",
        "path": "/api/demo",
        "need_key": false,
        "status": "启用",
        "description": "示例接口的说明",
        "params": [
            {"name": "text", "type": "string", "required": true, "desc": "要处理的文本", "sample": "hello"}
        ],
        "request_example": "https://itapi.top/api/demo?text=hello",
        "response_fields": [
            {"name": "code", "type": "int", "desc": "状态码"}
        ],
        "response_example": "{\"code\":200,\"msg\":\"success\",\"data\":{...}}",
        "example_status": "200 OK",
        "docs": "https://itapi.top/docs/demo/"
    }
}
```

## ④ 站点数据统计

获取本站的接口总数，以及今日调用量和累计调用量。统计只记录调用次数，不包含成功率、耗时或访客 IP。

      GET
        复制

```
https://itapi.top/openapi/stats
```

### 请求参数

无需任何参数。

### 返回字段

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| apis_total | int | 站点接口总数 |
| calls_today | int | 今日调用数（自然日 00:00 起累计） |
| calls_today_text | string | 今日调用数（大数会简写，如 2.1k） |
| calls_total | int | 累计总调用数 |
| calls_total_text | string | 总调用数（简写，如 217.7k） |
| updated_at | string | 本次返回数据的生成时间（实时统计） |

### 响应示例

      200 OK
        复制

```
{
    "code": 200,
    "msg": "success",
    "data": {
        "apis_total": 468,
        "calls_today": 354,
        "calls_today_text": "354",
        "calls_total": 217675,
        "calls_total_text": "217.7k",
        "updated_at": "2026-10-18 10:13:54"
    }
}
```

## 完整使用流程

三步走：先拿清单（或搜索）→ 再查详情 -> 最后拼参数调用。

      PHP 完整示例

```
<?php
/* 1. 搜索接口（也可以直接 /openapi/list 拿全部） */
$list = json_decode(
    file_get_contents("https://itapi.top/openapi/search?q=" . urlencode("语录")), true
)['data'];
echo "搜到 {$list['total']} 个接口\n";
foreach ($list['apis'] as $a) {
    echo "  {$a['name']} -> {$a['url']}\n";
}

/* 2. 查详情 */
$slug = $list['apis'][0]['slug'];
$info = json_decode(
    file_get_contents("https://itapi.top/openapi/info?slug=" . urlencode($slug)), true
)['data'];
echo "\n{$info['name']}（{$info['method']}）\n";
foreach ($info['params'] as $p) {
    echo "  参数 {$p['name']}（" . ($p['required'] ? '必填' : '可选') . "）：{$p['desc']}\n";
}

/* 3. 拼参数调用 */
$qs = [];
foreach ($info['params'] as $p) {
    if ($p['sample'] !== '') { $qs[$p['name']] = $p['sample']; }
}
$result = file_get_contents($info['url'] . '?' . http_build_query($qs));
echo "\n调用结果：\n{$result}";
```

## 常见问题

| 问题 | 说明 |
| --- | --- |
| 浏览器里 fetch 报跨域？ | 接口已开启 CORS（Access-Control-Allow-Origin: *），一般不会；如有问题请反馈 |
| 为什么有的接口要密钥？ | 站长可对单个接口设置「需要密钥」，这类接口要在地址后加 &key=你的密钥，或用请求头 X-API-Key |
| 返回 429 是什么意思？ | 请求太频繁，触发限流（60 次/分 · 1000 次/时） |
| 支持 POST 吗？ | 支持。接口既接受 URL 参数也接受 POST 表单参数 |
| 接口返回 502 / 504？ | 该接口依赖的上游暂时不可用，稍后重试 |

## 导出文档

把本页内容导出成 Markdown** 或 **纯文本**，方便存档、写进项目文档，或者直接交给 AI 助手当上下文用。

        [下载 Markdown（.md）](/developer/export?format=md)
        [下载纯文本（.txt）](/developer/export?format=txt)
        [浏览器中预览](/developer/export?format=md&view=1)

导出文件名：itapi-api-docs.md 或 itapi-api-docs.txt，内容会自动带上导出时间和来源地址。
